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

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

Issue 1876383003: Introduce infrastructure for tracing ScriptWrappables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix var used only in assert Created 4 years, 8 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/DOMWrapperWorld.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp
index 62ee227650a36c24720f7bb4e9295a1c5cb1f41d..c1e74fb3f184f4dd79032f1b0e981230d221a18d 100644
--- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp
@@ -137,6 +137,27 @@ void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld>>& wor
worlds.append(it->value);
}
+void DOMWrapperWorld::markWrappersInAllWorlds(ScriptWrappable* scriptWrappable, v8::Isolate* isolate)
+{
+ // TODO(hlopko): Currently wrapper in one world will keep wrappers in all
+ // worlds alive (possibly holding on entire documents). This is neither
+ // needed (there is no way to get from one wrapper to another), nor wanted
+ // (big performance and memory overhead).
+
+ // Marking for the main world
+ scriptWrappable->markWrapper(isolate);
+ if (!isMainThread())
+ return;
+ WorldMap& isolatedWorlds = isolatedWorldMap();
+ for (auto& keyValuePair : isolatedWorlds) {
+ DOMDataStore& dataStore = keyValuePair.value->domDataStore();
+ if (dataStore.containsWrapper(scriptWrappable)) {
+ // Marking for the isolated worlds
+ dataStore.markWrapper(scriptWrappable);
+ }
+ }
+}
+
DOMWrapperWorld::~DOMWrapperWorld()
{
ASSERT(!isMainWorld());

Powered by Google App Engine
This is Rietveld 408576698