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

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

Issue 1805843002: [v8 gc] Introduce a base class for all objects that can have pending activity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 years, 9 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
new file mode 100644
index 0000000000000000000000000000000000000000..437bf83932da2186d80e05737591d455cae89909
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "bindings/core/v8/ActiveScriptWrappable.h"
+
+#include "wtf/HashSet.h"
+#include "wtf/ThreadSpecific.h"
+#include "wtf/Threading.h"
+
+namespace blink {
+
+namespace {
+
+using ActiveScriptWrappableSetType = HashSet<const ActiveScriptWrappable*>;
+
+ActiveScriptWrappableSetType& activeScriptWrappables()
+{
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<ActiveScriptWrappableSetType>, activeScriptWrappableSet, new ThreadSpecific<ActiveScriptWrappableSetType>());
+ return *activeScriptWrappableSet;
+}
+
+} // namespace
+
+ActiveScriptWrappable::ActiveScriptWrappable(ScriptWrappable* self)
+ : m_scriptWrappable(self)
+{
+ activeScriptWrappables().add(this);
+}
+
+ActiveScriptWrappable::~ActiveScriptWrappable()
sof 2016/05/10 05:22:26 haraken@: is it guaranteed that this global set of
+{
+ activeScriptWrappables().remove(this);
+}
+
+ScriptWrappable* ActiveScriptWrappable::toScriptWrappable() const
+{
+ return m_scriptWrappable;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698