Chromium Code Reviews| 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/HashMap.h" | |
| 8 #include "wtf/ThreadSpecific.h" | |
| 9 #include "wtf/Threading.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 namespace { | |
| 14 | |
| 15 using FinalizerHashMap = HashMap<const ActiveScriptWrappable*, ScriptWrappable*> ; | |
| 16 | |
| 17 FinalizerHashMap& finalizerList() | |
| 18 { | |
| 19 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<FinalizerHashMap>, finalizerM ap, new ThreadSpecific<FinalizerHashMap>()); | |
|
haraken
2016/03/18 08:07:28
I'm just curious but why do you call this a "final
jochen (gone - plz use gerrit)
2016/03/18 13:18:01
rename to activeScriptWrappables
| |
| 20 return *finalizerMap; | |
| 21 } | |
| 22 | |
| 23 } // namespace | |
| 24 | |
| 25 ActiveScriptWrappable::ActiveScriptWrappable(ScriptWrappable* wrappable) | |
| 26 { | |
| 27 finalizerList().add(this, wrappable); | |
| 28 } | |
| 29 | |
| 30 ActiveScriptWrappable::~ActiveScriptWrappable() | |
| 31 { | |
| 32 finalizerList().remove(this); | |
| 33 } | |
| 34 | |
| 35 ScriptWrappable* ActiveScriptWrappable::toScriptWrappable() const | |
|
haraken
2016/03/18 08:07:28
For performance reasons, would it be better to mak
jochen (gone - plz use gerrit)
2016/03/18 13:18:01
done
| |
| 36 { | |
| 37 return finalizerList().get(this); | |
| 38 } | |
| 39 | |
| 40 } // namespace blink | |
| OLD | NEW |