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

Side by Side Diff: Source/bindings/core/v8/ScriptState.cpp

Issue 1013413002: [bindings] Refactor ScriptStateForTesting, V8TestingScope into V8BindingForTesting.h/cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Combined all testing files into one! Created 5 years, 9 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
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 #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/LocalDOMWindow.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return toLocalDOMWindow(toDOMWindow(context())); 109 return toLocalDOMWindow(toDOMWindow(context()));
110 } 110 }
111 111
112 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) 112 ScriptState* ScriptState::forMainWorld(LocalFrame* frame)
113 { 113 {
114 v8::Isolate* isolate = toIsolate(frame); 114 v8::Isolate* isolate = toIsolate(frame);
115 v8::HandleScope handleScope(isolate); 115 v8::HandleScope handleScope(isolate);
116 return ScriptState::from(toV8Context(frame, DOMWrapperWorld::mainWorld())); 116 return ScriptState::from(toV8Context(frame, DOMWrapperWorld::mainWorld()));
117 } 117 }
118 118
119 PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create(v8::Handle<v8::C ontext> context, PassRefPtr<DOMWrapperWorld> world)
120 {
121 RefPtr<ScriptStateForTesting> scriptState = adoptRef(new ScriptStateForTesti ng(context, world));
122 // This ref() is for keeping this ScriptState alive as long as the v8::Conte xt is alive.
123 // This is deref()ed in the weak callback of the v8::Context.
124 scriptState->ref();
125 return scriptState;
126 } 119 }
127
128 ScriptStateForTesting::ScriptStateForTesting(v8::Handle<v8::Context> context, Pa ssRefPtr<DOMWrapperWorld> world)
129 : ScriptState(context, world)
130 {
131 }
132
133 ExecutionContext* ScriptStateForTesting::executionContext() const
134 {
135 return m_executionContext;
136 }
137
138 void ScriptStateForTesting::setExecutionContext(ExecutionContext* executionConte xt)
139 {
140 m_executionContext = executionContext;
141 }
142
143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698