Changeset 231818 in webkit


Ignore:
Timestamp:
May 15, 2018, 4:06:28 PM (7 years ago)
Author:
pvollan@apple.com
Message:

Pause display links when window is not visible.
https://bugs.webkit.org/show_bug.cgi?id=185627
<rdar://problem/39401106>

Reviewed by Simon Fraser.

Pause/resume display links created in the UI process when the window is hidden/shown.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::dispatchActivityStateChange):

  • UIProcess/mac/DisplayLink.cpp:

(WebKit::DisplayLink::pause):
(WebKit::DisplayLink::resume):

  • UIProcess/mac/DisplayLink.h:
Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r231814 r231818  
     12018-05-15  Per Arne Vollan  <pvollan@apple.com>
     2
     3        Pause display links when window is not visible.
     4        https://bugs.webkit.org/show_bug.cgi?id=185627
     5        <rdar://problem/39401106>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Pause/resume display links created in the UI process when the window is hidden/shown.
     10
     11        * UIProcess/WebPageProxy.cpp:
     12        (WebKit::WebPageProxy::dispatchActivityStateChange):
     13        * UIProcess/mac/DisplayLink.cpp:
     14        (WebKit::DisplayLink::pause):
     15        (WebKit::DisplayLink::resume):
     16        * UIProcess/mac/DisplayLink.h:
     17
    1182018-05-15  Dean Jackson  <dino@apple.com>
    219
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r231795 r231818  
    15871587
    15881588    if (changed & ActivityState::IsVisible) {
    1589         if (isViewVisible())
     1589        if (isViewVisible()) {
    15901590            m_visiblePageToken = m_process->visiblePageToken();
     1591#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     1592            if (m_displayLink)
     1593                m_displayLink->resume();
     1594#endif
     1595        }
    15911596        else {
    15921597            m_visiblePageToken = nullptr;
     
    15961601            // stop the unresponsiveness timer here.
    15971602            m_process->responsivenessTimer().stop();
     1603#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     1604            if (m_displayLink)
     1605                m_displayLink->pause();
     1606#endif
    15981607        }
    15991608    }
  • trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp

    r230747 r231818  
    8282}
    8383
     84void DisplayLink::pause()
     85{
     86    if (!CVDisplayLinkIsRunning(m_displayLink))
     87        return;
     88    CVDisplayLinkStop(m_displayLink);
     89}
     90
     91void DisplayLink::resume()
     92{
     93    if (CVDisplayLinkIsRunning(m_displayLink))
     94        return;
     95    CVDisplayLinkStart(m_displayLink);
     96}
     97
    8498CVReturn DisplayLink::displayLinkCallback(CVDisplayLinkRef displayLinkRef, const CVTimeStamp*, const CVTimeStamp*, CVOptionFlags, CVOptionFlags*, void* data)
    8599{
  • trunk/Source/WebKit/UIProcess/mac/DisplayLink.h

    r230747 r231818  
    4646    bool hasObservers() const;
    4747
     48    void pause();
     49    void resume();
     50   
    4851private:
    4952    static CVReturn displayLinkCallback(CVDisplayLinkRef, const CVTimeStamp*, const CVTimeStamp*, CVOptionFlags, CVOptionFlags*, void* data);
Note: See TracChangeset for help on using the changeset viewer.