Index: Source/bindings/v8/DOMWrapperWorld.cpp |
diff --git a/Source/bindings/v8/DOMWrapperWorld.cpp b/Source/bindings/v8/DOMWrapperWorld.cpp |
index 27dab1a7f3e8c3002d01092653cb87e5404132ad..b469b2f149a2ca40c27b6e16f353a539f076d47b 100644 |
--- a/Source/bindings/v8/DOMWrapperWorld.cpp |
+++ b/Source/bindings/v8/DOMWrapperWorld.cpp |
@@ -46,11 +46,6 @@ namespace WebCore { |
int DOMWrapperWorld::isolatedWorldCount = 0; |
static bool initializingWindow = false; |
-PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::createUninitializedWorld() |
-{ |
- return adoptRef(new DOMWrapperWorld(uninitializedWorldId, uninitializedExtensionGroup)); |
-} |
- |
void DOMWrapperWorld::setInitializingWindow(bool initializing) |
{ |
initializingWindow = initializing; |
@@ -76,6 +71,13 @@ DOMWrapperWorld* mainThreadNormalWorld() |
return cachedNormalWorld.get(); |
} |
+// FIXME: Remove this function. There is currently an issue with the inspector related to the call to dispatchDidClearWindowObjectInWorld in ScriptController::windowShell. |
+DOMWrapperWorld* existingWindowShellWorkaroundWorld() |
+{ |
+ DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, world, (adoptRef(new DOMWrapperWorld(DOMWrapperWorld::mainWorldId - 1, DOMWrapperWorld::mainWorldExtensionGroup - 1)))); |
+ return world.get(); |
+} |
+ |
bool DOMWrapperWorld::contextHasCorrectPrototype(v8::Handle<v8::Context> context) |
{ |
ASSERT(isMainThread()); |
@@ -144,27 +146,21 @@ DOMWrapperWorld::~DOMWrapperWorld() |
ASSERT(map.size() == isolatedWorldCount); |
} |
-static int temporaryWorldId = DOMWrapperWorld::uninitializedWorldId-1; |
- |
PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::ensureIsolatedWorld(int worldId, int extensionGroup) |
{ |
- ASSERT(worldId != mainWorldId); |
- ASSERT(worldId >= uninitializedWorldId); |
+ ASSERT(worldId > mainWorldId); |
WorldMap& map = isolatedWorldMap(); |
- if (worldId == uninitializedWorldId) |
- worldId = temporaryWorldId--; |
- else { |
- WorldMap::iterator i = map.find(worldId); |
- if (i != map.end()) { |
- ASSERT(i->value->worldId() == worldId); |
- ASSERT(i->value->extensionGroup() == extensionGroup); |
- return i->value; |
- } |
+ WorldMap::AddResult result = map.add(worldId, 0); |
haraken
2013/04/12 02:14:19
Shouldn't this be map.find()? And then you need to
adamk
2013/04/12 15:44:04
Odd though this code looks, this is the idiomatic
|
+ RefPtr<DOMWrapperWorld> world = result.iterator->value; |
+ if (world) { |
+ ASSERT(world->worldId() == worldId); |
+ ASSERT(world->extensionGroup() == extensionGroup); |
+ return world.release(); |
} |
- RefPtr<DOMWrapperWorld> world = adoptRef(new DOMWrapperWorld(worldId, extensionGroup)); |
- map.add(worldId, world.get()); |
+ world = adoptRef(new DOMWrapperWorld(worldId, extensionGroup)); |
+ result.iterator->value = world.get(); |
isolatedWorldCount++; |
ASSERT(map.size() == isolatedWorldCount); |