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

Unified Diff: Source/bindings/v8/DOMWrapperWorld.cpp

Issue 14297007: Make DOMWrapperWorlds easier to use (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
« no previous file with comments | « Source/bindings/v8/DOMWrapperWorld.h ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/DOMWrapperWorld.cpp
diff --git a/Source/bindings/v8/DOMWrapperWorld.cpp b/Source/bindings/v8/DOMWrapperWorld.cpp
index b469b2f149a2ca40c27b6e16f353a539f076d47b..a5e8cec381d44aafa73bf1ce567022e9a4723e0d 100644
--- a/Source/bindings/v8/DOMWrapperWorld.cpp
+++ b/Source/bindings/v8/DOMWrapperWorld.cpp
@@ -32,6 +32,7 @@
#include "DOMWrapperWorld.h"
#include "DOMDataStore.h"
+#include "ScriptExecutionContext.h"
#include "V8Binding.h"
#include "V8DOMActivityLogger.h"
#include "V8DOMWindow.h"
@@ -64,6 +65,16 @@ DOMWrapperWorld::DOMWrapperWorld(int worldId, int extensionGroup)
m_domDataStore = adoptPtr(new DOMDataStore(IsolatedWorld));
}
+DOMWrapperWorld* DOMWrapperWorld::current(ScriptExecutionContext* scriptExecutionContext)
+{
+ if (scriptExecutionContext->isWorkerContext())
+ return 0;
+ ASSERT(isMainThread());
+ ASSERT(v8::Context::InContext());
+ DOMWrapperWorld* world = isolatedWorld(v8::Context::GetCurrent());
+ return world ? world : mainThreadNormalWorld();
+}
+
DOMWrapperWorld* mainThreadNormalWorld()
{
ASSERT(isMainThread());
« no previous file with comments | « Source/bindings/v8/DOMWrapperWorld.h ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698