OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "bindings/core/v8/ActiveScriptWrappable.h" | |
6 | |
7 #include "wtf/HashSet.h" | |
8 #include "wtf/ThreadSpecific.h" | |
9 #include "wtf/Threading.h" | |
10 | |
11 namespace blink { | |
12 | |
13 namespace { | |
14 | |
15 using ActiveScriptWrappableSetType = HashSet<const ActiveScriptWrappable*>; | |
16 | |
17 ActiveScriptWrappableSetType& activeScriptWrappables() | |
18 { | |
19 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<ActiveScriptWrappableSetType> , activeScriptWrappableSet, new ThreadSpecific<ActiveScriptWrappableSetType>()); | |
20 return *activeScriptWrappableSet; | |
21 } | |
22 | |
23 } // namespace | |
24 | |
25 ActiveScriptWrappable::ActiveScriptWrappable(ScriptWrappable* self) | |
26 : m_scriptWrappable(self) | |
27 { | |
28 activeScriptWrappables().add(this); | |
29 } | |
30 | |
31 ActiveScriptWrappable::~ActiveScriptWrappable() | |
sof
2016/05/10 05:22:26
haraken@: is it guaranteed that this global set of
| |
32 { | |
33 activeScriptWrappables().remove(this); | |
34 } | |
35 | |
36 ScriptWrappable* ActiveScriptWrappable::toScriptWrappable() const | |
37 { | |
38 return m_scriptWrappable; | |
39 } | |
40 | |
41 } // namespace blink | |
OLD | NEW |