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

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

Issue 2794023002: Move ScriptState::forWorld/ScriptState::forMainWorld (Part 1) (Closed)
Patch Set: Code review changes 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
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 "bindings/core/v8/ScriptState.h" 5 #include "bindings/core/v8/ScriptState.h"
6 6
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/frame/LocalDOMWindow.h" 9 #include "core/frame/LocalDOMWindow.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void ScriptState::setExecutionContext(ExecutionContext*) { 75 void ScriptState::setExecutionContext(ExecutionContext*) {
76 ASSERT_NOT_REACHED(); 76 ASSERT_NOT_REACHED();
77 } 77 }
78 78
79 LocalDOMWindow* ScriptState::domWindow() const { 79 LocalDOMWindow* ScriptState::domWindow() const {
80 v8::HandleScope scope(m_isolate); 80 v8::HandleScope scope(m_isolate);
81 return toLocalDOMWindow(context()); 81 return toLocalDOMWindow(context());
82 } 82 }
83 83
84 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) { 84 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) {
85 return ScriptState::forWorld(frame, DOMWrapperWorld::mainWorld()); 85 return toScriptStateForMainWorld(frame);
86 } 86 }
87 87
88 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) { 88 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) {
89 ASSERT(frame); 89 return toScriptState(frame, world);
90 v8::HandleScope handleScope(toIsolate(frame));
91 v8::Local<v8::Context> context = toV8Context(frame, world);
92 if (context.IsEmpty())
93 return nullptr;
94 ScriptState* scriptState = ScriptState::from(context);
95 ASSERT(scriptState->contextIsValid());
96 return scriptState;
97 } 90 }
98 91
99 } // namespace blink 92 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptState.h ('k') | third_party/WebKit/Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698