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

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: Changes for Sami 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.cpp
diff --git a/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp b/third_party/WebKit/Source/platform/bindings/DOMWrapperWorld.cpp
index 106f9d359a1550d98dddc8b8e51e0a908a22a18f..38ec443a8b96ecdaf21445cd1a133079d32e0aa1 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>);
@@ -283,6 +284,21 @@ int DOMWrapperWorld::GenerateWorldIdForType(WorldType world_type) {
return kInvalidWorldId;
}
+// static
+int DOMWrapperWorld::GetNextDevToolsIsolatedWorldId() {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<int>,
pfeldman 2017/05/05 15:40:24 DCHECK(isMainThread()) + simpler static local inst
alex clarke (OOO till 29th) 2017/05/05 19:29:44 Done.
+ next_devtools_isolated_world_id,
+ new ThreadSpecific<int>);
+
+ if (!next_devtools_isolated_world_id.IsSet())
+ *next_devtools_isolated_world_id = WorldId::kDevToolsFirstIsolatedWorldId;
+ int world_id = *next_devtools_isolated_world_id;
+ if (world_id > WorldId::kDevToolsLastIsolatedWorldId)
+ return WorldId::kInvalidWorldId;
+ *next_devtools_isolated_world_id = world_id + 1;
+ return world_id;
+}
+
void DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds(
ScriptWrappable* script_wrappable) {
DCHECK(script_wrappable);

Powered by Google App Engine
This is Rietveld 408576698