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

Issue 2401123002: UserGestureIndicator is a mess. Clean it up. (Closed)

Created:
4 years, 2 months ago by Nate Chapin
Modified:
4 years, 2 months ago
CC:
aboxhall+watch_chromium.org, aboxhall, apavlov+blink_chromium.org, awdf+watch_chromium.org, blink-reviews, blink-reviews-html_chromium.org, caseq+blink_chromium.org, chromium-reviews, dcheng, devtools-reviews_chromium.org, dglazkov+blink, dmazzoni+watch_chromium.org, dmazzoni, dtapuska+blinkwatch_chromium.org, dtseng+watch_chromium.org, eric.carlson_apple.com, feature-media-reviews_chromium.org, gavinp+loader_chromium.org, haraken, je_julie, kinuko+watch, kozyatinskiy+blink_chromium.org, loading-reviews_chromium.org, lushnikov+blink_chromium.org, mlamouri+watch-blink_chromium.org, nektar+watch_chromium.org, nektarios, nzolghadr+blinkwatch_chromium.org, Peter Beverloo, pfeldman+blink_chromium.org, Srirama, tyoshino+watch_chromium.org, yuzo+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

UserGestureIndicator is a mess. Clean it up. Currently are two constructors for a UserGestureIndicator, one that takes a ProcessingUserGestureState enum value and one that takes a PassRefPtr<UserGestureToken>. There are three ways to construct a UserGestureIndicator that does nothing: 1. Pass a nullptr to the PassRefPtr<UserGestureToken> constructor. 2. Pass PossiblyProcessingUserGesture to the enum constructor. 3. Pass DefinitelyNotProcessingUserGesture when not alredy processing a user gesture (this is in fact the only way it is currently used). (2) and (3) are only used in one place each, so remove those enum values and use the other constructor with a nullptr or simply don't construct a UserGestureIndicator. UserGestureToken is a pure virtual interface for reasons that aren't clear. Collapse its implementation in to the base class. With 2 ProcessingUserGestureState values removed, the only purpose of this enum is during UserGestureToken initialization: determining whether it definitely starts with m_consumableGestures == 1, or whether it starts at 1 only if there are no other UserGestureTokens on the stack. Move this initialization logic in to the UserGestureToken constructor, generally simplify UserGestureToken's surface, and remove the enum-based UserGestureIndicator constructor. Callers are now expected to pass in a PassRefPtr<UserGestureToken> on UserGestureIndicator initialization. UserGestureToken::create() now takes an enum similar to the old ProcessingUserGestureState, with values equivalent to DefinitelyProcessingNewUserGesture and DefinitelyProcessingUserGesture. BUG= Committed: https://crrev.com/046115dc4c7cff68b07ad14f426388d86463aa22 Cr-Commit-Position: refs/heads/master@{#424552}

Patch Set 1 #

Patch Set 2 : UserGestureIndicator is a mess. Clean it up. #

Patch Set 3 : UserGestureIndicator is a mess. Clean it up. #

Patch Set 4 : Last bit of cleanup #

Patch Set 5 : Fix tests #

Total comments: 17

