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

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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 v8::HandleScope scope(m_isolate); 72 v8::HandleScope scope(m_isolate);
73 return toExecutionContext(context()); 73 return toExecutionContext(context());
74 } 74 }
75 75
76 void ScriptState::setExecutionContext(ExecutionContext*) { 76 void ScriptState::setExecutionContext(ExecutionContext*) {
77 ASSERT_NOT_REACHED(); 77 ASSERT_NOT_REACHED();
78 } 78 }
79 79
80 LocalDOMWindow* ScriptState::domWindow() const { 80 LocalDOMWindow* ScriptState::domWindow() const {
81 v8::HandleScope scope(m_isolate); 81 v8::HandleScope scope(m_isolate);
82 return toLocalDOMWindow(toDOMWindow(context())); 82 return toLocalDOMWindow(context());
83 } 83 }
84 84
85 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) { 85 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) {
86 return ScriptState::forWorld(frame, DOMWrapperWorld::mainWorld()); 86 return ScriptState::forWorld(frame, DOMWrapperWorld::mainWorld());
87 } 87 }
88 88
89 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) { 89 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) {
90 ASSERT(frame); 90 ASSERT(frame);
91 v8::HandleScope handleScope(toIsolate(frame)); 91 v8::HandleScope handleScope(toIsolate(frame));
92 v8::Local<v8::Context> context = toV8Context(frame, world); 92 v8::Local<v8::Context> context = toV8Context(frame, world);
93 if (context.IsEmpty()) 93 if (context.IsEmpty())
94 return nullptr; 94 return nullptr;
95 ScriptState* scriptState = ScriptState::from(context); 95 ScriptState* scriptState = ScriptState::from(context);
96 ASSERT(scriptState->contextIsValid()); 96 ASSERT(scriptState->contextIsValid());
97 return scriptState; 97 return scriptState;
98 } 98 }
99 99
100 } // namespace blink 100 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698