OLD | NEW |
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 Loading... |
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: |
90 case WorldType::kWorker: { | 91 case WorldType::kWorker: { |
91 WorldMap& map = GetWorldMap(); | 92 WorldMap& map = GetWorldMap(); |
92 DCHECK(!map.Contains(world_id_)); | 93 DCHECK(!map.Contains(world_id_)); |
93 map.insert(world_id_, this); | 94 map.insert(world_id_, this); |
94 if (IsMainThread()) | 95 if (IsMainThread()) |
95 number_of_non_main_worlds_in_main_thread_++; | 96 number_of_non_main_worlds_in_main_thread_++; |
96 break; | 97 break; |
97 } | 98 } |
98 } | 99 } |
99 } | 100 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 static int next_devtools_isolated_world_id = | 282 static int next_devtools_isolated_world_id = |
282 IsolatedWorldId::kDevToolsFirstIsolatedWorldId; | 283 IsolatedWorldId::kDevToolsFirstIsolatedWorldId; |
283 if (next_devtools_isolated_world_id > | 284 if (next_devtools_isolated_world_id > |
284 IsolatedWorldId::kDevToolsLastIsolatedWorldId) | 285 IsolatedWorldId::kDevToolsLastIsolatedWorldId) |
285 return WorldId::kInvalidWorldId; | 286 return WorldId::kInvalidWorldId; |
286 return next_devtools_isolated_world_id++; | 287 return next_devtools_isolated_world_id++; |
287 } | 288 } |
288 case WorldType::kGarbageCollector: | 289 case WorldType::kGarbageCollector: |
289 case WorldType::kRegExp: | 290 case WorldType::kRegExp: |
290 case WorldType::kTesting: | 291 case WorldType::kTesting: |
| 292 case WorldType::kForV8ContextSnapshotNonMain: |
291 case WorldType::kWorker: | 293 case WorldType::kWorker: |
292 int world_id = *next_world_id; | 294 int world_id = *next_world_id; |
293 CHECK_GE(world_id, WorldId::kUnspecifiedWorldIdStart); | 295 CHECK_GE(world_id, WorldId::kUnspecifiedWorldIdStart); |
294 *next_world_id = world_id + 1; | 296 *next_world_id = world_id + 1; |
295 return world_id; | 297 return world_id; |
296 } | 298 } |
297 NOTREACHED(); | 299 NOTREACHED(); |
298 return kInvalidWorldId; | 300 return kInvalidWorldId; |
299 } | 301 } |
300 | 302 |
301 void DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds( | 303 void DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds( |
302 ScriptWrappable* script_wrappable) { | 304 ScriptWrappable* script_wrappable) { |
303 DCHECK(script_wrappable); | 305 DCHECK(script_wrappable); |
304 DCHECK(IsMainThread()); | 306 DCHECK(IsMainThread()); |
305 | 307 |
306 script_wrappable->UnsetWrapperIfAny(); | 308 script_wrappable->UnsetWrapperIfAny(); |
307 | 309 |
308 for (auto& world : GetWorldMap().Values()) | 310 for (auto& world : GetWorldMap().Values()) |
309 world->DomDataStore().UnsetWrapperIfAny(script_wrappable); | 311 world->DomDataStore().UnsetWrapperIfAny(script_wrappable); |
310 } | 312 } |
311 | 313 |
312 } // namespace blink | 314 } // namespace blink |
OLD | NEW |