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

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

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Re-add dropped null check Created 4 years, 1 month 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"
11 #include "core/dom/DocumentUserGestureToken.h"
11 #include "core/frame/LocalFrame.h" 12 #include "core/frame/LocalFrame.h"
12 #include "platform/UserGestureIndicator.h" 13 #include "platform/UserGestureIndicator.h"
13 #include "public/platform/WebVector.h" 14 #include "public/platform/WebVector.h"
14 #include "public/web/WebScriptExecutionCallback.h" 15 #include "public/web/WebScriptExecutionCallback.h"
15 #include "wtf/PtrUtil.h" 16 #include "wtf/PtrUtil.h"
16 #include "wtf/Vector.h" 17 #include "wtf/Vector.h"
17 #include <memory> 18 #include <memory>
18 19
19 namespace blink { 20 namespace blink {
20 21
(...skipping 26 matching lines...) Expand all
47 int extensionGroup, 48 int extensionGroup,
48 bool userGesture) 49 bool userGesture)
49 : m_sources(sources), 50 : m_sources(sources),
50 m_worldID(worldID), 51 m_worldID(worldID),
51 m_extensionGroup(extensionGroup), 52 m_extensionGroup(extensionGroup),
52 m_userGesture(userGesture) {} 53 m_userGesture(userGesture) {}
53 54
54 Vector<v8::Local<v8::Value>> WebScriptExecutor::execute(LocalFrame* frame) { 55 Vector<v8::Local<v8::Value>> WebScriptExecutor::execute(LocalFrame* frame) {
55 std::unique_ptr<UserGestureIndicator> indicator; 56 std::unique_ptr<UserGestureIndicator> indicator;
56 if (m_userGesture) { 57 if (m_userGesture) {
57 indicator = wrapUnique(new UserGestureIndicator( 58 indicator =
58 UserGestureToken::create(UserGestureToken::NewGesture))); 59 wrapUnique(new UserGestureIndicator(DocumentUserGestureToken::create(
60 frame->document(), UserGestureToken::NewGesture)));
59 } 61 }
60 62
61 Vector<v8::Local<v8::Value>> results; 63 Vector<v8::Local<v8::Value>> results;
62 if (m_worldID) { 64 if (m_worldID) {
63 frame->script().executeScriptInIsolatedWorld(m_worldID, m_sources, 65 frame->script().executeScriptInIsolatedWorld(m_worldID, m_sources,
64 m_extensionGroup, &results); 66 m_extensionGroup, &results);
65 } else { 67 } else {
66 v8::Local<v8::Value> scriptValue = 68 v8::Local<v8::Value> scriptValue =
67 frame->script().executeScriptInMainWorldAndReturnValue( 69 frame->script().executeScriptInMainWorldAndReturnValue(
68 m_sources.first()); 70 m_sources.first());
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 stop(); 219 stop();
218 } 220 }
219 221
220 DEFINE_TRACE(SuspendableScriptExecutor) { 222 DEFINE_TRACE(SuspendableScriptExecutor) {
221 visitor->trace(m_frame); 223 visitor->trace(m_frame);
222 visitor->trace(m_executor); 224 visitor->trace(m_executor);
223 SuspendableTimer::trace(visitor); 225 SuspendableTimer::trace(visitor);
224 } 226 }
225 227
226 } // namespace blink 228 } // 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