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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h

Issue 1561663003: CL for perf tryjob on win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/bindings/core/v8/DOMWrapperWorld.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h
index aeadf0611815e4309a02ae1ff14b3d0e32f98888..f92d0291f6a73447c1fd516b39fbc7955807a187 100644
--- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h
+++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h
@@ -60,6 +60,27 @@ template<typename T> class DOMObjectHolder;
// This class represent a collection of DOM wrappers for a specific world.
class CORE_EXPORT DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
public:
+ class ParentWorldIdPusher {
+ public:
+ explicit ParentWorldIdPusher(DOMWrapperWorld& domWrapperWorld, int newParentWorldId)
+ : m_oldParentWorldId(domWrapperWorld.originWorldId())
+ , m_domWrapperWorld(domWrapperWorld)
+ {
+ // "Push" the parent world id.
+ m_domWrapperWorld.setParentWorldId(newParentWorldId);
+ }
+
+ ~ParentWorldIdPusher()
+ {
+ // "Pop" the parent world id to avoid tainting the entire document.
+ m_domWrapperWorld.setParentWorldId(m_oldParentWorldId);
+ }
+
+ private:
+ int m_oldParentWorldId;
+ DOMWrapperWorld& m_domWrapperWorld;
+ };
+
static PassRefPtr<DOMWrapperWorld> create(v8::Isolate*, int worldId = -1, int extensionGroup = -1);
static const int mainWorldExtensionGroup = 0;
@@ -117,7 +138,19 @@ public:
bool isIsolatedWorld() const { return MainWorldId < m_worldId && m_worldId < IsolatedWorldIdLimit; }
int worldId() const { return m_worldId; }
+ int originWorldId() const { return isIsolatedWorld() ? m_worldId : m_parentWorldId; }
int extensionGroup() const { return m_extensionGroup; }
+ bool isOfIsolatedWorldOrigin() const
+ {
+ int worldId = originWorldId();
+ return MainWorldId < worldId && worldId < IsolatedWorldIdLimit;
+ };
+ void setParentWorldId(int worldId)
+ {
+ m_parentWorldId = worldId;
+ ASSERT(isMainWorld() || isIsolatedWorld());
+ };
+
DOMDataStore& domDataStore() const { return *m_domDataStore; }
static void setWorldOfInitializingWindow(DOMWrapperWorld* world)
@@ -142,6 +175,7 @@ private:
const int m_worldId;
const int m_extensionGroup;
+ int m_parentWorldId;
OwnPtr<DOMDataStore> m_domDataStore;
HashSet<OwnPtr<DOMObjectHolderBase>> m_domObjectHolders;
};
« no previous file with comments | « chrome/installer/util/installer_state.cc ('k') | third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698