Changeset 87832 in webkit


Ignore:
Timestamp:
Jun 1, 2011 11:41:23 AM (13 years ago)
Author:
Adam Roben
Message:

Delete a bunch of dead code in DrawingAreaImpl

LayerTreeHost::participatesInDisplay always returns false now, which means a bunch of code
in DrawingAreaImpl no longer runs.

Cleanup after fixing <http://webkit.org/b/58054>
<rdar://problem/9249839> REGRESSION (WebKit2): Accelerated CSS animations have a lower
framerate than in WebKit1

Reviewed by Anders Carlsson.

  • WebProcess/WebPage/DrawingAreaImpl.cpp:

(WebKit::DrawingAreaImpl::forceRepaint):
(WebKit::DrawingAreaImpl::layerHostDidFlushLayers):
(WebKit::DrawingAreaImpl::sendDidUpdateBackingStoreState):
(WebKit::DrawingAreaImpl::didUpdate):
(WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode):
(WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode):
(WebKit::DrawingAreaImpl::scheduleDisplay):
(WebKit::DrawingAreaImpl::displayTimerFired):
(WebKit::DrawingAreaImpl::display):

  • WebProcess/WebPage/DrawingAreaImpl.h:
  • WebProcess/WebPage/LayerTreeHost.h:

