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

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

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
« no previous file with comments | « Source/bindings/v8/ScriptPromiseTest.cpp ('k') | Source/bindings/v8/ScriptState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ScriptState.h
diff --git a/Source/bindings/v8/ScriptState.h b/Source/bindings/v8/ScriptState.h
index 94bb4cf6fa1bddd164c3f41c433da1426246c0a9..1387b299dff03a6b3971902e863b0546dabd6f67 100644
--- a/Source/bindings/v8/ScriptState.h
+++ b/Source/bindings/v8/ScriptState.h
@@ -46,7 +46,7 @@ public:
};
static PassRefPtr<ScriptState> create(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>);
- ~ScriptState();
+ virtual ~ScriptState();
static ScriptState* current(v8::Isolate* isolate)
{
@@ -68,8 +68,9 @@ public:
v8::Isolate* isolate() const { return m_isolate; }
DOMWrapperWorld& world() const { return *m_world; }
- ExecutionContext* executionContext() const;
DOMWindow* domWindow() const;
+ virtual ExecutionContext* executionContext() const;
+ virtual void setExecutionContext(PassRefPtr<ExecutionContext>);
// This can return an empty handle if the v8::Context is gone.
v8::Handle<v8::Context> context() const { return m_context.newLocal(m_isolate); }
@@ -83,9 +84,10 @@ public:
void setEvalEnabled(bool);
ScriptValue getFromGlobalObject(const char* name);
-private:
+protected:
ScriptState(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>);
+private:
v8::Isolate* m_isolate;
// This persistent handle is weak.
ScopedPersistent<v8::Context> m_context;
@@ -100,6 +102,19 @@ private:
OwnPtr<V8PerContextData> m_perContextData;
};
+class ScriptStateForTesting : public ScriptState {
+public:
+ static PassRefPtr<ScriptStateForTesting> create(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>);
+
+ virtual ExecutionContext* executionContext() const OVERRIDE;
+ virtual void setExecutionContext(PassRefPtr<ExecutionContext>) OVERRIDE;
+
+private:
+ ScriptStateForTesting(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>);
+
+ RefPtr<ExecutionContext> m_executionContext;
+};
+
// ScriptStateProtectingContext keeps the context associated with the ScriptState alive.
// You need to call clear() once you no longer need the context. Otherwise, the context will leak.
class ScriptStateProtectingContext {
« no previous file with comments | « Source/bindings/v8/ScriptPromiseTest.cpp ('k') | Source/bindings/v8/ScriptState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698