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

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: Use newer v8 api 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..57af6a761c850e679631cb5e46dde1b8b39434a5 100644
--- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp
@@ -137,6 +137,25 @@ 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).
+ ASSERT(isMainThread());
haraken 2016/04/19 04:58:30 How is it guaranteed that this function is not cal
Marcel Hlopko 2016/04/19 12:40:29 I changed the assert to if (...) return.
+ // marking for the main world
+ scriptWrappable->markWrapper(isolate);
+ WorldMap& isolatedWorlds = isolatedWorldMap();
+ for (WorldMap::iterator it = isolatedWorlds.begin(); it != isolatedWorlds.end(); ++it) {
+ DOMDataStore& dataStore = it->value->domDataStore();
haraken 2016/04/19 04:58:30 You can use: for (auto& isolatedWorld : isolate
Marcel Hlopko 2016/04/19 12:40:29 Done.
+ if (dataStore.containsWrapper(scriptWrappable)) {
+ // marking for the isolated worlds
+ dataStore.markWrapper(scriptWrappable, isolate);
+ }
+ }
+}
+
DOMWrapperWorld::~DOMWrapperWorld()
{
ASSERT(!isMainWorld());

Powered by Google App Engine
This is Rietveld 408576698