2010-04-20 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Apr 2010 22:38:43 +0000 (22:38 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Apr 2010 22:38:43 +0000 (22:38 +0000)
        Reviewed by Sam Weinig.

        Don't paint the web page before we've blit the last update chunk to the backing store
        https://bugs.webkit.org/show_bug.cgi?id=37896

        * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h:
        (DrawingAreaMessage::):
        * UIProcess/mac/DrawingAreaProxyUpdateChunk.h:
        * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm:
        (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore):
        (WebKit::DrawingAreaProxyUpdateChunk::update):
        (WebKit::DrawingAreaProxyUpdateChunk::didReceiveMessage):
        * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp:
        (WebKit::DrawingAreaUpdateChunk::DrawingAreaUpdateChunk):
        (WebKit::DrawingAreaUpdateChunk::display):
        (WebKit::DrawingAreaUpdateChunk::scheduleDisplay):
        (WebKit::DrawingAreaUpdateChunk::setSize):
        (WebKit::DrawingAreaUpdateChunk::didUpdate):
        (WebKit::DrawingAreaUpdateChunk::didReceiveMessage):
        * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@57933 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit2/ChangeLog
WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h
WebKit2/UIProcess/mac/DrawingAreaProxyUpdateChunk.h
WebKit2/UIProcess/mac/DrawingAreaProxyUpdateChunk.mm
WebKit2/WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp
WebKit2/WebProcess/WebPage/mac/DrawingAreaUpdateChunk.h

index 525c453..0abf171 100644 (file)
@@ -1,5 +1,28 @@
 2010-04-20  Anders Carlsson  <andersca@apple.com>
 
+        Reviewed by Sam Weinig.
+
+        Don't paint the web page before we've blit the last update chunk to the backing store
+        https://bugs.webkit.org/show_bug.cgi?id=37896
+
+        * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h:
+        (DrawingAreaMessage::):
+        * UIProcess/mac/DrawingAreaProxyUpdateChunk.h:
+        * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm:
+        (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore):
+        (WebKit::DrawingAreaProxyUpdateChunk::update):
+        (WebKit::DrawingAreaProxyUpdateChunk::didReceiveMessage):
+        * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp:
+        (WebKit::DrawingAreaUpdateChunk::DrawingAreaUpdateChunk):
+        (WebKit::DrawingAreaUpdateChunk::display):
+        (WebKit::DrawingAreaUpdateChunk::scheduleDisplay):
+        (WebKit::DrawingAreaUpdateChunk::setSize):
+        (WebKit::DrawingAreaUpdateChunk::didUpdate):
+        (WebKit::DrawingAreaUpdateChunk::didReceiveMessage):
+        * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.h:
+
+2010-04-20  Anders Carlsson  <andersca@apple.com>
+
         Fix build.
 
         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
index cba69ec..bc09330 100644 (file)
 
 #include "MessageID.h"
 
-// Messages sent from the web process to the WebPageProxy.
+// Messages sent from the web process to the UI process.
 
 namespace DrawingAreaMessage {
 
 enum Kind {
     Initialize,
-    SetFrame
+    SetFrame,
+    
+    // Called when an update chunk sent to the drawing area has been
+    // incorporated into the backing store.
+    DidUpdate,
 };
 
 }
index 17edda8..90a50be 100644 (file)
@@ -61,6 +61,7 @@ private:
     void ensureBackingStore();
 
     void didSetSize(const WebCore::IntSize& viewSize, UpdateChunk* updateChunk);
+    void update(UpdateChunk*);
 
     bool m_isInitialized;
     bool m_isWaitingForDidSetFrameNotification;
index 7c38659..687d949 100644 (file)
@@ -136,6 +136,14 @@ void DrawingAreaProxyUpdateChunk::didSetSize(const IntSize& viewSize, UpdateChun
     page->process()->responsivenessTimer()->stop();
 }
 
+void DrawingAreaProxyUpdateChunk::update(UpdateChunk* updateChunk)
+{
+    drawUpdateChunkIntoBackingStore(updateChunk);
+    
+    WebPageProxy* page = toWK([m_webView pageRef]);
+    page->process()->connection()->send(DrawingAreaMessage::DidUpdate, page->pageID(), CoreIPC::In());
+}
+
 void DrawingAreaProxyUpdateChunk::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments)
 {
     switch (messageID.get<DrawingAreaProxyMessage::Kind>()) {
@@ -143,7 +151,7 @@ void DrawingAreaProxyUpdateChunk::didReceiveMessage(CoreIPC::Connection*, CoreIP
             UpdateChunk updateChunk;
             if (!arguments.decode(updateChunk))
                 return;
-            drawUpdateChunkIntoBackingStore(&updateChunk);
+            update(&updateChunk);
             break;
         }
         case DrawingAreaProxyMessage::DidSetFrame: {
index 5103b64..0efe9ba 100644 (file)
@@ -41,6 +41,7 @@ namespace WebKit {
 
 DrawingAreaUpdateChunk::DrawingAreaUpdateChunk(WebPage* webPage)
     : DrawingArea(DrawingAreaUpdateChunkType, webPage)
+    , m_isWaitingForUpdate(false)
     , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaUpdateChunk::display)
 {
 }
@@ -95,6 +96,8 @@ void DrawingAreaUpdateChunk::paintIntoUpdateChunk(UpdateChunk* updateChunk)
 
 void DrawingAreaUpdateChunk::display()
 {
+    ASSERT(!m_isWaitingForUpdate);
+
     if (m_dirtyRect.isEmpty())
         return;
 
@@ -110,11 +113,15 @@ void DrawingAreaUpdateChunk::display()
 
     WebProcess::shared().connection()->send(DrawingAreaProxyMessage::Update, m_webPage->pageID(), CoreIPC::In(updateChunk));
 
+    m_isWaitingForUpdate = true;
     m_displayTimer.stop();
 }
 
 void DrawingAreaUpdateChunk::scheduleDisplay()
 {
+    if (m_isWaitingForUpdate)
+        return;
+    
     if (m_displayTimer.isActive())
         return;
 
@@ -123,6 +130,9 @@ void DrawingAreaUpdateChunk::scheduleDisplay()
 
 void DrawingAreaUpdateChunk::setSize(const IntSize& viewSize)
 {
+    // We don't want to wait for an update until we display.
+    m_isWaitingForUpdate = false;
+    
     m_webPage->setSize(viewSize);
 
     // Layout if necessary.
@@ -137,6 +147,16 @@ void DrawingAreaUpdateChunk::setSize(const IntSize& viewSize)
     WebProcess::shared().connection()->send(DrawingAreaProxyMessage::DidSetFrame, m_webPage->pageID(), CoreIPC::In(viewSize, updateChunk));
 }
 
+void DrawingAreaUpdateChunk::didUpdate()
+{
+    ASSERT(m_isWaitingForUpdate);
+    
+    m_isWaitingForUpdate = false;
+
+    // Display if needed.
+    display();
+}
+
 void DrawingAreaUpdateChunk::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments)
 {
     switch (messageID.get<DrawingAreaMessage::Kind>()) {
@@ -148,6 +168,11 @@ void DrawingAreaUpdateChunk::didReceiveMessage(CoreIPC::Connection*, CoreIPC::Me
             setSize(size);
             break;
         }
+        
+        case DrawingAreaMessage::DidUpdate:
+            didUpdate();
+            break;
+
         default:
             ASSERT_NOT_REACHED();
             break;
index d6bfab9..64a28fc 100644 (file)
@@ -54,7 +54,10 @@ private:
     void scheduleDisplay();
     void setSize(const WebCore::IntSize& viewSize);
 
+    void didUpdate();
+
     WebCore::IntRect m_dirtyRect;
+    bool m_isWaitingForUpdate;
     RunLoop::Timer<DrawingAreaUpdateChunk> m_displayTimer;
 };