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

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

Issue 2790313004: Move ScriptState::domWindow() (Closed)
Patch Set: Rebase again 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"
10 9
11 namespace blink { 10 namespace blink {
12 11
13 PassRefPtr<ScriptState> ScriptState::create(v8::Local<v8::Context> context, 12 PassRefPtr<ScriptState> ScriptState::create(v8::Local<v8::Context> context,
14 PassRefPtr<DOMWrapperWorld> world) { 13 PassRefPtr<DOMWrapperWorld> world) {
15 RefPtr<ScriptState> scriptState = 14 RefPtr<ScriptState> scriptState =
16 adoptRef(new ScriptState(context, std::move(world))); 15 adoptRef(new ScriptState(context, std::move(world)));
17 // This ref() is for keeping this ScriptState alive as long as the v8::Context 16 // This ref() is for keeping this ScriptState alive as long as the v8::Context
18 // is alive. This is deref()ed in the weak callback of the v8::Context. 17 // is alive. This is deref()ed in the weak callback of the v8::Context.
19 scriptState->ref(); 18 scriptState->ref();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 67
69 ExecutionContext* ScriptState::getExecutionContext() const { 68 ExecutionContext* ScriptState::getExecutionContext() const {
70 v8::HandleScope scope(m_isolate); 69 v8::HandleScope scope(m_isolate);
71 return toExecutionContext(context()); 70 return toExecutionContext(context());
72 } 71 }
73 72
74 void ScriptState::setExecutionContext(ExecutionContext*) { 73 void ScriptState::setExecutionContext(ExecutionContext*) {
75 ASSERT_NOT_REACHED(); 74 ASSERT_NOT_REACHED();
76 } 75 }
77 76
78 LocalDOMWindow* ScriptState::domWindow() const {
79 v8::HandleScope scope(m_isolate);
80 return toLocalDOMWindow(context());
81 }
82
83 } // namespace blink 77 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698