Bug 132522 - Clean up ProcessThrottler
Summary: Clean up ProcessThrottler
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-02 23:24 PDT by Gavin Barraclough
Modified: 2014-05-05 13:14 PDT (History)
1 user (show)

See Also:


Attachments
Fix (25.54 KB, patch)
2014-05-02 23:50 PDT, Gavin Barraclough
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.