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

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

Issue 2989793003: Revert of [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Created 3 years, 4 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 WTF::WrapUnique(new DOMDataStore(isolate, IsMainWorld()))) { 80 WTF::WrapUnique(new DOMDataStore(isolate, IsMainWorld()))) {
81 switch (world_type_) { 81 switch (world_type_) {
82 case WorldType::kMain: 82 case WorldType::kMain:
83 // The main world is managed separately from worldMap(). See worldMap(). 83 // The main world is managed separately from worldMap(). See worldMap().
84 break; 84 break;
85 case WorldType::kIsolated: 85 case WorldType::kIsolated:
86 case WorldType::kInspectorIsolated: 86 case WorldType::kInspectorIsolated:
87 case WorldType::kGarbageCollector: 87 case WorldType::kGarbageCollector:
88 case WorldType::kRegExp: 88 case WorldType::kRegExp:
89 case WorldType::kTesting: 89 case WorldType::kTesting:
90 case WorldType::kForV8ContextSnapshotNonMain:
91 case WorldType::kWorker: { 90 case WorldType::kWorker: {
92 WorldMap& map = GetWorldMap(); 91 WorldMap& map = GetWorldMap();
93 DCHECK(!map.Contains(world_id_)); 92 DCHECK(!map.Contains(world_id_));
94 map.insert(world_id_, this); 93 map.insert(world_id_, this);
95 if (IsMainThread()) 94 if (IsMainThread())
96 number_of_non_main_worlds_in_main_thread_++; 95 number_of_non_main_worlds_in_main_thread_++;
97 break; 96 break;
98 } 97 }
99 } 98 }
100 } 99 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 static int next_devtools_isolated_world_id = 281 static int next_devtools_isolated_world_id =
283 IsolatedWorldId::kDevToolsFirstIsolatedWorldId; 282 IsolatedWorldId::kDevToolsFirstIsolatedWorldId;
284 if (next_devtools_isolated_world_id > 283 if (next_devtools_isolated_world_id >
285 IsolatedWorldId::kDevToolsLastIsolatedWorldId) 284 IsolatedWorldId::kDevToolsLastIsolatedWorldId)
286 return WorldId::kInvalidWorldId; 285 return WorldId::kInvalidWorldId;
287 return next_devtools_isolated_world_id++; 286 return next_devtools_isolated_world_id++;
288 } 287 }
289 case WorldType::kGarbageCollector: 288 case WorldType::kGarbageCollector:
290 case WorldType::kRegExp: 289 case WorldType::kRegExp:
291 case WorldType::kTesting: 290 case WorldType::kTesting:
292 case WorldType::kForV8ContextSnapshotNonMain:
293 case WorldType::kWorker: 291 case WorldType::kWorker:
294 int world_id = *next_world_id; 292 int world_id = *next_world_id;
295 CHECK_GE(world_id, WorldId::kUnspecifiedWorldIdStart); 293 CHECK_GE(world_id, WorldId::kUnspecifiedWorldIdStart);
296 *next_world_id = world_id + 1; 294 *next_world_id = world_id + 1;
297 return world_id; 295 return world_id;
298 } 296 }
299 NOTREACHED(); 297 NOTREACHED();
300 return kInvalidWorldId; 298 return kInvalidWorldId;
301 } 299 }
302 300
303 void DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds( 301 void DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds(
304 ScriptWrappable* script_wrappable) { 302 ScriptWrappable* script_wrappable) {
305 DCHECK(script_wrappable); 303 DCHECK(script_wrappable);
306 DCHECK(IsMainThread()); 304 DCHECK(IsMainThread());
307 305
308 script_wrappable->UnsetWrapperIfAny(); 306 script_wrappable->UnsetWrapperIfAny();
309 307
310 for (auto& world : GetWorldMap().Values()) 308 for (auto& world : GetWorldMap().Values())
311 world->DomDataStore().UnsetWrapperIfAny(script_wrappable); 309 world->DomDataStore().UnsetWrapperIfAny(script_wrappable);
312 } 310 }
313 311
314 } // namespace blink 312 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698