Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(873)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp

Issue 1966743004: Move tracking of ActiveScriptWrappables to V8PerIsolateData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lazy creation of map Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp b/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp
index 012dbde6f4b762f019d32cbdfa9030805b65692d..4fb8c56dfac20d205a348ce829aeb5f836da3d6e 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp
@@ -6,40 +6,23 @@
#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/core/v8/ScriptWrappableVisitor.h"
-#include "wtf/HashSet.h"
-#include "wtf/ThreadSpecific.h"
-#include "wtf/Threading.h"
+#include "bindings/core/v8/V8PerIsolateData.h"
namespace blink {
-namespace {
-
-using ActiveScriptWrappableSetType = PersistentHeapHashSet<WeakMember<const ActiveScriptWrappable>>;
-
-ActiveScriptWrappableSetType& activeScriptWrappables()
-{
- DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<ActiveScriptWrappableSetType>, activeScriptWrappableSet, new ThreadSpecific<ActiveScriptWrappableSetType>());
- if (!activeScriptWrappableSet.isSet())
- activeScriptWrappableSet->registerAsStaticReference();
- return *activeScriptWrappableSet;
-}
-
-} // namespace
-
ActiveScriptWrappable::ActiveScriptWrappable(ScriptWrappable* self)
: m_scriptWrappable(self)
{
- activeScriptWrappables().add(this);
-}
-
-ScriptWrappable* ActiveScriptWrappable::toScriptWrappable() const
-{
- return m_scriptWrappable;
+ ASSERT(ThreadState::current());
+ v8::Isolate* isolate = ThreadState::current()->isolate();
+ V8PerIsolateData* isolateData = V8PerIsolateData::from(isolate);
+ isolateData->addActiveScriptWrappable(this);
}
-void ActiveScriptWrappable::traceActiveScriptWrappables(ScriptWrappableVisitor* visitor)
+void ActiveScriptWrappable::traceActiveScriptWrappables(v8::Isolate* isolate, ScriptWrappableVisitor* visitor)
{
- for (auto activeWrappable : activeScriptWrappables()) {
+ V8PerIsolateData* isolateData = V8PerIsolateData::from(isolate);
+ for (auto activeWrappable : isolateData->activeScriptWrappables()) {
if (!activeWrappable->hasPendingActivity())
continue;

Powered by Google App Engine
This is Rietveld 408576698