js/src/frontend/ParseMaps-inl.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef frontend_ParseMaps_inl_h
michael@0 8 #define frontend_ParseMaps_inl_h
michael@0 9
michael@0 10 #include "frontend/ParseMaps.h"
michael@0 11
michael@0 12 #include "jscntxtinlines.h"
michael@0 13
michael@0 14 namespace js {
michael@0 15 namespace frontend {
michael@0 16
michael@0 17 template <class Map>
michael@0 18 inline bool
michael@0 19 AtomThingMapPtr<Map>::ensureMap(ExclusiveContext *cx)
michael@0 20 {
michael@0 21 if (map_)
michael@0 22 return true;
michael@0 23
michael@0 24 AutoLockForExclusiveAccess lock(cx);
michael@0 25 map_ = cx->parseMapPool().acquire<Map>();
michael@0 26 return !!map_;
michael@0 27 }
michael@0 28
michael@0 29 template <class Map>
michael@0 30 inline void
michael@0 31 AtomThingMapPtr<Map>::releaseMap(ExclusiveContext *cx)
michael@0 32 {
michael@0 33 if (!map_)
michael@0 34 return;
michael@0 35
michael@0 36 AutoLockForExclusiveAccess lock(cx);
michael@0 37 cx->parseMapPool().release(map_);
michael@0 38 map_ = nullptr;
michael@0 39 }
michael@0 40
michael@0 41 template <typename ParseHandler>
michael@0 42 inline bool
michael@0 43 AtomDecls<ParseHandler>::init()
michael@0 44 {
michael@0 45 AutoLockForExclusiveAccess lock(cx);
michael@0 46 map = cx->parseMapPool().acquire<AtomDefnListMap>();
michael@0 47 return map;
michael@0 48 }
michael@0 49
michael@0 50 template <typename ParseHandler>
michael@0 51 inline
michael@0 52 AtomDecls<ParseHandler>::~AtomDecls()
michael@0 53 {
michael@0 54 if (map) {
michael@0 55 AutoLockForExclusiveAccess lock(cx);
michael@0 56 cx->parseMapPool().release(map);
michael@0 57 }
michael@0 58 }
michael@0 59
michael@0 60 } /* namespace frontend */
michael@0 61 } /* namespace js */
michael@0 62
michael@0 63 #endif /* frontend_ParseMaps_inl_h */

mercurial