Reverted r82959.

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r87831 r87832  
     12011-06-01  Adam Roben  <aroben@apple.com>
     2
     3        Delete a bunch of dead code in DrawingAreaImpl
     4
     5        LayerTreeHost::participatesInDisplay always returns false now, which means a bunch of code
     6        in DrawingAreaImpl no longer runs.
     7
     8        Cleanup after fixing <http://webkit.org/b/58054>
     9        <rdar://problem/9249839> REGRESSION (WebKit2): Accelerated CSS animations have a lower
     10        framerate than in WebKit1
     11
     12        Reviewed by Anders Carlsson.
     13
     14        * WebProcess/WebPage/DrawingAreaImpl.cpp:
     15        (WebKit::DrawingAreaImpl::forceRepaint):
     16        (WebKit::DrawingAreaImpl::layerHostDidFlushLayers):
     17        (WebKit::DrawingAreaImpl::sendDidUpdateBackingStoreState):
     18        (WebKit::DrawingAreaImpl::didUpdate):
     19        (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode):
     20        (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode):
     21        (WebKit::DrawingAreaImpl::scheduleDisplay):
     22        (WebKit::DrawingAreaImpl::displayTimerFired):
     23        (WebKit::DrawingAreaImpl::display):
     24        * WebProcess/WebPage/DrawingAreaImpl.h:
     25        * WebProcess/WebPage/LayerTreeHost.h:
     26        Reverted r82959.
     27
    1282011-06-01  Adam Roben  <aroben@apple.com>
    229
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp

    r87755 r87832  
    186186            layerHostDidFlushLayers();
    187187        }
    188         if (!m_layerTreeHost->participatesInDisplay())
    189             return;
     188        return;
    190189    }
    191190
     
    218217}
    219218
    220 void DrawingAreaImpl::setLayerHostNeedsDisplay()
    221 {
    222     ASSERT(m_layerTreeHost);
    223     ASSERT(m_layerTreeHost->participatesInDisplay());
    224     scheduleDisplay();
    225 }
    226 
    227219void DrawingAreaImpl::layerHostDidFlushLayers()
    228220{
     
    236228    }
    237229
    238     if (!m_layerTreeHost || m_layerTreeHost->participatesInDisplay()) {
    239         // When the layer tree host participates in display, we never tell the UI process about
    240         // accelerated compositing. From the UI process's point of view, we're still just sending
    241         // it a series of bitmaps in Update messages.
    242         return;
    243     }
     230    if (!m_layerTreeHost)
     231        return;
    244232
    245233#if USE(ACCELERATED_COMPOSITING)
     
    356344    UpdateInfo updateInfo;
    357345
    358     if (!m_isPaintingSuspended && (!m_layerTreeHost || m_layerTreeHost->participatesInDisplay()))
     346    if (!m_isPaintingSuspended && !m_layerTreeHost)
    359347        display(updateInfo);
    360348
    361349    LayerTreeContext layerTreeContext;
    362350
    363     if (m_isPaintingSuspended || (m_layerTreeHost && !m_layerTreeHost->participatesInDisplay())) {
     351    if (m_isPaintingSuspended || m_layerTreeHost) {
    364352        updateInfo.viewSize = m_webPage->size();
    365353
     
    384372    // We might get didUpdate messages from the UI process even after we've
    385373    // entered accelerated compositing mode. Ignore them.
    386     if (m_layerTreeHost && !m_layerTreeHost->participatesInDisplay())
     374    if (m_layerTreeHost)
    387375        return;
    388376
     
    438426    m_scrollRect = IntRect();
    439427    m_scrollOffset = IntSize();
    440 
    441     if (!m_layerTreeHost->participatesInDisplay()) {
    442         m_displayTimer.stop();
    443         m_isWaitingForDidUpdate = false;
    444     }
     428    m_displayTimer.stop();
     429    m_isWaitingForDidUpdate = false;
    445430}
    446431
     
    456441
    457442    ASSERT(m_layerTreeHost);
    458 
    459     bool wasParticipatingInDisplay = m_layerTreeHost->participatesInDisplay();
    460443
    461444    m_layerTreeHost->invalidate();
     
    478461
    479462#if USE(ACCELERATED_COMPOSITING)
    480     if (wasParticipatingInDisplay) {
    481         // When the layer tree host participates in display, we never tell the UI process about
    482         // accelerated compositing. From the UI process's point of view, we're still just sending
    483         // it a series of bitmaps in Update messages.
     463    // Send along a complete update of the page so we can paint the contents right after we exit the
     464    // accelerated compositing mode, eliminiating flicker.
     465    if (m_compositingAccordingToProxyMessages) {
     466        m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(m_backingStoreStateID, updateInfo));
     467        m_compositingAccordingToProxyMessages = false;
     468    } else {
     469        // If we left accelerated compositing mode before we sent an EnterAcceleratedCompositingMode message to the
     470        // UI process, we still need to let it know about the new contents, so send an Update message.
    484471        m_webPage->send(Messages::DrawingAreaProxy::Update(m_backingStoreStateID, updateInfo));
    485     } else {
    486         // Send along a complete update of the page so we can paint the contents right after we exit the
    487         // accelerated compositing mode, eliminiating flicker.
    488         if (m_compositingAccordingToProxyMessages) {
    489             m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(m_backingStoreStateID, updateInfo));
    490             m_compositingAccordingToProxyMessages = false;
    491         } else {
    492             // If we left accelerated compositing mode before we sent an EnterAcceleratedCompositingMode message to the
    493             // UI process, we still need to let it know about the new contents, so send an Update message.
    494             m_webPage->send(Messages::DrawingAreaProxy::Update(m_backingStoreStateID, updateInfo));
    495         }
    496472    }
    497473#endif
     
    513489void DrawingAreaImpl::scheduleDisplay()
    514490{
    515     ASSERT(!m_layerTreeHost || m_layerTreeHost->participatesInDisplay());
     491    ASSERT(!m_layerTreeHost);
    516492
    517493    if (m_isWaitingForDidUpdate)
     
    521497        return;
    522498
    523     if (m_layerTreeHost) {
    524         if (!m_layerTreeHost->needsDisplay())
    525             return;
    526     } else if (m_dirtyRegion.isEmpty())
    527             return;
     499    if (m_dirtyRegion.isEmpty())
     500        return;
    528501
    529502    if (m_displayTimer.isActive())
     
    543516
    544517    double timeSinceLastDisplay = currentTime() - m_lastDisplayTime;
    545     double timeUntilLayerTreeHostNeedsDisplay = m_layerTreeHost && m_layerTreeHost->participatesInDisplay() ? m_layerTreeHost->timeUntilNextDisplay() : 0;
    546     double timeUntilNextDisplay = max(minimumFrameInterval - timeSinceLastDisplay, timeUntilLayerTreeHostNeedsDisplay);
     518    double timeUntilNextDisplay = minimumFrameInterval - timeSinceLastDisplay;
    547519
    548520    if (timeUntilNextDisplay > 0) {
     
    556528void DrawingAreaImpl::display()
    557529{
    558     ASSERT(!m_layerTreeHost || m_layerTreeHost->participatesInDisplay());
     530    ASSERT(!m_layerTreeHost);
    559531    ASSERT(!m_isWaitingForDidUpdate);
    560532    ASSERT(!m_inUpdateBackingStoreState);
     
    563535        return;
    564536
    565     if (m_layerTreeHost) {
    566         if (!m_layerTreeHost->needsDisplay())
    567             return;
    568     } else if (m_dirtyRegion.isEmpty())
     537    if (m_dirtyRegion.isEmpty())
    569538        return;
    570539
     
    577546    display(updateInfo);
    578547
    579     if (m_layerTreeHost && !m_layerTreeHost->participatesInDisplay()) {
     548    if (m_layerTreeHost) {
    580549        // The call to update caused layout which turned on accelerated compositing.
    581550        // Don't send an Update message in this case.
     
    611580{
    612581    ASSERT(!m_isPaintingSuspended);
    613     ASSERT(!m_layerTreeHost || m_layerTreeHost->participatesInDisplay());
     582    ASSERT(!m_layerTreeHost);
    614583    ASSERT(!m_webPage->size().isEmpty());
    615584
     
    625594    // The layout may have put the page into accelerated compositing mode. If the LayerTreeHost is
    626595    // in charge of displaying, we have nothing more to do.
    627     if (m_layerTreeHost && !m_layerTreeHost->participatesInDisplay())
     596    if (m_layerTreeHost)
    628597        return;
    629598
    630599    updateInfo.viewSize = m_webPage->size();
    631600
    632     if (m_layerTreeHost)
    633         m_layerTreeHost->display(updateInfo);
    634     else {
    635         IntRect bounds = m_dirtyRegion.bounds();
    636         ASSERT(m_webPage->bounds().contains(bounds));
    637 
    638         RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size(), ShareableBitmap::SupportsAlpha);
    639         if (!bitmap)
    640             return;
    641 
    642         if (!bitmap->createHandle(updateInfo.bitmapHandle))
    643             return;
    644 
    645         Vector<IntRect> rects = m_dirtyRegion.rects();
    646 
    647         if (shouldPaintBoundsRect(bounds, rects)) {
    648             rects.clear();
    649             rects.append(bounds);
    650         }
    651 
    652         updateInfo.scrollRect = m_scrollRect;
    653         updateInfo.scrollOffset = m_scrollOffset;
    654 
    655         m_dirtyRegion = Region();
    656         m_scrollRect = IntRect();
    657         m_scrollOffset = IntSize();
    658 
    659         OwnPtr<GraphicsContext> graphicsContext = bitmap->createGraphicsContext();
    660        
    661         updateInfo.updateRectBounds = bounds;
    662 
    663         graphicsContext->translate(-bounds.x(), -bounds.y());
    664 
    665         for (size_t i = 0; i < rects.size(); ++i) {
    666             m_webPage->drawRect(*graphicsContext, rects[i]);
    667             if (m_webPage->hasPageOverlay())
    668                 m_webPage->drawPageOverlay(*graphicsContext, rects[i]);
    669             updateInfo.updateRects.append(rects[i]);
    670         }
     601    IntRect bounds = m_dirtyRegion.bounds();
     602    ASSERT(m_webPage->bounds().contains(bounds));
     603
     604    RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size(), ShareableBitmap::SupportsAlpha);
     605    if (!bitmap)
     606        return;
     607
     608    if (!bitmap->createHandle(updateInfo.bitmapHandle))
     609        return;
     610
     611    Vector<IntRect> rects = m_dirtyRegion.rects();
     612
     613    if (shouldPaintBoundsRect(bounds, rects)) {
     614        rects.clear();
     615        rects.append(bounds);
     616    }
     617
     618    updateInfo.scrollRect = m_scrollRect;
     619    updateInfo.scrollOffset = m_scrollOffset;
     620
     621    m_dirtyRegion = Region();
     622    m_scrollRect = IntRect();
     623    m_scrollOffset = IntSize();
     624
     625    OwnPtr<GraphicsContext> graphicsContext = bitmap->createGraphicsContext();
     626   
     627    updateInfo.updateRectBounds = bounds;
     628
     629    graphicsContext->translate(-bounds.x(), -bounds.y());
     630
     631    for (size_t i = 0; i < rects.size(); ++i) {
     632        m_webPage->drawRect(*graphicsContext, rects[i]);
     633        if (m_webPage->hasPageOverlay())
     634            m_webPage->drawPageOverlay(*graphicsContext, rects[i]);
     635        updateInfo.updateRects.append(rects[i]);
    671636    }
    672637
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h

    r87806 r87832  
    4141    virtual ~DrawingAreaImpl();
    4242
    43     void setLayerHostNeedsDisplay();
    4443    void layerHostDidFlushLayers();
    4544
  • trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h

    r87831 r87832  
    7272    virtual void resumeRendering() { }
    7373
    74     // If a derived class overrides this function to return true, the derived class must also
    75     // override the functions beneath it.
    76     virtual bool participatesInDisplay() { return false; }
    77     virtual bool needsDisplay() { ASSERT_NOT_REACHED(); return false; }
    78     virtual double timeUntilNextDisplay() { ASSERT_NOT_REACHED(); return 0; }
    79     virtual void display(UpdateInfo&) { ASSERT_NOT_REACHED(); }
    80 
    8174#if PLATFORM(WIN)
    8275    virtual void scheduleChildWindowGeometryUpdate(const WindowGeometry&) = 0;
Note: See TracChangeset for help on using the changeset viewer.