RESOLVED FIXED 148062
Refactor ViewGestureController swipe snapshot removal to be more platform-independent
https://bugs.webkit.org/show_bug.cgi?id=148062
Summary Refactor ViewGestureController swipe snapshot removal to be more platform-ind...
Tim Horton
Reported 2015-08-15 16:07:50 PDT
Refactor ViewGestureController swipe snapshot removal to be more platform-independent
Attachments
Patch (44.96 KB, patch)
2015-08-15 16:09 PDT, Tim Horton
no flags
Patch (44.98 KB, patch)
2015-08-15 16:34 PDT, Tim Horton
no flags
Patch (44.99 KB, patch)
2015-08-15 16:47 PDT, Tim Horton
mitz: review+
Tim Horton
Comment 1 2015-08-15 16:09:00 PDT
Tim Horton
Comment 2 2015-08-15 16:09:33 PDT
Mac is good; still have to test iOS.
Tim Horton
Comment 3 2015-08-15 16:11:46 PDT
Logging looks like this: Swipe Snapshot Removal (0.00 ms) - start Swipe Snapshot Removal (0.14 ms) - (re)started watchdog timer for 5 seconds Swipe Snapshot Removal (828.31 ms) - outstanding event occurred: VisuallyNonEmptyLayout Swipe Snapshot Removal (828.45 ms) - deferring removal; had oustanding events: RenderTreeSizeThreshold MainFrameLoad SubresourceLoads Swipe Snapshot Removal (828.51 ms) - (re)started watchdog timer for 3 seconds Swipe Snapshot Removal (844.20 ms) - outstanding event occurred: RenderTreeSizeThreshold Swipe Snapshot Removal (844.34 ms) - deferring removal; had oustanding events: MainFrameLoad SubresourceLoads Swipe Snapshot Removal (2046.35 ms) - outstanding event occurred: MainFrameLoad Swipe Snapshot Removal (2046.46 ms) - deferring removal; had oustanding events: SubresourceLoads Swipe Snapshot Removal (2046.52 ms) - outstanding event occurred: SubresourceLoads Swipe Snapshot Removal (2046.59 ms) - removed snapshot Swipe Snapshot Removal (0.00 ms) - start Swipe Snapshot Removal (0.12 ms) - (re)started watchdog timer for 5 seconds Swipe Snapshot Removal (86.57 ms) - outstanding event occurred: MainFrameLoad Swipe Snapshot Removal (86.68 ms) - deferring removal; had oustanding events: VisuallyNonEmptyLayout RenderTreeSizeThreshold SubresourceLoads Swipe Snapshot Removal (86.74 ms) - wait for event cancelled: VisuallyNonEmptyLayout Swipe Snapshot Removal (86.80 ms) - deferring removal; had oustanding events: RenderTreeSizeThreshold SubresourceLoads Swipe Snapshot Removal (86.86 ms) - outstanding event occurred: SubresourceLoads Swipe Snapshot Removal (86.91 ms) - deferring removal; had oustanding events: RenderTreeSizeThreshold Swipe Snapshot Removal (270.75 ms) - outstanding event occurred: RenderTreeSizeThreshold Swipe Snapshot Removal (270.91 ms) - removed snapshot
Tim Horton
Comment 4 2015-08-15 16:34:22 PDT
Tim Horton
Comment 5 2015-08-15 16:47:24 PDT
mitz
Comment 6 2015-08-16 16:45:58 PDT
Comment on attachment 259109 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259109&action=review > Source/WebKit2/UIProcess/ViewGestureController.cpp:51 > +static HashMap<uint64_t, WebKit::ViewGestureController*>& viewGestureControllersForAllPages() > +{ > + // The key in this map is the associated page ID. > + static NeverDestroyed<HashMap<uint64_t, WebKit::ViewGestureController*>> viewGestureControllers; > + return viewGestureControllers.get(); > +} Can this go inside the namespace WebKit block? > Source/WebKit2/UIProcess/ViewGestureController.cpp:151 > +String ViewGestureController::SnapshotRemovalTracker::eventsDescription(ViewGestureController::SnapshotRemovalTracker::Events event) This can be a static function, perhaps even a file-static function. > Source/WebKit2/UIProcess/ViewGestureController.cpp:153 > + String description; StringBuilder? > Source/WebKit2/UIProcess/ViewGestureController.cpp:238 > +bool ViewGestureController::SnapshotRemovalTracker::cancelOutstandingEvent(Events event) > +{ > + ASSERT(hasOneBitSet(event)); > + > + if (!(m_outstandingEvents & event)) > + return false; > + > + log("wait for event cancelled: " + eventsDescription(event)); > + > + m_outstandingEvents &= ~event; > + > + fireRemovalCallbackIfPossible(); > + return true; > +} Strange to have two functions that differ only in the message they log. > Source/WebKit2/UIProcess/ViewGestureController.cpp:256 > + log("removed snapshot"); “removing”? “will remove”? log after making the callback? > Source/WebKit2/UIProcess/mac/ViewGestureController.h:170 > + void log(String); const String&?
Tim Horton
Comment 7 2015-08-16 17:44:30 PDT
(In reply to comment #6) > Comment on attachment 259109 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=259109&action=review > > > Source/WebKit2/UIProcess/ViewGestureController.cpp:151 > > +String ViewGestureController::SnapshotRemovalTracker::eventsDescription(ViewGestureController::SnapshotRemovalTracker::Events event) > > This can be a static function, perhaps even a file-static function. It can't be file static because SnapshotRemovalTracker is private. But static, yes. And everything else, yes. Thanks!
Tim Horton
Comment 8 2015-08-16 17:52:45 PDT
(In reply to comment #6) > Comment on attachment 259109 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=259109&action=review > > Strange to have two functions that differ only in the message they log. I really want to keep separate function names for clarity at callsites, but I refactored it so the majority of the code is only in one place.
Tim Horton
Comment 9 2015-08-16 17:53:48 PDT
Note You need to log in before you can comment on or make changes to this bug.