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

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

Issue 2386173002: reflow comments in Source/bindings/core/v8 (Closed)
Patch Set: Created 4 years, 2 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"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 PassRefPtr<ScriptState> ScriptState::create(v8::Local<v8::Context> context, 14 PassRefPtr<ScriptState> ScriptState::create(v8::Local<v8::Context> context,
15 PassRefPtr<DOMWrapperWorld> world) { 15 PassRefPtr<DOMWrapperWorld> world) {
16 RefPtr<ScriptState> scriptState = 16 RefPtr<ScriptState> scriptState =
17 adoptRef(new ScriptState(context, std::move(world))); 17 adoptRef(new ScriptState(context, std::move(world)));
18 // This ref() is for keeping this ScriptState alive as long as the v8::Context is alive. 18 // This ref() is for keeping this ScriptState alive as long as the v8::Context
19 // This is deref()ed in the weak callback of the v8::Context. 19 // is alive. This is deref()ed in the weak callback of the v8::Context.
20 scriptState->ref(); 20 scriptState->ref();
21 return scriptState; 21 return scriptState;
22 } 22 }
23 23
24 static void derefCallback(const v8::WeakCallbackInfo<ScriptState>& data) { 24 static void derefCallback(const v8::WeakCallbackInfo<ScriptState>& data) {
25 data.GetParameter()->deref(); 25 data.GetParameter()->deref();
26 } 26 }
27 27
28 static void weakCallback(const v8::WeakCallbackInfo<ScriptState>& data) { 28 static void weakCallback(const v8::WeakCallbackInfo<ScriptState>& data) {
29 data.GetParameter()->clearContext(); 29 data.GetParameter()->clearContext();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 v8::HandleScope handleScope(toIsolate(frame)); 97 v8::HandleScope handleScope(toIsolate(frame));
98 v8::Local<v8::Context> context = toV8Context(frame, world); 98 v8::Local<v8::Context> context = toV8Context(frame, world);
99 if (context.IsEmpty()) 99 if (context.IsEmpty())
100 return nullptr; 100 return nullptr;
101 ScriptState* scriptState = ScriptState::from(context); 101 ScriptState* scriptState = ScriptState::from(context);
102 ASSERT(scriptState->contextIsValid()); 102 ASSERT(scriptState->contextIsValid());
103 return scriptState; 103 return scriptState;
104 } 104 }
105 105
106 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698