Changeset 58781 in webkit


Ignore:
Timestamp:
May 4, 2010 3:24:09 PM (14 years ago)
Author:
andersca@apple.com
Message:

2010-05-04 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.

[WebKit2] The web process doesn't need to paint when the web view is hidden.
https://bugs.webkit.org/show_bug.cgi?id=38549

  • Shared/CoreIPCSupport/DrawingAreaMessageKinds.h: (DrawingAreaMessage::): Add SuspendPainting/ResumePainting messages.


  • UIProcess/DrawingAreaProxyUpdateChunk.cpp: (WebKit::DrawingAreaProxyUpdateChunk::setPageIsVisible): Suspend and resume painting accordingly.


  • WebProcess/WebPage/DrawingAreaUpdateChunk.cpp: (WebKit::DrawingAreaUpdateChunk::DrawingAreaUpdateChunk): Initialize m_shouldPaint to true.


(WebKit::DrawingAreaUpdateChunk::display):
Return if m_shouldPaint is false.


(WebKit::DrawingAreaUpdateChunk::scheduleDisplay):
Ditto.


(WebKit::DrawingAreaUpdateChunk::setSize):
Assert that we should paint here.

(WebKit::DrawingAreaUpdateChunk::suspendPainting):
Set m_shouldPaint to false and stop the timer.


(WebKit::DrawingAreaUpdateChunk::resumePainting):
Set m_shouldPaint to true and paint if needed.

(WebKit::DrawingAreaUpdateChunk::didReceiveMessage):
handle SuspendPainting/ResumePainting messages.

  • WebProcess/WebPage/DrawingAreaUpdateChunk.h:
Location:
trunk/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r58720 r58781  
     12010-05-04  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        [WebKit2] The web process doesn't need to paint when the web view is hidden.
     6        https://bugs.webkit.org/show_bug.cgi?id=38549
     7
     8        * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h:
     9        (DrawingAreaMessage::):
     10        Add SuspendPainting/ResumePainting messages.
     11       
     12        * UIProcess/DrawingAreaProxyUpdateChunk.cpp:
     13        (WebKit::DrawingAreaProxyUpdateChunk::setPageIsVisible):
     14        Suspend and resume painting accordingly.
     15       
     16        * WebProcess/WebPage/DrawingAreaUpdateChunk.cpp:
     17        (WebKit::DrawingAreaUpdateChunk::DrawingAreaUpdateChunk):
     18        Initialize m_shouldPaint to true.
     19       
     20        (WebKit::DrawingAreaUpdateChunk::display):
     21        Return if m_shouldPaint is false.
     22       
     23        (WebKit::DrawingAreaUpdateChunk::scheduleDisplay):
     24        Ditto.
     25       
     26        (WebKit::DrawingAreaUpdateChunk::setSize):
     27        Assert that we should paint here.
     28
     29        (WebKit::DrawingAreaUpdateChunk::suspendPainting):
     30        Set m_shouldPaint to false and stop the timer.
     31       
     32        (WebKit::DrawingAreaUpdateChunk::resumePainting):
     33        Set m_shouldPaint to true and paint if needed.
     34
     35        (WebKit::DrawingAreaUpdateChunk::didReceiveMessage):
     36        handle SuspendPainting/ResumePainting messages.
     37
     38        * WebProcess/WebPage/DrawingAreaUpdateChunk.h:
     39
    1402010-05-03  Anders Carlsson  <andersca@apple.com>
    241
  • trunk/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h

    r58119 r58781  
    3434
    3535enum Kind {
    36     Initialize,
     36    // Called whenever the size of the drawing area needs to be updated.
    3737    SetSize,
    38    
     38
     39    // Called when the drawing area should stop painting.
     40    SuspendPainting,
     41
     42    // Called when the drawing area should start painting again.
     43    ResumePainting,
     44
    3945    // Called when an update chunk sent to the drawing area has been
    4046    // incorporated into the backing store.
  • trunk/WebKit2/UIProcess/DrawingAreaProxyUpdateChunk.cpp

    r58714 r58781  
    9595    if (!page->isValid())
    9696        return;
     97
     98    if (!m_isVisible) {
     99        // Tell the web process that it doesn't need to paint anything for now.
     100        page->process()->connection()->send(DrawingAreaMessage::SuspendPainting, page->pageID(), CoreIPC::In());
     101        return;
     102    }
    97103   
    98     // FIXME: Actually notify the web process that the visibility has changed.
     104    // The page is now visible.
     105    page->process()->connection()->send(DrawingAreaMessage::ResumePainting, page->pageID(), CoreIPC::In());
     106   
     107    // FIXME: We should request a full repaint here if needed.
    99108}
    100109   
  • trunk/WebKit2/WebProcess/WebPage/DrawingAreaUpdateChunk.cpp

    r58189 r58781  
    4141    : DrawingArea(DrawingAreaUpdateChunkType, webPage)
    4242    , m_isWaitingForUpdate(false)
     43    , m_shouldPaint(true)
    4344    , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaUpdateChunk::display)
    4445{
     
    8081{
    8182    ASSERT(!m_isWaitingForUpdate);
     83 
     84    if (!m_shouldPaint)
     85        return;
    8286
    8387    if (m_dirtyRect.isEmpty())
     
    102106void DrawingAreaUpdateChunk::scheduleDisplay()
    103107{
     108    if (!m_shouldPaint)
     109        return;
     110
    104111    if (m_isWaitingForUpdate)
    105112        return;
     
    113120void DrawingAreaUpdateChunk::setSize(const IntSize& viewSize)
    114121{
     122    ASSERT(m_shouldPaint);
    115123    ASSERT_ARG(viewSize, !viewSize.isEmpty());
    116124
     
    130138
    131139    WebProcess::shared().connection()->send(DrawingAreaProxyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(updateChunk));
     140}
     141
     142void DrawingAreaUpdateChunk::suspendPainting()
     143{
     144    ASSERT(m_shouldPaint);
     145   
     146    m_shouldPaint = false;
     147    m_displayTimer.stop();
     148}
     149
     150void DrawingAreaUpdateChunk::resumePainting()
     151{
     152    ASSERT(!m_shouldPaint);
     153   
     154    m_shouldPaint = true;
     155   
     156    // Display if needed.
     157    display();
    132158}
    133159
     
    152178        }
    153179       
     180        case DrawingAreaMessage::SuspendPainting:
     181            suspendPainting();
     182            break;
     183
     184        case DrawingAreaMessage::ResumePainting:
     185            resumePainting();
     186            break;
     187
    154188        case DrawingAreaMessage::DidUpdate:
    155189            didUpdate();
  • trunk/WebKit2/WebProcess/WebPage/DrawingAreaUpdateChunk.h

    r58189 r58781  
    5151private:
    5252    void scheduleDisplay();
     53   
     54    // CoreIPC message handlers.
    5355    void setSize(const WebCore::IntSize& viewSize);
    54 
     56    void suspendPainting();
     57    void resumePainting();
    5558    void didUpdate();
    5659
     
    6063    WebCore::IntRect m_dirtyRect;
    6164    bool m_isWaitingForUpdate;
     65    bool m_shouldPaint;
    6266    RunLoop::Timer<DrawingAreaUpdateChunk> m_displayTimer;
    6367};
Note: See TracChangeset for help on using the changeset viewer.