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

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

Issue 2723973002: Make V8Binding helpers return LocalFrame/LocalDOMWindow as appropriate (Closed)
Patch Set: Created 3 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 "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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 v8::HandleScope scope(m_isolate); 71 v8::HandleScope scope(m_isolate);
72 return toExecutionContext(context()); 72 return toExecutionContext(context());
73 } 73 }
74 74
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(toDOMWindow(context())); 81 return toDOMWindow(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 ScriptState::forWorld(frame, DOMWrapperWorld::mainWorld());
86 } 86 }
87 87
88 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) { 88 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) {
89 ASSERT(frame); 89 ASSERT(frame);
90 v8::HandleScope handleScope(toIsolate(frame)); 90 v8::HandleScope handleScope(toIsolate(frame));
91 v8::Local<v8::Context> context = toV8Context(frame, world); 91 v8::Local<v8::Context> context = toV8Context(frame, world);
92 if (context.IsEmpty()) 92 if (context.IsEmpty())
93 return nullptr; 93 return nullptr;
94 ScriptState* scriptState = ScriptState::from(context); 94 ScriptState* scriptState = ScriptState::from(context);
95 ASSERT(scriptState->contextIsValid()); 95 ASSERT(scriptState->contextIsValid());
96 return scriptState; 96 return scriptState;
97 } 97 }
98 98
99 } // namespace blink 99 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698