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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptState.h

Issue 2790313004: Move ScriptState::domWindow() (Closed)
Patch Set: Rebase again Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ScriptState_h 5 #ifndef ScriptState_h
6 #define ScriptState_h 6 #define ScriptState_h
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "bindings/core/v8/ScopedPersistent.h" 10 #include "bindings/core/v8/ScopedPersistent.h"
11 #include "bindings/core/v8/V8PerContextData.h" 11 #include "bindings/core/v8/V8PerContextData.h"
12 #include "core/CoreExport.h" 12 #include "core/CoreExport.h"
13 #include "v8/include/v8-debug.h" 13 #include "v8/include/v8-debug.h"
14 #include "v8/include/v8.h" 14 #include "v8/include/v8.h"
15 #include "wtf/RefCounted.h" 15 #include "wtf/RefCounted.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class LocalDOMWindow;
20 class DOMWrapperWorld; 19 class DOMWrapperWorld;
21 class ExecutionContext; 20 class ExecutionContext;
22 class ScriptValue; 21 class ScriptValue;
23 22
24 // ScriptState is an abstraction class that holds all information about script 23 // ScriptState is an abstraction class that holds all information about script
25 // exectuion (e.g., v8::Isolate, v8::Context, DOMWrapperWorld, ExecutionContext 24 // exectuion (e.g., v8::Isolate, v8::Context, DOMWrapperWorld, ExecutionContext
26 // etc). If you need any info about the script execution, you're expected to 25 // etc). If you need any info about the script execution, you're expected to
27 // pass around ScriptState in the code base. ScriptState is in a 1:1 26 // pass around ScriptState in the code base. ScriptState is in a 1:1
28 // relationship with v8::Context. 27 // relationship with v8::Context.
29 // 28 //
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 v8ContextPerContextDataIndex)); 129 v8ContextPerContextDataIndex));
131 // ScriptState::from() must not be called for a context that does not have 130 // ScriptState::from() must not be called for a context that does not have
132 // valid embedder data in the embedder field. 131 // valid embedder data in the embedder field.
133 SECURITY_CHECK(scriptState); 132 SECURITY_CHECK(scriptState);
134 SECURITY_CHECK(scriptState->context() == context); 133 SECURITY_CHECK(scriptState->context() == context);
135 return scriptState; 134 return scriptState;
136 } 135 }
137 136
138 v8::Isolate* isolate() const { return m_isolate; } 137 v8::Isolate* isolate() const { return m_isolate; }
139 DOMWrapperWorld& world() const { return *m_world; } 138 DOMWrapperWorld& world() const { return *m_world; }
140 LocalDOMWindow* domWindow() const;
141 virtual ExecutionContext* getExecutionContext() const; 139 virtual ExecutionContext* getExecutionContext() const;
142 virtual void setExecutionContext(ExecutionContext*); 140 virtual void setExecutionContext(ExecutionContext*);
143 141
144 // This can return an empty handle if the v8::Context is gone. 142 // This can return an empty handle if the v8::Context is gone.
145 v8::Local<v8::Context> context() const { 143 v8::Local<v8::Context> context() const {
146 return m_context.newLocal(m_isolate); 144 return m_context.newLocal(m_isolate);
147 } 145 }
148 bool contextIsValid() const { 146 bool contextIsValid() const {
149 return !m_context.isEmpty() && m_perContextData; 147 return !m_context.isEmpty() && m_perContextData;
150 } 148 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 197 }
200 198
201 private: 199 private:
202 RefPtr<ScriptState> m_scriptState; 200 RefPtr<ScriptState> m_scriptState;
203 ScopedPersistent<v8::Context> m_context; 201 ScopedPersistent<v8::Context> m_context;
204 }; 202 };
205 203
206 } // namespace blink 204 } // namespace blink
207 205
208 #endif // ScriptState_h 206 #endif // ScriptState_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698