Changeset 112191 in webkit


Ignore:
Timestamp:
Mar 26, 2012 7:01:42 PM (12 years ago)
Author:
nduca@chromium.org
Message:

[chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
https://bugs.webkit.org/show_bug.cgi?id=82265

Source/Platform:

Reviewed by James Robinson.

  • chromium/public/WebLayerTreeView.h:

(WebLayerTreeView):

  • chromium/public/WebLayerTreeViewClient.h:

(WebLayerTreeViewClient):
(WebKit::WebLayerTreeViewClient::didCommit):

Source/WebCore:

In threaded compositing mode, the WebWidget is self-scheduled,
receiving damage and processing it without forwarding that damage
up to the embedding WebWidgetClient. In Chromium's case, the
client uses the presence of damage to perform input flow
control. This patch exposes the need for input flow control to the
embedder, while keeping the actual logic about what exactly
warrants input flow control inside the implementation.

Reviewed by James Robinson.

  • platform/graphics/chromium/cc/CCLayerTreeHost.cpp:

(WebCore::CCLayerTreeHost::commitComplete):
(WebCore::CCLayerTreeHost::commitRequested):
(WebCore):

  • platform/graphics/chromium/cc/CCLayerTreeHost.h:

(CCLayerTreeHostClient):
(CCLayerTreeHost):

  • platform/graphics/chromium/cc/CCProxy.h:

(CCProxy):

  • platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:

(WebCore::CCSingleThreadProxy::commitRequested):
(WebCore):

  • platform/graphics/chromium/cc/CCSingleThreadProxy.h:

(CCSingleThreadProxy):

  • platform/graphics/chromium/cc/CCThreadProxy.cpp:

(WebCore::CCThreadProxy::commitRequested):
(WebCore):

  • platform/graphics/chromium/cc/CCThreadProxy.h:

(CCThreadProxy):

Source/WebKit/chromium:

In threaded compositing mode, the WebWidget is self-scheduled,
receiving damage and processing it without forwarding that damage
up to the embedding WebWidgetClient. In Chromium's case, the
client uses the presence of damage to perform input flow
control. This patch exposes the need for input flow control to the
embedder, while keeping the actual logic about what exactly
warrants input flow control inside the implementation.

Reviewed by James Robinson.

  • public/WebWidget.h:

(WebWidget):
(WebKit::WebWidget::isInputThrottled):

  • public/WebWidgetClient.h:

(WebWidgetClient):
(WebKit::WebWidgetClient::didBecomeReadyForAdditionalInput):

  • src/WebLayerTreeView.cpp:

(WebKit::WebLayerTreeView::commitRequested):
(WebKit):

  • src/WebLayerTreeViewImpl.cpp:

(WebKit::WebLayerTreeViewImpl::didCommit):
(WebKit):

  • src/WebLayerTreeViewImpl.h:

(WebLayerTreeViewImpl):

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::isInputThrottled):
(WebKit):
(WebKit::WebViewImpl::didCommit):

  • src/WebViewImpl.h:

(WebViewImpl):

  • tests/CCLayerTreeHostTest.cpp:

(WTF::MockLayerTreeHostClient::didCommit):
(MockLayerTreeHostClient):

  • tests/FakeCCLayerTreeHostClient.h:

(FakeCCLayerTreeHostClient):

