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

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

Issue 1683493003: Remove ContextScope from visitDOMWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // TODO(hlopko): Currently wrapper in one world will keep wrappers in all 141 // TODO(hlopko): Currently wrapper in one world will keep wrappers in all
142 // worlds alive (possibly holding on entire documents). This is neither 142 // worlds alive (possibly holding on entire documents). This is neither
143 // needed (there is no way to get from one wrapper to another), nor wanted 143 // needed (there is no way to get from one wrapper to another), nor wanted
144 // (big performance and memory overhead). 144 // (big performance and memory overhead).
145 145
146 // Marking for the main world 146 // Marking for the main world
147 scriptWrappable->markWrapper(isolate); 147 scriptWrappable->markWrapper(isolate);
148 if (!isMainThread()) 148 if (!isMainThread())
149 return; 149 return;
150 WorldMap& isolatedWorlds = isolatedWorldMap(); 150 WorldMap& isolatedWorlds = isolatedWorldMap();
151 for (auto& keyValuePair : isolatedWorlds) { 151 for (auto& world : isolatedWorlds.values()) {
152 DOMDataStore& dataStore = keyValuePair.value->domDataStore(); 152 DOMDataStore& dataStore = world->domDataStore();
153 if (dataStore.containsWrapper(scriptWrappable)) { 153 if (dataStore.containsWrapper(scriptWrappable)) {
154 // Marking for the isolated worlds 154 // Marking for the isolated worlds
155 dataStore.markWrapper(scriptWrappable); 155 dataStore.markWrapper(scriptWrappable);
156 } 156 }
157 } 157 }
158 } 158 }
159 159
160 void DOMWrapperWorld::setWrapperReferencesInAllWorlds(const v8::Persistent<v8::O bject>& parent, ScriptWrappable* scriptWrappable, v8::Isolate* isolate)
161 {
162 // Marking for the main world
163 scriptWrappable->setReference(parent, isolate);
164 if (!isMainThread())
165 return;
166 WorldMap& isolatedWorlds = isolatedWorldMap();
167 for (auto& world : isolatedWorlds.values()) {
168 DOMDataStore& dataStore = world->domDataStore();
169 if (dataStore.containsWrapper(scriptWrappable)) {
170 // Marking for the isolated worlds
171 dataStore.setReference(parent, scriptWrappable, isolate);
172 }
173 }
174 }
175
160 DOMWrapperWorld::~DOMWrapperWorld() 176 DOMWrapperWorld::~DOMWrapperWorld()
161 { 177 {
162 ASSERT(!isMainWorld()); 178 ASSERT(!isMainWorld());
163 179
164 dispose(); 180 dispose();
165 181
166 if (!isIsolatedWorld()) 182 if (!isIsolatedWorld())
167 return; 183 return;
168 184
169 WorldMap& map = isolatedWorldMap(); 185 WorldMap& map = isolatedWorldMap();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 m_domObjectHolders.remove(holderBase); 318 m_domObjectHolders.remove(holderBase);
303 } 319 }
304 320
305 void DOMWrapperWorld::weakCallbackForDOMObjectHolder(const v8::WeakCallbackInfo< DOMObjectHolderBase>& data) 321 void DOMWrapperWorld::weakCallbackForDOMObjectHolder(const v8::WeakCallbackInfo< DOMObjectHolderBase>& data)
306 { 322 {
307 DOMObjectHolderBase* holderBase = data.GetParameter(); 323 DOMObjectHolderBase* holderBase = data.GetParameter();
308 holderBase->world()->unregisterDOMObjectHolder(holderBase); 324 holderBase->world()->unregisterDOMObjectHolder(holderBase);
309 } 325 }
310 326
311 } // namespace blink 327 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698