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

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

Issue 295163005: Remove ScriptState::current() from IDBRequest (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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: Source/bindings/v8/ScriptState.cpp
diff --git a/Source/bindings/v8/ScriptState.cpp b/Source/bindings/v8/ScriptState.cpp
index d9825005b0fd3280b4cf1e55044f7919020ae68c..dc423ef53937ad8d79a659ae71936af5cf1d5667 100644
--- a/Source/bindings/v8/ScriptState.cpp
+++ b/Source/bindings/v8/ScriptState.cpp
@@ -6,6 +6,7 @@
#include "bindings/v8/ScriptState.h"
#include "bindings/v8/V8Binding.h"
+#include "core/dom/ExecutionContext.h"
#include "core/frame/LocalFrame.h"
namespace WebCore {
@@ -74,4 +75,28 @@ ScriptState* ScriptState::forMainWorld(LocalFrame* frame)
return ScriptState::from(toV8Context(isolate, frame, DOMWrapperWorld::mainWorld()));
}
+PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world)
+{
+ RefPtr<ScriptStateForTesting> scriptState = adoptRef(new ScriptStateForTesting(context, world));
+ // This ref() is for keeping this ScriptState alive as long as the v8::Context is alive.
+ // This is deref()ed in the weak callback of the v8::Context.
+ scriptState->ref();
+ return scriptState;
+}
+
+ScriptStateForTesting::ScriptStateForTesting(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world)
+ : ScriptState(context, world)
+{
+}
+
+ExecutionContext* ScriptStateForTesting::executionContext() const
+{
+ return m_executionContext.get();
+}
+
+void ScriptStateForTesting::setExecutionContext(PassRefPtr<ExecutionContext> executionContext)
+{
+ m_executionContext = executionContext;
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698