| Index: third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp
|
| diff --git a/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp b/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp
|
| index 106f9d359a1550d98dddc8b8e51e0a908a22a18f..0a2ec8a5e01d214d5db2ad45176e6df3cb0eca74 100644
|
| --- a/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp
|
| +++ b/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp
|
| @@ -62,8 +62,10 @@ static bool IsIsolatedWorldId(int world_id) {
|
| PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::Create(v8::Isolate* isolate,
|
| WorldType world_type) {
|
| DCHECK_NE(WorldType::kIsolated, world_type);
|
| - return AdoptRef(new DOMWrapperWorld(isolate, world_type,
|
| - GenerateWorldIdForType(world_type)));
|
| + int world_id = GenerateWorldIdForType(world_type);
|
| + if (world_id == kInvalidWorldId)
|
| + return nullptr;
|
| + return AdoptRef(new DOMWrapperWorld(isolate, world_type, world_id));
|
| }
|
|
|
| DOMWrapperWorld::DOMWrapperWorld(v8::Isolate* isolate,
|
| @@ -78,6 +80,7 @@ DOMWrapperWorld::DOMWrapperWorld(v8::Isolate* isolate,
|
| // The main world is managed separately from worldMap(). See worldMap().
|
| break;
|
| case WorldType::kIsolated:
|
| + case WorldType::kInspectorIsolated:
|
| case WorldType::kGarbageCollector:
|
| case WorldType::kRegExp:
|
| case WorldType::kTesting:
|
| @@ -257,6 +260,7 @@ void DOMWrapperWorld::WeakCallbackForDOMObjectHolder(
|
| holder_base->World()->UnregisterDOMObjectHolder(holder_base);
|
| }
|
|
|
| +// static
|
| int DOMWrapperWorld::GenerateWorldIdForType(WorldType world_type) {
|
| DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<int>, next_world_id,
|
| new ThreadSpecific<int>);
|
| @@ -270,6 +274,8 @@ int DOMWrapperWorld::GenerateWorldIdForType(WorldType world_type) {
|
| // identifier for the world is given from out of DOMWrapperWorld.
|
| NOTREACHED();
|
| return kInvalidWorldId;
|
| + case WorldType::kInspectorIsolated:
|
| + return GetNextInspectorIsolatedWorldId();
|
| case WorldType::kGarbageCollector:
|
| case WorldType::kRegExp:
|
| case WorldType::kTesting:
|
| @@ -283,6 +289,16 @@ int DOMWrapperWorld::GenerateWorldIdForType(WorldType world_type) {
|
| return kInvalidWorldId;
|
| }
|
|
|
| +// static
|
| +int DOMWrapperWorld::GetNextInspectorIsolatedWorldId() {
|
| + DCHECK(IsMainThread());
|
| + static int next_devtools_isolated_world_id =
|
| + WorldId::kDevToolsFirstIsolatedWorldId;
|
| + if (next_devtools_isolated_world_id > WorldId::kDevToolsLastIsolatedWorldId)
|
| + return WorldId::kInvalidWorldId;
|
| + return next_devtools_isolated_world_id++;
|
| +}
|
| +
|
| void DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds(
|
| ScriptWrappable* script_wrappable) {
|
| DCHECK(script_wrappable);
|
|
|