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

Unified Diff: sky/engine/bindings/core/v8/DOMWrapperWorld.cpp

Issue 776143003: Remove Isolated Worlds from Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/bindings/core/v8/DOMWrapperWorld.h ('k') | sky/engine/bindings/core/v8/ScriptController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/bindings/core/v8/DOMWrapperWorld.cpp
diff --git a/sky/engine/bindings/core/v8/DOMWrapperWorld.cpp b/sky/engine/bindings/core/v8/DOMWrapperWorld.cpp
index eba26f0a5dbf4a36a806b9e903148a20ba0ed62e..49466729e14b4f0a1c176799acb2807dd3da04cd 100644
--- a/sky/engine/bindings/core/v8/DOMWrapperWorld.cpp
+++ b/sky/engine/bindings/core/v8/DOMWrapperWorld.cpp
@@ -47,14 +47,13 @@ namespace blink {
unsigned DOMWrapperWorld::isolatedWorldCount = 0;
DOMWrapperWorld* DOMWrapperWorld::worldOfInitializingWindow = 0;
-PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::create(int worldId, int extensionGroup)
+PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::create(FakeWorldMarker marker)
{
- return adoptRef(new DOMWrapperWorld(worldId, extensionGroup));
+ return adoptRef(new DOMWrapperWorld(marker));
}
-DOMWrapperWorld::DOMWrapperWorld(int worldId, int extensionGroup)
- : m_worldId(worldId)
- , m_extensionGroup(extensionGroup)
+DOMWrapperWorld::DOMWrapperWorld(FakeWorldMarker marker)
+ : m_isFakeWorld(marker == FakeWorld)
, m_domDataStore(adoptPtr(new DOMDataStore(isMainWorld())))
{
}
@@ -62,46 +61,15 @@ DOMWrapperWorld::DOMWrapperWorld(int worldId, int extensionGroup)
DOMWrapperWorld& DOMWrapperWorld::mainWorld()
{
ASSERT(isMainThread());
- DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create(MainWorldId, mainWorldExtensionGroup)));
+ DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create(MainWorld)));
return *cachedMainWorld;
}
-typedef HashMap<int, DOMWrapperWorld*> WorldMap;
-static WorldMap& isolatedWorldMap()
-{
- ASSERT(isMainThread());
- DEFINE_STATIC_LOCAL(WorldMap, map, ());
- return map;
-}
-
-void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& worlds)
-{
- ASSERT(isMainThread());
- worlds.append(&mainWorld());
- WorldMap& isolatedWorlds = isolatedWorldMap();
- for (WorldMap::iterator it = isolatedWorlds.begin(); it != isolatedWorlds.end(); ++it)
- worlds.append(it->value);
-}
-
DOMWrapperWorld::~DOMWrapperWorld()
{
ASSERT(!isMainWorld());
dispose();
-
- if (!isIsolatedWorld())
- return;
-
- WorldMap& map = isolatedWorldMap();
- WorldMap::iterator it = map.find(m_worldId);
- if (it == map.end()) {
- ASSERT_NOT_REACHED();
- return;
- }
- ASSERT(it->value == this);
-
- map.remove(it);
- isolatedWorldCount--;
}
void DOMWrapperWorld::dispose()
@@ -110,52 +78,6 @@ void DOMWrapperWorld::dispose()
m_domDataStore.clear();
}
-#if ENABLE(ASSERT)
-static bool isIsolatedWorldId(int worldId)
-{
- return MainWorldId < worldId && worldId < IsolatedWorldIdLimit;
-}
-#endif
-
-PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::ensureIsolatedWorld(int worldId, int extensionGroup)
-{
- ASSERT(isIsolatedWorldId(worldId));
-
- WorldMap& map = isolatedWorldMap();
- WorldMap::AddResult result = map.add(worldId, 0);
- RefPtr<DOMWrapperWorld> world = result.storedValue->value;
- if (world) {
- ASSERT(world->worldId() == worldId);
- ASSERT(world->extensionGroup() == extensionGroup);
- return world.release();
- }
-
- world = DOMWrapperWorld::create(worldId, extensionGroup);
- result.storedValue->value = world.get();
- isolatedWorldCount++;
- return world.release();
-}
-
-typedef HashMap<int, String > IsolatedWorldHumanReadableNameMap;
-static IsolatedWorldHumanReadableNameMap& isolatedWorldHumanReadableNames()
-{
- ASSERT(isMainThread());
- DEFINE_STATIC_LOCAL(IsolatedWorldHumanReadableNameMap, map, ());
- return map;
-}
-
-String DOMWrapperWorld::isolatedWorldHumanReadableName()
-{
- ASSERT(this->isIsolatedWorld());
- return isolatedWorldHumanReadableNames().get(worldId());
-}
-
-void DOMWrapperWorld::setIsolatedWorldHumanReadableName(int worldId, const String& humanReadableName)
-{
- ASSERT(isIsolatedWorldId(worldId));
- isolatedWorldHumanReadableNames().set(worldId, humanReadableName);
-}
-
void DOMWrapperWorld::registerDOMObjectHolderInternal(PassOwnPtr<DOMObjectHolderBase> holderBase)
{
ASSERT(!m_domObjectHolders.contains(holderBase.get()));
« no previous file with comments | « sky/engine/bindings/core/v8/DOMWrapperWorld.h ('k') | sky/engine/bindings/core/v8/ScriptController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698