Bug 111751

Summary: [Qt][WK2] Refactor handling of content suspension to properly cover corner cases
Product: WebKit Reporter: Andras Becsi <abecsi>
Component: New BugsAssignee: Andras Becsi <abecsi>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cmarcelo, jturcotte, menard, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 110211, 112679    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Andras Becsi 2013-03-07 10:03:45 PST
[Qt][WK2] Refactor handling of content suspension to properly cover corner cases
Comment 1 Andras Becsi 2013-03-07 10:12:38 PST
Created attachment 192037 [details]
Patch
Comment 2 Andras Becsi 2013-03-07 10:14:55 PST
*** Bug 111081 has been marked as a duplicate of this bug. ***
Comment 3 Jocelyn Turcotte 2013-03-11 08:41:11 PDT
Comment on attachment 192037 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=192037&action=review

> Source/WebKit2/UIProcess/PageViewportController.cpp:315
> +void PageViewportController::suspendContent()
> +{
>      m_webPageProxy->suspendActiveDOMObjectsAndAnimations();
>  }

With those modifications could suspendContent, resumeContent and hasSuspendedContent be removed and directly accessed through WebPageProxy?

> Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp:174
> +        ASSERT(!scrollAnimationActive());

What does this protect, would anything break if this was the case?
There is also already a similar guard in animateContentRectVisible.

> Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp:192
> +    ++m_activeSuspensionCount;

I see this as a violation of the abstraction, it dupplicates logic and this could lead to problems if the code evolves in some wicked way.
How about having some kind of "guardOnly" flag/property in a m_touchSuspensionGuard SuspensionController that would do the same except triggering the call to suspendContent()?

> Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h:109
> +        SuspensionController(PageViewportControllerClientQt* parent)

"parent" is usually used in a hierarchy, maybe just "client"?
Comment 4 Andras Becsi 2013-03-13 09:46:47 PDT
Created attachment 192939 [details]
Patch
Comment 5 Andras Becsi 2013-03-18 07:31:06 PDT
Created attachment 193559 [details]
Patch
Comment 6 Andras Becsi 2013-03-18 07:35:15 PDT
(In reply to comment #5)
> Created an attachment (id=193559) [details]
> Patch
Rebased the original patch and made some renames to better indicate the responsibilities.
Comment 7 Andras Becsi 2013-03-18 08:48:21 PDT
Created attachment 193572 [details]
Patch
Comment 8 Andras Becsi 2013-03-18 08:49:18 PDT
(In reply to comment #7)
> Created an attachment (id=193572) [details]
> Patch

Stripped out some unrelated changes.
Comment 9 Jocelyn Turcotte 2013-03-18 08:52:51 PDT
Comment on attachment 193572 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=193572&action=review

> Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp:48
> +    , m_touchInteraction(this, false /* shouldSuspend */)

Nit: I think we usually put the comment before the value.

Otherwise it LGTM. You really need owners to look at the WebPageProxy change, in particular.
Comment 10 Jocelyn Turcotte 2013-03-18 08:54:29 PDT
(In reply to comment #9)
> Otherwise it LGTM. You really need owners to look at the WebPageProxy change, in particular.

@Benjamin, do you have a minute to check it out?
Comment 11 Benjamin Poulain 2013-03-19 15:18:26 PDT
Comment on attachment 193572 [details]
Patch

I don't really have time to review for correctness. The changes on WebPageProxy are fine. Signed off by me for WebKit2.
Comment 12 Jocelyn Turcotte 2013-03-20 09:36:42 PDT
Comment on attachment 193572 [details]
Patch

Thanks, r=me then.
Comment 13 Andras Becsi 2013-03-20 09:47:38 PDT
Comment on attachment 193572 [details]
Patch

Clearing flags on attachment: 193572

Committed r146355: <http://trac.webkit.org/changeset/146355>
Comment 14 Andras Becsi 2013-03-20 09:47:43 PDT
All reviewed patches have been landed.  Closing bug.