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

Unified Diff: third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp

Issue 2848653003: Add a DevTools command to create an isolated world for a given frame (Closed)
Patch Set: Rebased Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..63623c5a74680009a970cd8465f9d82d494d0aa8 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,15 @@ int DOMWrapperWorld::GenerateWorldIdForType(WorldType world_type) {
// identifier for the world is given from out of DOMWrapperWorld.
NOTREACHED();
return kInvalidWorldId;
+ case WorldType::kInspectorIsolated: {
+ 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++;
+ }
case WorldType::kGarbageCollector:
case WorldType::kRegExp:
case WorldType::kTesting:
« no previous file with comments | « third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698