Changeset 170557 in webkit


Ignore:
Timestamp:
Jun 27, 2014, 2:58:06 PM (11 years ago)
Author:
Antti Koivisto
Message:

Flush throttling with remote layers
https://bugs.webkit.org/show_bug.cgi?id=134398

Reviewed by Darin Adler.

Source/WebCore:
With remote layer trees the flush scheduling lives in the WebKit2 layer. The throttling code
needs to live there as well.

Add the required callbacks and disable the existing throttling code in RenderLayerCompositor
when remote layers are in use. Later we can get rid of the RenderLayerCompositor throttling code.

  • WebCore.xcodeproj/project.pbxproj:
  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::loadProgressingStatusChanged):

  • page/ChromeClient.h:

(WebCore::ChromeClient::adjustLayerFlushThrottling):

  • page/FrameView.cpp:

(WebCore::FrameView::disableLayerFlushThrottlingTemporarilyForInteraction):
(WebCore::FrameView::loadProgressingStatusChanged):

Factor the progress status change activities to a function.

(WebCore::FrameView::updateLayerFlushThrottling):
(WebCore::FrameView::setExposedRect):

Move the call to adjustTiledBackingCoverage from WebKit to here.

(WebCore::FrameView::updateLayerFlushThrottlingInAllFrames): Deleted.

  • page/FrameView.h:
  • page/LayerFlushThrottleState.h: Added.
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::RenderLayerCompositor):

Source/WebKit2:

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::adjustLayerFlushThrottling):

  • WebProcess/WebCoreSupport/WebChromeClient.h:
  • WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
  • WebProcess/WebPage/DrawingArea.h:

(WebKit::DrawingArea::adjustLayerFlushThrottling):

  • WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
  • WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:

(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
(WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect):
(WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):

Delay layer flushes during page loading.
If use interacts with the page the next flush in unthrottled even if loading is in progress.

(WebKit::RemoteLayerTreeDrawingArea::adjustLayerFlushThrottling):

Compute the new delay. The first visual flush uses a shorter delay.
Flush immediately when we are no longer throttling.

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect):

