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

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

Issue 2848653003: Add a DevTools command to create an isolated world for a given frame (Closed)
Patch Set: Fix compile ;) 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
Index: third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.h
diff --git a/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.h b/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.h
index a8cff87dc798b3ec1f43831f7f32448ffc6a5d39..368b72e88b7c48604cb5898cbc9e818cb415da09 100644
--- a/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.h
+++ b/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.h
@@ -59,6 +59,8 @@ class PLATFORM_EXPORT DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
// Embedder isolated worlds can use IDs in [1, 1<<29).
kEmbedderWorldIdLimit = (1 << 29),
kDocumentXMLTreeViewerWorldId,
+ kDevToolsFirstIsolatedWorldId,
+ kDevToolsLastIsolatedWorldId = kDevToolsFirstIsolatedWorldId + 100,
kIsolatedWorldIdLimit,
// Other worlds can use IDs after this. Don't manually pick up an ID from
@@ -69,13 +71,15 @@ class PLATFORM_EXPORT DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
enum class WorldType {
kMain,
kIsolated,
+ kInspectorIsolated,
kGarbageCollector,
kRegExp,
kTesting,
kWorker,
};
- // Creates a world other than IsolatedWorld.
+ // Creates a world other than IsolatedWorld. Note this can return nullptr if
+ // GenerateWorldIdForType fails to allocate a valid id.
static PassRefPtr<DOMWrapperWorld> Create(v8::Isolate*, WorldType);
// Ensures an IsolatedWorld for |worldId|.
@@ -128,7 +132,10 @@ class PLATFORM_EXPORT DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
bool IsMainWorld() const { return world_type_ == WorldType::kMain; }
bool IsWorkerWorld() const { return world_type_ == WorldType::kWorker; }
- bool IsIsolatedWorld() const { return world_type_ == WorldType::kIsolated; }
+ bool IsIsolatedWorld() const {
+ return world_type_ == WorldType::kIsolated ||
+ world_type_ == WorldType::kInspectorIsolated;
+ }
int GetWorldId() const { return world_id_; }
DOMDataStore& DomDataStore() const { return *dom_data_store_; }
@@ -192,6 +199,11 @@ class PLATFORM_EXPORT DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
// out of DOMWrapperWorld.
static int GenerateWorldIdForType(WorldType);
+ // Returns an id in the range
+ // [kDevToolsFirstIsolatedWorldId, kDevToolsLastIsolatedWorldId] or
+ // kInvalidWorldId if that range has been exhausted.
+ static int GetNextInspectorIsolatedWorldId();
pfeldman 2017/05/09 18:57:36 do you still need it?
alex clarke (OOO till 29th) 2017/05/09 19:40:36 It's gone.
+
// Dissociates all wrappers in all worlds associated with |script_wrappable|.
//
// Do not use this function except for DOMWindow. Only DOMWindow needs to

Powered by Google App Engine
This is Rietveld 408576698