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

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

Issue 2793003003: Move ScriptState::forWorld/ScriptState::forMainWorld (Part 3) (Closed)
Patch Set: Rebase 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"
11 10
12 namespace blink { 11 namespace blink {
13 12
14 PassRefPtr<ScriptState> ScriptState::create(v8::Local<v8::Context> context, 13 PassRefPtr<ScriptState> ScriptState::create(v8::Local<v8::Context> context,
15 PassRefPtr<DOMWrapperWorld> world) { 14 PassRefPtr<DOMWrapperWorld> world) {
16 RefPtr<ScriptState> scriptState = 15 RefPtr<ScriptState> scriptState =
17 adoptRef(new ScriptState(context, std::move(world))); 16 adoptRef(new ScriptState(context, std::move(world)));
18 // This ref() is for keeping this ScriptState alive as long as the v8::Context 17 // This ref() is for keeping this ScriptState alive as long as the v8::Context
19 // is alive. This is deref()ed in the weak callback of the v8::Context. 18 // is alive. This is deref()ed in the weak callback of the v8::Context.
20 scriptState->ref(); 19 scriptState->ref();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 73
75 void ScriptState::setExecutionContext(ExecutionContext*) { 74 void ScriptState::setExecutionContext(ExecutionContext*) {
76 ASSERT_NOT_REACHED(); 75 ASSERT_NOT_REACHED();
77 } 76 }
78 77
79 LocalDOMWindow* ScriptState::domWindow() const { 78 LocalDOMWindow* ScriptState::domWindow() const {
80 v8::HandleScope scope(m_isolate); 79 v8::HandleScope scope(m_isolate);
81 return toLocalDOMWindow(context()); 80 return toLocalDOMWindow(context());
82 } 81 }
83 82
84 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) {
85 return toScriptStateForMainWorld(frame);
86 }
87
88 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) {
89 return toScriptState(frame, world);
90 }
91
92 } // namespace blink 83 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptState.h ('k') | third_party/WebKit/Source/core/loader/FrameLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698