Location:
trunk/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/Platform/ChangeLog

    r112059 r112191  
     12012-03-26  Nat Duca  <nduca@chromium.org>
     2
     3        [chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
     4        https://bugs.webkit.org/show_bug.cgi?id=82265
     5
     6        Reviewed by James Robinson.
     7
     8        * chromium/public/WebLayerTreeView.h:
     9        (WebLayerTreeView):
     10        * chromium/public/WebLayerTreeViewClient.h:
     11        (WebLayerTreeViewClient):
     12        (WebKit::WebLayerTreeViewClient::didCommit):
     13
    1142012-03-25  Nat Duca  <nduca@chromium.org>
    215
  • trunk/Source/Platform/chromium/public/WebLayerTreeView.h

    r110149 r112191  
    130130    WEBKIT_EXPORT void setNeedsRedraw();
    131131
     132    // Indicates whether a commit is pending.
     133    WEBKIT_EXPORT bool commitRequested() const;
     134
    132135    // Triggers a compositing pass. If the compositor thread was not
    133136    // enabled via WebCompositor::initialize, the compositing pass happens
  • trunk/Source/Platform/chromium/public/WebLayerTreeViewClient.h

    r112059 r112191  
    6060    virtual void didRebindGraphicsContext(bool success) = 0;
    6161
     62    // Indicates that a frame was committed to the impl side of the compositor
     63    // for rendering.
     64    //
     65    // FIXME: make this non-virtual when ui/compositor DEP is resolved.
     66    virtual void didCommit() { }
     67
     68    // Indicates that a frame was committed to the impl side and drawing
     69    // commands for it were issued to the GPU.
    6270    virtual void didCommitAndDrawFrame() = 0;
     71
     72    // Indicates that a frame previously issued to the GPU has completed
     73    // rendering.
    6374    virtual void didCompleteSwapBuffers() = 0;
    6475
  • trunk/Source/WebCore/ChangeLog

    r112190 r112191  
     12012-03-26  Nat Duca  <nduca@chromium.org>
     2
     3        [chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
     4        https://bugs.webkit.org/show_bug.cgi?id=82265
     5
     6        In threaded compositing mode, the WebWidget is self-scheduled,
     7        receiving damage and processing it without forwarding that damage
     8        up to the embedding WebWidgetClient. In Chromium's case, the
     9        client uses the presence of damage to perform input flow
     10        control. This patch exposes the need for input flow control to the
     11        embedder, while keeping the actual logic about what exactly
     12        warrants input flow control inside the implementation.
     13
     14        Reviewed by James Robinson.
     15
     16        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     17        (WebCore::CCLayerTreeHost::commitComplete):
     18        (WebCore::CCLayerTreeHost::commitRequested):
     19        (WebCore):
     20        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
     21        (CCLayerTreeHostClient):
     22        (CCLayerTreeHost):
     23        * platform/graphics/chromium/cc/CCProxy.h:
     24        (CCProxy):
     25        * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
     26        (WebCore::CCSingleThreadProxy::commitRequested):
     27        (WebCore):
     28        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
     29        (CCSingleThreadProxy):
     30        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
     31        (WebCore::CCThreadProxy::commitRequested):
     32        (WebCore):
     33        * platform/graphics/chromium/cc/CCThreadProxy.h:
     34        (CCThreadProxy):
     35
    1362012-03-26  Adam Barth  <abarth@webkit.org>
    237
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r112187 r112191  
    234234    clearPendingUpdate();
    235235    m_contentsTextureManager->unprotectAllTextures();
     236    m_client->didCommit();
    236237}
    237238
     
    309310    if (!CCThreadProxy::implThread())
    310311        m_client->scheduleComposite();
     312}
     313
     314bool CCLayerTreeHost::commitRequested() const
     315{
     316    return m_proxy->commitRequested();
    311317}
    312318
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

    r112187 r112191  
    5959    virtual PassRefPtr<GraphicsContext3D> createContext() = 0;
    6060    virtual void didRecreateContext(bool success) = 0;
     61    virtual void didCommit() = 0;
    6162    virtual void didCommitAndDrawFrame() = 0;
    6263    virtual void didCompleteSwapBuffers() = 0;
     
    185186    virtual void setNeedsCommit();
    186187    void setNeedsRedraw();
     188    bool commitRequested() const;
    187189
    188190    void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h

    r110252 r112191  
    8787    virtual void setVisible(bool) = 0;
    8888
     89    virtual bool commitRequested() const = 0;
     90
    8991    virtual void start() = 0; // Must be called before using the proxy.
    9092    virtual void stop() = 0; // Must be called before deleting the proxy.
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp

    r111777 r112191  
    237237}
    238238
     239bool CCSingleThreadProxy::commitRequested() const
     240{
     241    return false;
     242}
     243
    239244void CCSingleThreadProxy::setVisible(bool visible)
    240245{
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h

    r110299 r112191  
    5757    virtual void setNeedsCommit();
    5858    virtual void setNeedsRedraw();
     59    virtual bool commitRequested() const;
    5960    virtual void setVisible(bool);
    6061    virtual void start();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

    r112187 r112191  
    315315}
    316316
     317bool CCThreadProxy::commitRequested() const
     318{
     319    ASSERT(isMainThread());
     320    return m_commitRequested;
     321}
     322
    317323void CCThreadProxy::setVisible(bool visible)
    318324{
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h

    r111805 r112191  
    6666    virtual void setNeedsCommit();
    6767    virtual void setNeedsRedraw();
     68    virtual bool commitRequested() const;
    6869    virtual void setVisible(bool);
    6970    virtual void start();
  • trunk/Source/WebKit/chromium/ChangeLog

    r112182 r112191  
     12012-03-26  Nat Duca  <nduca@chromium.org>
     2
     3        [chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
     4        https://bugs.webkit.org/show_bug.cgi?id=82265
     5
     6        In threaded compositing mode, the WebWidget is self-scheduled,
     7        receiving damage and processing it without forwarding that damage
     8        up to the embedding WebWidgetClient. In Chromium's case, the
     9        client uses the presence of damage to perform input flow
     10        control. This patch exposes the need for input flow control to the
     11        embedder, while keeping the actual logic about what exactly
     12        warrants input flow control inside the implementation.
     13
     14        Reviewed by James Robinson.
     15
     16        * public/WebWidget.h:
     17        (WebWidget):
     18        (WebKit::WebWidget::isInputThrottled):
     19        * public/WebWidgetClient.h:
     20        (WebWidgetClient):
     21        (WebKit::WebWidgetClient::didBecomeReadyForAdditionalInput):
     22        * src/WebLayerTreeView.cpp:
     23        (WebKit::WebLayerTreeView::commitRequested):
     24        (WebKit):
     25        * src/WebLayerTreeViewImpl.cpp:
     26        (WebKit::WebLayerTreeViewImpl::didCommit):
     27        (WebKit):
     28        * src/WebLayerTreeViewImpl.h:
     29        (WebLayerTreeViewImpl):
     30        * src/WebViewImpl.cpp:
     31        (WebKit::WebViewImpl::isInputThrottled):
     32        (WebKit):
     33        (WebKit::WebViewImpl::didCommit):
     34        * src/WebViewImpl.h:
     35        (WebViewImpl):
     36        * tests/CCLayerTreeHostTest.cpp:
     37        (WTF::MockLayerTreeHostClient::didCommit):
     38        (MockLayerTreeHostClient):
     39        * tests/FakeCCLayerTreeHostClient.h:
     40        (FakeCCLayerTreeHostClient):
     41
    1422012-03-26  Vangelis Kokkevis  <vangelis@chromium.org>
    243
  • trunk/Source/WebKit/chromium/public/WebWidget.h

    r110706 r112191  
    113113    virtual void setNeedsRedraw() { }
    114114
     115    // Temporary method for the embedder to check for throttled input. When this
     116    // is true, the WebWidget is indicating that it would prefer to not receive
     117    // additional input events until
     118    // WebWidgetClient::didBecomeReadyForAdditionalInput is called.
     119    //
     120    // This method will be removed when the WebWidget inversion patch lands ---
     121    // http://crbug.com/112837
     122    virtual bool isInputThrottled() const { return false; }
     123
    115124    // Called to inform the WebWidget of a change in theme.
    116125    // Implementors that cache rendered copies of widgets need to re-render
  • trunk/Source/WebKit/chromium/public/WebWidgetClient.h

    r112059 r112191  
    6868    // frame. This is primarily to signal to flow control mechanisms that a
    6969    // frame is beginning, not to perform actual painting work.
    70     //
    71     // FIXME: Make pure virtual once upstream deps are satisfied.
    7270    virtual void willBeginCompositorFrame() { }
     71
     72    // Indicates to the embedder that the WebWidget is ready for additional
     73    // input.
     74    virtual void didBecomeReadyForAdditionalInput() { }
    7375
    7476    // Called for compositing mode when the draw commands for a WebKit-side
  • trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp

    r109411 r112191  
    123123}
    124124
     125bool WebLayerTreeView::commitRequested() const
     126{
     127    return m_private->commitRequested();
     128}
     129
    125130void WebLayerTreeView::composite()
    126131{
  • trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp

    r112059 r112191  
    102102}
    103103
     104void WebLayerTreeViewImpl::didCommit()
     105{
     106    if (m_client)
     107        m_client->didCommit();
     108}
     109
    104110void WebLayerTreeViewImpl::didCommitAndDrawFrame()
    105111{
  • trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h

    r112059 r112191  
    4848    virtual PassRefPtr<WebCore::GraphicsContext3D> createContext();
    4949    virtual void didRecreateContext(bool success);
     50    virtual void didCommit();
    5051    virtual void didCommitAndDrawFrame();
    5152    virtual void didCompleteSwapBuffers();
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r112059 r112191  
    14981498}
    14991499
     1500bool WebViewImpl::isInputThrottled() const
     1501{
     1502#if USE(ACCELERATED_COMPOSITING)
     1503    if (!m_layerTreeView.isNull() && isAcceleratedCompositingActive())
     1504        return m_layerTreeView.commitRequested();
     1505#endif
     1506    return false;
     1507}
     1508
    15001509void WebViewImpl::loseCompositorContext(int numTimes)
    15011510{
     
    33503359}
    33513360
     3361void WebViewImpl::didCommit()
     3362{
     3363    if (m_client)
     3364        m_client->didBecomeReadyForAdditionalInput();
     3365}
     3366
    33523367void WebViewImpl::didCommitAndDrawFrame()
    33533368{
  • trunk/Source/WebKit/chromium/src/WebViewImpl.h

    r112059 r112191  
    123123    virtual void composite(bool finish);
    124124    virtual void setNeedsRedraw();
     125    virtual bool isInputThrottled() const;
    125126    virtual bool handleInputEvent(const WebInputEvent&);
    126127    virtual void mouseCaptureLost();
     
    260261    virtual WebGraphicsContext3D* createContext3D();
    261262    virtual void didRebindGraphicsContext(bool);
     263    virtual void didCommit();
    262264    virtual void didCommitAndDrawFrame();
    263265    virtual void didCompleteSwapBuffers();
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

    r112059 r112191  
    250250    }
    251251
     252    virtual void didCommit()
     253    {
     254    }
     255
    252256    virtual void didCommitAndDrawFrame()
    253257    {
  • trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h

    r112059 r112191  
    4545    }
    4646    virtual void didRecreateContext(bool success) { }
     47    virtual void didCommit() { }
    4748    virtual void didCommitAndDrawFrame() { }
    4849    virtual void didCompleteSwapBuffers() { }
Note: See TracChangeset for help on using the changeset viewer.