Location:
trunk/Source
Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Source/WebCore/ChangeLog

    r170553 r170557  
     12014-06-27  Antti Koivisto  <antti@apple.com>
     2
     3        Flush throttling with remote layers
     4        https://bugs.webkit.org/show_bug.cgi?id=134398
     5
     6        Reviewed by Darin Adler.
     7
     8        With remote layer trees the flush scheduling lives in the WebKit2 layer. The throttling code
     9        needs to live there as well.
     10       
     11        Add the required callbacks and disable the existing throttling code in RenderLayerCompositor
     12        when remote layers are in use. Later we can get rid of the RenderLayerCompositor throttling code.
     13
     14        * WebCore.xcodeproj/project.pbxproj:
     15        * loader/FrameLoader.cpp:
     16        (WebCore::FrameLoader::loadProgressingStatusChanged):
     17        * page/ChromeClient.h:
     18        (WebCore::ChromeClient::adjustLayerFlushThrottling):
     19        * page/FrameView.cpp:
     20        (WebCore::FrameView::disableLayerFlushThrottlingTemporarilyForInteraction):
     21        (WebCore::FrameView::loadProgressingStatusChanged):
     22       
     23            Factor the progress status change activities to a function.
     24
     25        (WebCore::FrameView::updateLayerFlushThrottling):
     26        (WebCore::FrameView::setExposedRect):
     27       
     28            Move the call to adjustTiledBackingCoverage from WebKit to here.
     29
     30        (WebCore::FrameView::updateLayerFlushThrottlingInAllFrames): Deleted.
     31        * page/FrameView.h:
     32        * page/LayerFlushThrottleState.h: Added.
     33        * rendering/RenderLayerCompositor.cpp:
     34        (WebCore::RenderLayerCompositor::RenderLayerCompositor):
     35
    1362014-06-27  Brady Eidson  <beidson@apple.com>
    237
  • TabularUnified trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r170539 r170557  
    61516151                E48944A2180B57D800F165D8 /* SimpleLineLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E48944A0180B57D800F165D8 /* SimpleLineLayout.cpp */; };
    61526152                E48944A3180B57D800F165D8 /* SimpleLineLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = E48944A1180B57D800F165D8 /* SimpleLineLayout.h */; settings = {ATTRIBUTES = (Private, ); }; };
     6153                E4916FF7195DF6A0005AB349 /* LayerFlushThrottleState.h in Headers */ = {isa = PBXBuildFile; fileRef = E4916FF6195DF6A0005AB349 /* LayerFlushThrottleState.h */; settings = {ATTRIBUTES = (Private, ); }; };
    61536154                E4946EAE156E64DD00D3297F /* StyleRuleImport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */; };
    61546155                E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */ = {isa = PBXBuildFile; fileRef = E4946EAD156E64DD00D3297F /* StyleRuleImport.h */; };
     
    1364813649                E48944A0180B57D800F165D8 /* SimpleLineLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayout.cpp; sourceTree = "<group>"; };
    1364913650                E48944A1180B57D800F165D8 /* SimpleLineLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayout.h; sourceTree = "<group>"; };
     13651                E4916FF6195DF6A0005AB349 /* LayerFlushThrottleState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerFlushThrottleState.h; sourceTree = "<group>"; };
    1365013652                E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRuleImport.cpp; sourceTree = "<group>"; };
    1365113653                E4946EAD156E64DD00D3297F /* StyleRuleImport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRuleImport.h; sourceTree = "<group>"; };
     
    1657316575                                BC94D1510C275C8B006BC617 /* History.h */,
    1657416576                                BC94D1520C275C8B006BC617 /* History.idl */,
     16577                                E4916FF6195DF6A0005AB349 /* LayerFlushThrottleState.h */,
    1657516578                                931D72F515FE695300C4C07E /* LayoutMilestones.h */,
    1657616579                                BCE1C41A0D982980003B02F2 /* Location.cpp */,
     
    2436324366                                B562DB6017D3CD630010AF96 /* HTMLElementTypeHelpers.h in Headers */,
    2436424367                                A871D45C0A127CBC00B12A68 /* HTMLEmbedElement.h in Headers */,
     24368                                E4916FF7195DF6A0005AB349 /* LayerFlushThrottleState.h in Headers */,
    2436524369                                977B386A122883E900B81FF8 /* HTMLEntityParser.h in Headers */,
    2436624370                                977B386C122883E900B81FF8 /* HTMLEntitySearch.h in Headers */,
  • TabularUnified trunk/Source/WebCore/loader/FrameLoader.cpp

    r170135 r170557  
    34093409void FrameLoader::loadProgressingStatusChanged()
    34103410{
    3411     FrameView* view = m_frame.mainFrame().view();
    3412     if (!view)
    3413         return;
    3414 
    3415     view->updateLayerFlushThrottlingInAllFrames();
    3416     view->adjustTiledBackingCoverage();
     3411    if (auto* view = m_frame.mainFrame().view())
     3412        view->loadProgressingStatusChanged();
    34173413}
    34183414
  • TabularUnified trunk/Source/WebCore/page/ChromeClient.h

    r169625 r170557  
    3030#include "GraphicsContext.h"
    3131#include "HostWindow.h"
     32#include "LayerFlushThrottleState.h"
    3233#include "PopupMenu.h"
    3334#include "PopupMenuClient.h"
     
    328329    virtual bool layerTreeStateIsFrozen() const { return false; }
    329330
     331    virtual bool adjustLayerFlushThrottling(LayerFlushThrottleState::Flags) { return false; }
     332
    330333    virtual PassRefPtr<ScrollingCoordinator> createScrollingCoordinator(Page*) const { return nullptr; }
    331334
  • TabularUnified trunk/Source/WebCore/page/FrameView.cpp

    r170461 r170557  
    22542254void FrameView::disableLayerFlushThrottlingTemporarilyForInteraction()
    22552255{
     2256    bool mainLoadProgressing = frame().page()->progress().isMainLoadProgressing();
     2257
     2258    LayerFlushThrottleState::Flags flags = LayerFlushThrottleState::UserIsInteracting | (mainLoadProgressing ? LayerFlushThrottleState::MainLoadProgressing : 0);
     2259    if (frame().page()->chrome().client().adjustLayerFlushThrottling(flags))
     2260        return;
     2261
    22562262    if (RenderView* view = renderView())
    22572263        view->compositor().disableLayerFlushThrottlingTemporarilyForInteraction();
    22582264}
    22592265
    2260 void FrameView::updateLayerFlushThrottlingInAllFrames()
    2261 {
     2266void FrameView::loadProgressingStatusChanged()
     2267{
     2268    updateLayerFlushThrottling();
     2269    adjustTiledBackingCoverage();
     2270}
     2271
     2272void FrameView::updateLayerFlushThrottling()
     2273{
     2274    ASSERT(frame().isMainFrame());
     2275
    22622276    bool isMainLoadProgressing = frame().page()->progress().isMainLoadProgressing();
     2277
     2278    // See if the client is handling throttling.
     2279    LayerFlushThrottleState::Flags flags = isMainLoadProgressing ? LayerFlushThrottleState::MainLoadProgressing : 0;
     2280    if (frame().page()->chrome().client().adjustLayerFlushThrottling(flags))
     2281        return;
     2282
    22632283    for (Frame* frame = m_frame.get(); frame; frame = frame->tree().traverseNext(m_frame.get())) {
    22642284        if (RenderView* renderView = frame->contentRenderer())
     
    44214441    if (!m_frame->isMainFrame())
    44224442        return;
    4423     if (TiledBacking* tiledBacking = this->tiledBacking())
     4443    if (TiledBacking* tiledBacking = this->tiledBacking()) {
     4444        adjustTiledBackingCoverage();
    44244445        tiledBacking->setTiledScrollingIndicatorPosition(exposedRect.location());
     4446    }
    44254447
    44264448    if (auto* view = renderView())
  • TabularUnified trunk/Source/WebCore/page/FrameView.h

    r170325 r170557  
    291291
    292292    void disableLayerFlushThrottlingTemporarilyForInteraction();
    293     void updateLayerFlushThrottlingInAllFrames();
    294     void adjustTiledBackingCoverage();
    295293    bool speculativeTilingEnabled() const { return m_speculativeTilingEnabled; }
     294    void loadProgressingStatusChanged();
    296295
    297296#if ENABLE(DASHBOARD_SUPPORT)
     
    545544    void autoSizeIfEnabled();
    546545
     546    void updateLayerFlushThrottling();
     547    void adjustTiledBackingCoverage();
     548
    547549    virtual void repaintContentRectangle(const IntRect&) override;
    548550    virtual void contentsResized() override;
  • TabularUnified trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r170541 r170557  
    4646#include "NodeList.h"
    4747#include "Page.h"
    48 #include "ProgressTracker.h"
    4948#include "RenderEmbeddedObject.h"
    5049#include "RenderFlowThread.h"
     
    285284    , m_rootLayerAttachment(RootLayerUnattached)
    286285    , m_layerFlushTimer(this, &RenderLayerCompositor::layerFlushTimerFired)
    287     , m_layerFlushThrottlingEnabled(page() && page()->progress().isMainLoadProgressing())
     286    , m_layerFlushThrottlingEnabled(false)
    288287    , m_layerFlushThrottlingTemporarilyDisabledForInteraction(false)
    289288    , m_hasPendingLayerFlush(false)
  • TabularUnified trunk/Source/WebKit2/ChangeLog

    r170554 r170557  
     12014-06-27  Antti Koivisto  <antti@apple.com>
     2
     3        Flush throttling with remote layers
     4        https://bugs.webkit.org/show_bug.cgi?id=134398
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     9        (WebKit::WebChromeClient::adjustLayerFlushThrottling):
     10        * WebProcess/WebCoreSupport/WebChromeClient.h:
     11        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
     12        * WebProcess/WebPage/DrawingArea.h:
     13        (WebKit::DrawingArea::adjustLayerFlushThrottling):
     14        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
     15        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
     16        (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
     17        (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect):
     18        (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
     19
     20            Delay layer flushes during page loading.
     21            If use interacts with the page the next flush in unthrottled even if loading is in progress.
     22
     23        (WebKit::RemoteLayerTreeDrawingArea::adjustLayerFlushThrottling):
     24       
     25            Compute the new delay. The first visual flush uses a shorter delay.
     26            Flush immediately when we are no longer throttling.
     27
     28        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     29        (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect):
     30
    1312014-06-27  Joseph Pecoraro  <pecoraro@apple.com>
    232
  • TabularUnified trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r170320 r170557  
    844844}
    845845
     846bool WebChromeClient::adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags flags)
     847{
     848    return m_page->drawingArea() && m_page->drawingArea()->adjustLayerFlushThrottling(flags);
     849}
    846850
    847851bool WebChromeClient::layerTreeStateIsFrozen() const
  • TabularUnified trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r169625 r170557  
    211211    virtual void setNeedsOneShotDrawingSynchronization() override;
    212212    virtual void scheduleCompositingLayerFlush() override;
     213    virtual bool adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags) override;
    213214    virtual WebCore::GraphicsLayer* documentOverlayLayerForFrame(WebCore::Frame&) override;
    214215
  • TabularUnified trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm

    r169625 r170557  
    2929#if PLATFORM(IOS)
    3030
    31 #import <WebCore/NotImplemented.h>
     31#import "DrawingArea.h"
    3232#import "WebCoreArgumentCoders.h"
    3333#import "WebFrame.h"
    3434#import "WebPage.h"
    3535#import "WebPageProxyMessages.h"
     36#import <WebCore/NotImplemented.h>
    3637
    3738namespace WebKit {
  • TabularUnified trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h

    r170348 r170557  
    3131#include <WebCore/FloatRect.h>
    3232#include <WebCore/IntRect.h>
     33#include <WebCore/LayerFlushThrottleState.h>
    3334#include <WebCore/PlatformScreen.h>
    3435#include <WebCore/ViewState.h>
     
    120121    virtual bool markLayersVolatileImmediatelyIfPossible() { return true; }
    121122
     123    virtual bool adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags) { return false; }
     124
    122125protected:
    123126    DrawingArea(DrawingAreaType, WebPage&);
  • TabularUnified trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h

    r170325 r170557  
    100100    virtual void viewStateDidChange(WebCore::ViewState::Flags changed, bool wantsDidUpdateViewState) override;
    101101
     102    virtual bool adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags) override;
     103
    102104    // GraphicsLayerClient
    103105    virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) override { }
     
    144146    bool m_isFlushingSuspended;
    145147    bool m_hasDeferredFlush;
     148    bool m_isThrottlingLayerFlushes;
     149    bool m_isLayerFlushThrottlingTemporarilyDisabledForInteraction;
     150    bool m_isInitialThrottledLayerFlush;
    146151
    147152    bool m_waitingForBackingStoreSwap;
  • TabularUnified trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm

    r170377 r170557  
    6060    , m_isFlushingSuspended(false)
    6161    , m_hasDeferredFlush(false)
     62    , m_isThrottlingLayerFlushes(false)
     63    , m_isLayerFlushThrottlingTemporarilyDisabledForInteraction(false)
     64    , m_isInitialThrottledLayerFlush(false)
    6265    , m_waitingForBackingStoreSwap(false)
    6366    , m_hadFlushDeferredWhileWaitingForBackingStoreSwap(false)
     
    227230
    228231    frameView->setExposedRect(m_scrolledExposedRect);
    229     frameView->adjustTiledBackingCoverage();
    230232
    231233    m_webPage.pageOverlayController().didChangeExposedRect();
     
    240242void RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush()
    241243{
     244    if (m_isFlushingSuspended) {
     245        m_isLayerFlushThrottlingTemporarilyDisabledForInteraction = false;
     246        m_hasDeferredFlush = true;
     247        return;
     248    }
     249    if (m_isLayerFlushThrottlingTemporarilyDisabledForInteraction) {
     250        m_isLayerFlushThrottlingTemporarilyDisabledForInteraction = false;
     251        m_layerFlushTimer.startOneShot(0_ms);
     252        return;
     253    }
     254
    242255    if (m_layerFlushTimer.isActive())
    243256        return;
    244257
    245     m_layerFlushTimer.startOneShot(0);
     258    const auto initialFlushDelay = 500_ms;
     259    const auto flushDelay = 1500_ms;
     260    auto throttleDelay = m_isThrottlingLayerFlushes ? (m_isInitialThrottledLayerFlush ? initialFlushDelay : flushDelay) : 0_ms;
     261    m_isInitialThrottledLayerFlush = false;
     262
     263    m_layerFlushTimer.startOneShot(throttleDelay);
     264}
     265
     266bool RemoteLayerTreeDrawingArea::adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags flags)
     267{
     268    if (flags & WebCore::LayerFlushThrottleState::UserIsInteracting)
     269        m_isLayerFlushThrottlingTemporarilyDisabledForInteraction = true;
     270
     271    bool wasThrottlingLayerFlushes = m_isThrottlingLayerFlushes;
     272    m_isThrottlingLayerFlushes = flags & WebCore::LayerFlushThrottleState::MainLoadProgressing;
     273
     274    if (!wasThrottlingLayerFlushes && m_isThrottlingLayerFlushes)
     275        m_isInitialThrottledLayerFlush = true;
     276
     277    // Re-schedule the flush if we stopped throttling.
     278    if (wasThrottlingLayerFlushes && !m_isThrottlingLayerFlushes && m_layerFlushTimer.isActive()) {
     279        m_layerFlushTimer.stop();
     280        scheduleCompositingLayerFlush();
     281    }
     282    return true;
    246283}
    247284
  • TabularUnified trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r170514 r170557  
    359359
    360360    frameView->setExposedRect(m_scrolledExposedRect);
    361     frameView->adjustTiledBackingCoverage();
    362361
    363362    m_webPage.pageOverlayController().didChangeExposedRect();
Note: See TracChangeset for help on using the changeset viewer.