Chromium Code Reviews| 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()); |