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

Side by Side Diff: Source/web/SuspendableScriptExecutor.cpp

Issue 843683005: Fix a bit of C++11 in web/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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
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 "web/SuspendableScriptExecutor.h" 6 #include "web/SuspendableScriptExecutor.h"
7 7
8 #include "bindings/core/v8/ScriptController.h" 8 #include "bindings/core/v8/ScriptController.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 13 matching lines...) Expand all
24 void SuspendableScriptExecutor::resume() 24 void SuspendableScriptExecutor::resume()
25 { 25 {
26 executeAndDestroySelf(); 26 executeAndDestroySelf();
27 } 27 }
28 28
29 void SuspendableScriptExecutor::contextDestroyed() 29 void SuspendableScriptExecutor::contextDestroyed()
30 { 30 {
31 // this method can only be called if the script was not called in run() 31 // this method can only be called if the script was not called in run()
32 // and context remained suspend (method resume has never called) 32 // and context remained suspend (method resume has never called)
33 ActiveDOMObject::contextDestroyed(); 33 ActiveDOMObject::contextDestroyed();
34 m_callback->completed(Vector<v8::Local<v8::Value> >()); 34 m_callback->completed(Vector<v8::Local<v8::Value>>());
35 deref(); 35 deref();
36 } 36 }
37 37
38 SuspendableScriptExecutor::SuspendableScriptExecutor(LocalFrame* frame, int worl dID, const Vector<ScriptSourceCode>& sources, int extensionGroup, bool userGestu re, WebScriptExecutionCallback* callback) 38 SuspendableScriptExecutor::SuspendableScriptExecutor(LocalFrame* frame, int worl dID, const Vector<ScriptSourceCode>& sources, int extensionGroup, bool userGestu re, WebScriptExecutionCallback* callback)
39 : ActiveDOMObject(frame->document()) 39 : ActiveDOMObject(frame->document())
40 , m_frame(frame) 40 , m_frame(frame)
41 , m_worldID(worldID) 41 , m_worldID(worldID)
42 , m_sources(sources) 42 , m_sources(sources)
43 , m_extensionGroup(extensionGroup) 43 , m_extensionGroup(extensionGroup)
44 , m_userGesture(userGesture) 44 , m_userGesture(userGesture)
(...skipping 16 matching lines...) Expand all
61 61
62 void SuspendableScriptExecutor::executeAndDestroySelf() 62 void SuspendableScriptExecutor::executeAndDestroySelf()
63 { 63 {
64 // after calling the destructor of object - object will be unsubscribed from 64 // after calling the destructor of object - object will be unsubscribed from
65 // resumed and contextDestroyed LifecycleObserver methods 65 // resumed and contextDestroyed LifecycleObserver methods
66 OwnPtr<UserGestureIndicator> indicator; 66 OwnPtr<UserGestureIndicator> indicator;
67 if (m_userGesture) 67 if (m_userGesture)
68 indicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUse rGesture)); 68 indicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUse rGesture));
69 69
70 v8::HandleScope scope(v8::Isolate::GetCurrent()); 70 v8::HandleScope scope(v8::Isolate::GetCurrent());
71 Vector<v8::Local<v8::Value> > results; 71 Vector<v8::Local<v8::Value>> results;
72 if (m_worldID) { 72 if (m_worldID) {
73 m_frame->script().executeScriptInIsolatedWorld(m_worldID, m_sources, m_e xtensionGroup, &results); 73 m_frame->script().executeScriptInIsolatedWorld(m_worldID, m_sources, m_e xtensionGroup, &results);
74 } else { 74 } else {
75 v8::Local<v8::Value> scriptValue = m_frame->script().executeScriptInMain WorldAndReturnValue(m_sources.first()); 75 v8::Local<v8::Value> scriptValue = m_frame->script().executeScriptInMain WorldAndReturnValue(m_sources.first());
76 results.append(scriptValue); 76 results.append(scriptValue);
77 } 77 }
78 m_callback->completed(results); 78 m_callback->completed(results);
79 deref(); 79 deref();
80 } 80 }
81 81
82 void SuspendableScriptExecutor::trace(Visitor* visitor) 82 void SuspendableScriptExecutor::trace(Visitor* visitor)
83 { 83 {
84 visitor->trace(m_frame); 84 visitor->trace(m_frame);
85 ActiveDOMObject::trace(visitor); 85 ActiveDOMObject::trace(visitor);
86 } 86 }
87 87
88 } // namespace blink 88 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698