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..edcc075b19ea6b545bf4fc1e4cff091d270a0809 100644 |
--- a/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp |
+++ b/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp |
@@ -257,6 +257,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>); |
@@ -266,10 +267,7 @@ int DOMWrapperWorld::GenerateWorldIdForType(WorldType world_type) { |
case WorldType::kMain: |
return kMainWorldId; |
case WorldType::kIsolated: |
- // This function should not be called for IsolatedWorld because an |
- // identifier for the world is given from out of DOMWrapperWorld. |
- NOTREACHED(); |
- return kInvalidWorldId; |
+ return GetNextDevToolsIsolatedWorldId(); |
case WorldType::kGarbageCollector: |
case WorldType::kRegExp: |
case WorldType::kTesting: |
@@ -283,6 +281,16 @@ int DOMWrapperWorld::GenerateWorldIdForType(WorldType world_type) { |
return kInvalidWorldId; |
} |
+// static |
+int DOMWrapperWorld::GetNextDevToolsIsolatedWorldId() { |
+ 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); |