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

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

Issue 2401123002: UserGestureIndicator is a mess. Clean it up. (Closed)
Patch Set: Callback cleanup, comments 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 "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 "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 int extensionGroup, 47 int extensionGroup,
48 bool userGesture) 48 bool userGesture)
49 : m_sources(sources), 49 : m_sources(sources),
50 m_worldID(worldID), 50 m_worldID(worldID),
51 m_extensionGroup(extensionGroup), 51 m_extensionGroup(extensionGroup),
52 m_userGesture(userGesture) {} 52 m_userGesture(userGesture) {}
53 53
54 Vector<v8::Local<v8::Value>> WebScriptExecutor::execute(LocalFrame* frame) { 54 Vector<v8::Local<v8::Value>> WebScriptExecutor::execute(LocalFrame* frame) {
55 std::unique_ptr<UserGestureIndicator> indicator; 55 std::unique_ptr<UserGestureIndicator> indicator;
56 if (m_userGesture) { 56 if (m_userGesture) {
57 indicator = wrapUnique( 57 indicator = wrapUnique(new UserGestureIndicator(
58 new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); 58 UserGestureToken::create(UserGestureToken::NewGesture)));
59 } 59 }
60 60
61 Vector<v8::Local<v8::Value>> results; 61 Vector<v8::Local<v8::Value>> results;
62 if (m_worldID) { 62 if (m_worldID) {
63 frame->script().executeScriptInIsolatedWorld(m_worldID, m_sources, 63 frame->script().executeScriptInIsolatedWorld(m_worldID, m_sources,
64 m_extensionGroup, &results); 64 m_extensionGroup, &results);
65 } else { 65 } else {
66 v8::Local<v8::Value> scriptValue = 66 v8::Local<v8::Value> scriptValue =
67 frame->script().executeScriptInMainWorldAndReturnValue( 67 frame->script().executeScriptInMainWorldAndReturnValue(
68 m_sources.first()); 68 m_sources.first());
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 stop(); 203 stop();
204 } 204 }
205 205
206 DEFINE_TRACE(SuspendableScriptExecutor) { 206 DEFINE_TRACE(SuspendableScriptExecutor) {
207 visitor->trace(m_frame); 207 visitor->trace(m_frame);
208 visitor->trace(m_executor); 208 visitor->trace(m_executor);
209 SuspendableTimer::trace(visitor); 209 SuspendableTimer::trace(visitor);
210 } 210 }
211 211
212 } // namespace blink 212 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/UserGestureIndicatorTest.cpp ('k') | third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698