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

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

Issue 2612903007: Migrate WTF::Vector::append() to ::push_back() [part 15 of N] (Closed)
Patch Set: Created 3 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
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 "web/SuspendableScriptExecutor.h" 5 #include "web/SuspendableScriptExecutor.h"
6 6
7 #include "bindings/core/v8/ScriptController.h" 7 #include "bindings/core/v8/ScriptController.h"
8 #include "bindings/core/v8/ScriptSourceCode.h" 8 #include "bindings/core/v8/ScriptSourceCode.h"
9 #include "bindings/core/v8/V8PersistentValueVector.h" 9 #include "bindings/core/v8/V8PersistentValueVector.h"
10 #include "bindings/core/v8/WindowProxy.h" 10 #include "bindings/core/v8/WindowProxy.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 Vector<v8::Local<v8::Value>> results; 64 Vector<v8::Local<v8::Value>> results;
65 if (m_worldID) { 65 if (m_worldID) {
66 frame->script().executeScriptInIsolatedWorld(m_worldID, m_sources, 66 frame->script().executeScriptInIsolatedWorld(m_worldID, m_sources,
67 m_extensionGroup, &results); 67 m_extensionGroup, &results);
68 } else { 68 } else {
69 v8::Local<v8::Value> scriptValue = 69 v8::Local<v8::Value> scriptValue =
70 frame->script().executeScriptInMainWorldAndReturnValue( 70 frame->script().executeScriptInMainWorldAndReturnValue(
71 m_sources.front()); 71 m_sources.front());
72 results.append(scriptValue); 72 results.push_back(scriptValue);
73 } 73 }
74 74
75 return results; 75 return results;
76 } 76 }
77 77
78 class V8FunctionExecutor : public SuspendableScriptExecutor::Executor { 78 class V8FunctionExecutor : public SuspendableScriptExecutor::Executor {
79 public: 79 public:
80 V8FunctionExecutor(v8::Isolate*, 80 V8FunctionExecutor(v8::Isolate*,
81 v8::Local<v8::Function>, 81 v8::Local<v8::Function>,
82 v8::Local<v8::Value> receiver, 82 v8::Local<v8::Value> receiver,
(...skipping 23 matching lines...) Expand all
106 m_args.Append(argv[i]); 106 m_args.Append(argv[i]);
107 } 107 }
108 108
109 Vector<v8::Local<v8::Value>> V8FunctionExecutor::execute(LocalFrame* frame) { 109 Vector<v8::Local<v8::Value>> V8FunctionExecutor::execute(LocalFrame* frame) {
110 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 110 v8::Isolate* isolate = v8::Isolate::GetCurrent();
111 Vector<v8::Local<v8::Value>> results; 111 Vector<v8::Local<v8::Value>> results;
112 v8::Local<v8::Value> singleResult; 112 v8::Local<v8::Value> singleResult;
113 Vector<v8::Local<v8::Value>> args; 113 Vector<v8::Local<v8::Value>> args;
114 args.reserveCapacity(m_args.Size()); 114 args.reserveCapacity(m_args.Size());
115 for (size_t i = 0; i < m_args.Size(); ++i) 115 for (size_t i = 0; i < m_args.Size(); ++i)
116 args.append(m_args.Get(i)); 116 args.push_back(m_args.Get(i));
117 { 117 {
118 std::unique_ptr<UserGestureIndicator> gestureIndicator; 118 std::unique_ptr<UserGestureIndicator> gestureIndicator;
119 if (m_gestureToken) { 119 if (m_gestureToken) {
120 gestureIndicator = 120 gestureIndicator =
121 WTF::wrapUnique(new UserGestureIndicator(m_gestureToken.release())); 121 WTF::wrapUnique(new UserGestureIndicator(m_gestureToken.release()));
122 } 122 }
123 if (V8ScriptRunner::callFunction(m_function.newLocal(isolate), 123 if (V8ScriptRunner::callFunction(m_function.newLocal(isolate),
124 frame->document(), 124 frame->document(),
125 m_receiver.newLocal(isolate), args.size(), 125 m_receiver.newLocal(isolate), args.size(),
126 args.data(), toIsolate(frame)) 126 args.data(), toIsolate(frame))
127 .ToLocal(&singleResult)) 127 .ToLocal(&singleResult))
128 results.append(singleResult); 128 results.push_back(singleResult);
129 } 129 }
130 return results; 130 return results;
131 } 131 }
132 132
133 } // namespace 133 } // namespace
134 134
135 void SuspendableScriptExecutor::createAndRun( 135 void SuspendableScriptExecutor::createAndRun(
136 LocalFrame* frame, 136 LocalFrame* frame,
137 int worldID, 137 int worldID,
138 const HeapVector<ScriptSourceCode>& sources, 138 const HeapVector<ScriptSourceCode>& sources,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 m_keepAlive.clear(); 231 m_keepAlive.clear();
232 stop(); 232 stop();
233 } 233 }
234 234
235 DEFINE_TRACE(SuspendableScriptExecutor) { 235 DEFINE_TRACE(SuspendableScriptExecutor) {
236 visitor->trace(m_executor); 236 visitor->trace(m_executor);
237 SuspendableTimer::trace(visitor); 237 SuspendableTimer::trace(visitor);
238 } 238 }
239 239
240 } // namespace blink 240 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/ExternalPopupMenu.cpp ('k') | third_party/WebKit/Source/web/TextFinder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698