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

Side by Side Diff: Source/bindings/v8/ScriptState.cpp

Issue 295163005: Remove ScriptState::current() from IDBRequest (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/ScriptState.h ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "bindings/v8/ScriptState.h" 6 #include "bindings/v8/ScriptState.h"
7 7
8 #include "bindings/v8/V8Binding.h" 8 #include "bindings/v8/V8Binding.h"
9 #include "core/dom/ExecutionContext.h"
9 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
10 11
11 namespace WebCore { 12 namespace WebCore {
12 13
13 PassRefPtr<ScriptState> ScriptState::create(v8::Handle<v8::Context> context, Pas sRefPtr<DOMWrapperWorld> world) 14 PassRefPtr<ScriptState> ScriptState::create(v8::Handle<v8::Context> context, Pas sRefPtr<DOMWrapperWorld> world)
14 { 15 {
15 RefPtr<ScriptState> scriptState = adoptRef(new ScriptState(context, world)); 16 RefPtr<ScriptState> scriptState = adoptRef(new ScriptState(context, world));
16 // This ref() is for keeping this ScriptState alive as long as the v8::Conte xt is alive. 17 // This ref() is for keeping this ScriptState alive as long as the v8::Conte xt is alive.
17 // This is deref()ed in the weak callback of the v8::Context. 18 // This is deref()ed in the weak callback of the v8::Context.
18 scriptState->ref(); 19 scriptState->ref();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 v8::Local<v8::Value> v8Value = context()->Global()->Get(v8AtomicString(isola te(), name)); 62 v8::Local<v8::Value> v8Value = context()->Global()->Get(v8AtomicString(isola te(), name));
62 return ScriptValue(this, v8Value); 63 return ScriptValue(this, v8Value);
63 } 64 }
64 65
65 ExecutionContext* ScriptState::executionContext() const 66 ExecutionContext* ScriptState::executionContext() const
66 { 67 {
67 v8::HandleScope scope(m_isolate); 68 v8::HandleScope scope(m_isolate);
68 return toExecutionContext(context()); 69 return toExecutionContext(context());
69 } 70 }
70 71
72 void ScriptState::setExecutionContext(PassRefPtr<ExecutionContext>)
73 {
74 ASSERT_NOT_REACHED();
75 }
76
71 DOMWindow* ScriptState::domWindow() const 77 DOMWindow* ScriptState::domWindow() const
72 { 78 {
73 v8::HandleScope scope(m_isolate); 79 v8::HandleScope scope(m_isolate);
74 return toDOMWindow(context()); 80 return toDOMWindow(context());
75 } 81 }
76 82
77 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) 83 ScriptState* ScriptState::forMainWorld(LocalFrame* frame)
78 { 84 {
79 v8::Isolate* isolate = toIsolate(frame); 85 v8::Isolate* isolate = toIsolate(frame);
80 v8::HandleScope handleScope(isolate); 86 v8::HandleScope handleScope(isolate);
81 return ScriptState::from(toV8Context(isolate, frame, DOMWrapperWorld::mainWo rld())); 87 return ScriptState::from(toV8Context(isolate, frame, DOMWrapperWorld::mainWo rld()));
82 } 88 }
83 89
90 PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create(v8::Handle<v8::C ontext> context, PassRefPtr<DOMWrapperWorld> world)
91 {
92 RefPtr<ScriptStateForTesting> scriptState = adoptRef(new ScriptStateForTesti ng(context, world));
93 // This ref() is for keeping this ScriptState alive as long as the v8::Conte xt is alive.
94 // This is deref()ed in the weak callback of the v8::Context.
95 scriptState->ref();
96 return scriptState;
84 } 97 }
98
99 ScriptStateForTesting::ScriptStateForTesting(v8::Handle<v8::Context> context, Pa ssRefPtr<DOMWrapperWorld> world)
100 : ScriptState(context, world)
101 {
102 }
103
104 ExecutionContext* ScriptStateForTesting::executionContext() const
105 {
106 return m_executionContext.get();
107 }
108
109 void ScriptStateForTesting::setExecutionContext(PassRefPtr<ExecutionContext> exe cutionContext)
110 {
111 m_executionContext = executionContext;
112 }
113
114 }
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptState.h ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698