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