OLD | NEW |
---|---|
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 #include "config.h" | 5 #include "config.h" |
6 #include "bindings/core/v8/ScriptState.h" | 6 #include "bindings/core/v8/ScriptState.h" |
7 | 7 |
8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
10 #include "core/frame/LocalDOMWindow.h" | |
10 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 PassRefPtr<ScriptState> ScriptState::create(v8::Handle<v8::Context> context, Pas sRefPtr<DOMWrapperWorld> world) | 15 PassRefPtr<ScriptState> ScriptState::create(v8::Handle<v8::Context> context, Pas sRefPtr<DOMWrapperWorld> world) |
15 { | 16 { |
16 RefPtr<ScriptState> scriptState = adoptRef(new ScriptState(context, world)); | 17 RefPtr<ScriptState> scriptState = adoptRef(new ScriptState(context, world)); |
17 // This ref() is for keeping this ScriptState alive as long as the v8::Conte xt is alive. | 18 // This ref() is for keeping this ScriptState alive as long as the v8::Conte xt is alive. |
18 // This is deref()ed in the weak callback of the v8::Context. | 19 // This is deref()ed in the weak callback of the v8::Context. |
19 scriptState->ref(); | 20 scriptState->ref(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 { | 76 { |
76 v8::HandleScope scope(m_isolate); | 77 v8::HandleScope scope(m_isolate); |
77 return toExecutionContext(context()); | 78 return toExecutionContext(context()); |
78 } | 79 } |
79 | 80 |
80 void ScriptState::setExecutionContext(ExecutionContext*) | 81 void ScriptState::setExecutionContext(ExecutionContext*) |
81 { | 82 { |
82 ASSERT_NOT_REACHED(); | 83 ASSERT_NOT_REACHED(); |
83 } | 84 } |
84 | 85 |
85 LocalDOMWindow* ScriptState::domWindow() const | 86 LocalDOMWindow* ScriptState::domWindow() const |
haraken
2014/10/31 06:07:04
Rename this to localDOMWindow() in a follow-up CL.
| |
86 { | 87 { |
87 v8::HandleScope scope(m_isolate); | 88 v8::HandleScope scope(m_isolate); |
88 return toDOMWindow(context()); | 89 return toLocalDOMWindow(toDOMWindow(context())); |
89 } | 90 } |
90 | 91 |
91 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) | 92 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) |
92 { | 93 { |
93 v8::Isolate* isolate = toIsolate(frame); | 94 v8::Isolate* isolate = toIsolate(frame); |
94 v8::HandleScope handleScope(isolate); | 95 v8::HandleScope handleScope(isolate); |
95 return ScriptState::from(toV8Context(frame, DOMWrapperWorld::mainWorld())); | 96 return ScriptState::from(toV8Context(frame, DOMWrapperWorld::mainWorld())); |
96 } | 97 } |
97 | 98 |
98 PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create(v8::Handle<v8::C ontext> context, PassRefPtr<DOMWrapperWorld> world) | 99 PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create(v8::Handle<v8::C ontext> context, PassRefPtr<DOMWrapperWorld> world) |
(...skipping 14 matching lines...) Expand all Loading... | |
113 { | 114 { |
114 return m_executionContext; | 115 return m_executionContext; |
115 } | 116 } |
116 | 117 |
117 void ScriptStateForTesting::setExecutionContext(ExecutionContext* executionConte xt) | 118 void ScriptStateForTesting::setExecutionContext(ExecutionContext* executionConte xt) |
118 { | 119 { |
119 m_executionContext = executionContext; | 120 m_executionContext = executionContext; |
120 } | 121 } |
121 | 122 |
122 } | 123 } |
OLD | NEW |