Bug 132522

Summary: Clean up ProcessThrottler
Product: WebKit Reporter: Gavin Barraclough <barraclough>
Component: WebKit2Assignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Fix ggaren: review+

Description Gavin Barraclough 2014-05-02 23:24:21 PDT
Piggybacking on the setViewState reply to synchronize is a little hacky, and we'll want a to inform the process that it will suspend in cases other than visibility change. Add an explicit handshake for this purpose.
Comment 1 Gavin Barraclough 2014-05-02 23:50:06 PDT
Created attachment 230749 [details]
Fix
Comment 2 WebKit Commit Bot 2014-05-02 23:51:44 PDT
Attachment 230749 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/ios/ProcessThrottler.h:60:  The parameter name "process" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 1 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Geoffrey Garen 2014-05-03 12:42:15 PDT
Comment on attachment 230749 [details]
Fix

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

r=me, but I might have found a bug.

> Source/WebKit2/ChangeLog:21
> +        longer needs request a reply from SetViewState, and WebPageProxy can lose all the 'hiding'

"needs to"

> Source/WebKit2/UIProcess/WebPageProxy.cpp:1101
> +    else if (!m_activityToken)
> +        m_activityToken = std::make_unique<ProcessThrottler::ForegroundActivityToken>(m_process->throttler());

If I already have an activity token, but it is Background instead of Foreground, won't this !m_activityToken check prevent me from entering the Foreground state when I should?

Seems like you should check !m_activityToken || m_activityToken->isBackgroundActivityToken() or something.
Comment 4 Gavin Barraclough 2014-05-05 10:37:08 PDT
(In reply to comment #3)
> (From update of attachment 230749 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=230749&action=review
> 
> r=me, but I might have found a bug.
> 
> > Source/WebKit2/ChangeLog:21
> > +        longer needs request a reply from SetViewState, and WebPageProxy can lose all the 'hiding'
> 
> "needs to"
> 
> > Source/WebKit2/UIProcess/WebPageProxy.cpp:1101
> > +    else if (!m_activityToken)
> > +        m_activityToken = std::make_unique<ProcessThrottler::ForegroundActivityToken>(m_process->throttler());
> 
> If I already have an activity token, but it is Background instead of Foreground, won't this !m_activityToken check prevent me from entering the Foreground state when I should?
> 
> Seems like you should check !m_activityToken || m_activityToken->isBackgroundActivityToken() or something.

No – the WebPageProxy no longer has to know about keeping the page running the background state – that is now all invisible to it. WebPageProxy simply takes a ForegroundActivityToken when the page is visible, and releases it when the page is hidden. The ProcessThrottler is now responsible for transitioning from Foreground to Suspended via a Background state.
Comment 5 Gavin Barraclough 2014-05-05 13:14:49 PDT
Transmitting file data ...............
Committed revision 168312.