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

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: Remove pointless check Created 3 years, 8 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..8be753948a9b43c242c2a82af4f63637bd113eb5 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>,
+ next_devtools_isolatd_world_id,
Sami 2017/05/05 09:33:14 typo: isolated
alex clarke (OOO till 29th) 2017/05/05 14:52:29 Done.
+ new ThreadSpecific<int>);
+
+ if (!next_devtools_isolatd_world_id.IsSet())
+ *next_devtools_isolatd_world_id = WorldId::kDevToolsFirstIsolatedWorldId;
+ int world_id = *next_devtools_isolatd_world_id;
+ if (world_id > WorldId::kDevToolsLastIsolatedWorldId)
+ return WorldId::kInvalidWorldId;
+ *next_devtools_isolatd_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