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

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
Index: Source/bindings/v8/ScriptState.h
diff --git a/Source/bindings/v8/ScriptState.h b/Source/bindings/v8/ScriptState.h
index a5ce0504043138f8cf40a9698838fb1d5e03814b..d0e887cfb7dd9ce190a2c7f2a02f4b51bc55e067 100644
--- a/Source/bindings/v8/ScriptState.h
+++ b/Source/bindings/v8/ScriptState.h
@@ -45,7 +45,7 @@ public:
};
static PassRefPtr<ScriptState> create(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>);
- ~ScriptState();
+ virtual ~ScriptState();
static ScriptState* current(v8::Isolate* isolate)
{
@@ -67,8 +67,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>) { }
jsbell 2014/05/27 18:38:47 ASSERT_NOT_REACHED() ?
haraken 2014/05/28 00:35:49 Done.
// This can return an empty handle if the v8::Context is gone.
v8::Handle<v8::Context> context() const { return m_context.newLocal(m_isolate); }
@@ -81,9 +82,10 @@ public:
bool evalEnabled() const;
void setEvalEnabled(bool);
-private:
+protected:
ScriptState(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>);
+private:
v8::Isolate* m_isolate;
// This persistent handle is weak.
ScopedPersistent<v8::Context> m_context;
@@ -98,6 +100,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 {

Powered by Google App Engine
This is Rietveld 408576698