Patch Set 6 : Callback cleanup, comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+213 lines, -273 lines) Patch
M third_party/WebKit/Source/core/html/AutoplayExperimentTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/input/EventHandler.cpp View 1 2 3 4 5 2 chunks +7 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/input/GestureManager.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/input/KeyboardEventManager.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/input/TouchEventManager.cpp View 1 chunk +7 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/inspector/DevToolsHost.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/NavigationScheduler.cpp View 9 chunks +15 lines, -25 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXObject.cpp View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/notifications/Notification.cpp View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/UserGestureIndicator.h View 1 2 3 4 5 3 chunks +46 lines, -27 lines 0 comments Download
M third_party/WebKit/Source/platform/UserGestureIndicator.cpp View 1 2 3 4 5 4 chunks +63 lines, -153 lines 0 comments Download
M third_party/WebKit/Source/platform/UserGestureIndicatorTest.cpp View 1 2 3 4 5 9 chunks +21 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp View 1 2 3 chunks +6 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/web/WebLocalFrameImpl.cpp View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/web/WebPluginContainerImpl.cpp View 1 2 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/web/WebScopedUserGesture.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/WebUserGestureToken.cpp View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/WebViewImpl.cpp View 1 2 3 4 5 5 chunks +10 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/web/tests/WebFrameTest.cpp View 1 2 9 chunks +10 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/web/tests/WebUserGestureTokenTest.cpp View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 50 (31 generated)
Nate Chapin
I took a look at UserGestureIndicator's implementation as a part of https://codereview.chromium.org/2392773002. There's quite a ...
4 years, 2 months ago (2016-10-10 22:22:46 UTC) #21
Nate Chapin
https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp File third_party/WebKit/Source/platform/UserGestureIndicator.cpp (left): https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp#oldcode125 third_party/WebKit/Source/platform/UserGestureIndicator.cpp:125: UserGestureIndicator* UserGestureIndicator::s_topmostIndicator = 0; Fun fact! s_topmostIndicator was actually ...
4 years, 2 months ago (2016-10-10 22:26:46 UTC) #22
esprehn
lgtm, this is amazing!
4 years, 2 months ago (2016-10-10 23:52:07 UTC) #25
ojan
<3
4 years, 2 months ago (2016-10-11 03:29:10 UTC) #27
dtapuska
https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp File third_party/WebKit/Source/platform/UserGestureIndicator.cpp (right): https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp#newcode57 third_party/WebKit/Source/platform/UserGestureIndicator.cpp:57: other->m_timestamp = WTF::currentTime(); On 2016/10/10 22:26:46, Nate Chapin wrote: ...
4 years, 2 months ago (2016-10-11 14:00:03 UTC) #29
Nate Chapin
On 2016/10/11 at 14:00:03, dtapuska wrote: > https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp > File third_party/WebKit/Source/platform/UserGestureIndicator.cpp (right): > > https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp#newcode57 ...
4 years, 2 months ago (2016-10-11 16:43:28 UTC) #30
dtapuska
On 2016/10/11 16:43:28, Nate Chapin wrote: > On 2016/10/11 at 14:00:03, dtapuska wrote: > > ...
4 years, 2 months ago (2016-10-11 17:03:44 UTC) #31
jochen (gone - plz use gerrit)
https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp File third_party/WebKit/Source/platform/UserGestureIndicator.cpp (left): https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp#oldcode125 third_party/WebKit/Source/platform/UserGestureIndicator.cpp:125: UserGestureIndicator* UserGestureIndicator::s_topmostIndicator = 0; On 2016/10/10 at 22:26:46, Nate ...
4 years, 2 months ago (2016-10-11 17:06:00 UTC) #32
Nate Chapin
https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp File third_party/WebKit/Source/platform/UserGestureIndicator.cpp (left): https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp#oldcode125 third_party/WebKit/Source/platform/UserGestureIndicator.cpp:125: UserGestureIndicator* UserGestureIndicator::s_topmostIndicator = 0; On 2016/10/11 at 17:06:00, jochen ...
4 years, 2 months ago (2016-10-11 17:27:00 UTC) #33
Rick Byers
This is a great simplification, thanks! Just one non-trivial concern over callback lifetime semantics: I ...
4 years, 2 months ago (2016-10-11 18:00:19 UTC) #34
Nate Chapin
https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp File third_party/WebKit/Source/platform/UserGestureIndicator.cpp (right): https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp#newcode110 third_party/WebKit/Source/platform/UserGestureIndicator.cpp:110: if (isMainThread() && m_token && m_token == s_rootToken) { ...
4 years, 2 months ago (2016-10-11 18:18:42 UTC) #35
Rick Byers
On 2016/10/11 18:18:42, Nate Chapin wrote: > https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp > File third_party/WebKit/Source/platform/UserGestureIndicator.cpp (right): > > https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp#newcode110 ...
4 years, 2 months ago (2016-10-11 19:05:01 UTC) #36
Nate Chapin
https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp File third_party/WebKit/Source/platform/UserGestureIndicator.cpp (right): https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/platform/UserGestureIndicator.cpp#newcode110 third_party/WebKit/Source/platform/UserGestureIndicator.cpp:110: if (isMainThread() && m_token && m_token == s_rootToken) { ...
4 years, 2 months ago (2016-10-11 19:17:55 UTC) #38
Rick Byers
LGTM with one possible cleanup nit. Thank you! https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/core/input/TouchEventManager.cpp File third_party/WebKit/Source/core/input/TouchEventManager.cpp (right): https://codereview.chromium.org/2401123002/diff/80001/third_party/WebKit/Source/core/input/TouchEventManager.cpp#newcode527 third_party/WebKit/Source/core/input/TouchEventManager.cpp:527: gestureIndicator ...
4 years, 2 months ago (2016-10-11 19:28:12 UTC) #40
Nate Chapin
On 2016/10/11 at 19:28:12, rbyers wrote: > LGTM with one possible cleanup nit. > > ...
4 years, 2 months ago (2016-10-11 19:41:30 UTC) #41
Rick Byers
On 2016/10/11 19:41:30, Nate Chapin wrote: > On 2016/10/11 at 19:28:12, rbyers wrote: > > ...
4 years, 2 months ago (2016-10-11 19:54:12 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2401123002/100001
4 years, 2 months ago (2016-10-11 21:13:52 UTC) #47
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 2 months ago (2016-10-11 21:36:57 UTC) #48
commit-bot: I haz the power
4 years, 2 months ago (2016-10-11 21:39:40 UTC) #50
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/046115dc4c7cff68b07ad14f426388d86463aa22
Cr-Commit-Position: refs/heads/master@{#424552}

Powered by Google App Engine
This is Rietveld 408576698