[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

andersca at apple.com andersca at apple.com
Sun Feb 20 23:18:52 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 89d8936120017c0f34ad140539c5bf27341e495f
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 19 21:56:58 2011 +0000

    2011-01-19  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Sam Weinig.
    
            Suspend/resume painting as the WKView visibility changes
            https://bugs.webkit.org/show_bug.cgi?id=52738
    
            * UIProcess/DrawingAreaProxy.h:
            (WebKit::DrawingAreaProxy::visibilityDidChange):
            Add new member function. It should really be pure virtual once setPageIsVisible
            is removed.
    
            * UIProcess/DrawingAreaProxyImpl.cpp:
            (WebKit::DrawingAreaProxyImpl::visibilityDidChange):
            Send SuspendPainting/ResumePainting messages based on whether the view is visible or not.
    
            (WebKit::DrawingAreaProxyImpl::setPageIsVisible):
            Make this a stub; it should really be removed.
    
            * UIProcess/WebPageProxy.cpp:
            (WebKit::WebPageProxy::viewStateDidChange):
            Call visibilityDidChange.
    
            * UIProcess/WebPageProxy.h:
            (WebKit::WebPageProxy::isViewVisible):
            Add new getter.
    
            * WebProcess/WebPage/DrawingArea.messages.in:
            Add SuspendPainting and ResumePainting messages.
    
            * WebProcess/WebPage/DrawingAreaImpl.cpp:
            (WebKit::DrawingAreaImpl::DrawingAreaImpl):
            Initialize m_isPaintingSuspended.
    
            (WebKit::DrawingAreaImpl::suspendPainting):
            Set m_isPaintingSuspended to true and stop the display timer.
    
            (WebKit::DrawingAreaImpl::resumePainting):
            Set m_isPaintingSuspended to false.
    
            (WebKit::DrawingAreaImpl::scheduleDisplay):
            (WebKit::DrawingAreaImpl::display):
            Bail if m_isPaintingSuspended is true.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76157 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index a19808a..54c63a3 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,47 @@
+2011-01-19  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Suspend/resume painting as the WKView visibility changes
+        https://bugs.webkit.org/show_bug.cgi?id=52738
+
+        * UIProcess/DrawingAreaProxy.h:
+        (WebKit::DrawingAreaProxy::visibilityDidChange):
+        Add new member function. It should really be pure virtual once setPageIsVisible
+        is removed.
+
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        (WebKit::DrawingAreaProxyImpl::visibilityDidChange):
+        Send SuspendPainting/ResumePainting messages based on whether the view is visible or not.
+
+        (WebKit::DrawingAreaProxyImpl::setPageIsVisible):
+        Make this a stub; it should really be removed.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::viewStateDidChange):
+        Call visibilityDidChange.
+
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::isViewVisible):
+        Add new getter.
+
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        Add SuspendPainting and ResumePainting messages.
+
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::DrawingAreaImpl):
+        Initialize m_isPaintingSuspended.
+
+        (WebKit::DrawingAreaImpl::suspendPainting):
+        Set m_isPaintingSuspended to true and stop the display timer.
+
+        (WebKit::DrawingAreaImpl::resumePainting):
+        Set m_isPaintingSuspended to false.
+
+        (WebKit::DrawingAreaImpl::scheduleDisplay):
+        (WebKit::DrawingAreaImpl::display):
+        Bail if m_isPaintingSuspended is true.
+
 2011-01-19  Andreas Kling  <kling at webkit.org>
 
         Reviewed by Simon Hausmann.
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
index 6bebe12..3eb24da 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
@@ -65,6 +65,10 @@ public:
     virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext) = 0;
 
     virtual void sizeDidChange() = 0;
+
+    // FIXME: visibilityDidChange() should be pure virtual.
+    virtual void visibilityDidChange() { }
+
     virtual void setPageIsVisible(bool isVisible) = 0;
     
 #if USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
index c5f912f..1557432 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
@@ -82,9 +82,20 @@ void DrawingAreaProxyImpl::sizeDidChange()
     sendSetSize();
 }
 
-void DrawingAreaProxyImpl::setPageIsVisible(bool pageIsVisible)
+void DrawingAreaProxyImpl::visibilityDidChange()
+{
+    if (!m_webPageProxy->isViewVisible()) {
+        // Suspend painting.
+        m_webPageProxy->process()->send(Messages::DrawingArea::SuspendPainting(), m_webPageProxy->pageID());
+        return;
+    }
+
+    // Resume painting.
+    m_webPageProxy->process()->send(Messages::DrawingArea::ResumePainting(), m_webPageProxy->pageID());
+}
+
+void DrawingAreaProxyImpl::setPageIsVisible(bool)
 {
-    // FIXME: Implement.
 }
 
 void DrawingAreaProxyImpl::attachCompositingContext(uint32_t contextID)
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
index fd0e4c3..d4c6841 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
@@ -46,6 +46,7 @@ private:
     virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
     virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext);
     virtual void sizeDidChange();
+    virtual void visibilityDidChange();
     virtual void setPageIsVisible(bool);
     virtual void attachCompositingContext(uint32_t contextID);
     virtual void detachCompositingContext();
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 2693f9a..b51581a 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -497,6 +497,7 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
         bool isVisible = m_pageClient->isViewVisible();
         if (isVisible != m_isVisible) {
             m_isVisible = isVisible;
+            m_drawingArea->visibilityDidChange();
             m_drawingArea->setPageIsVisible(isVisible);
         }
     }
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index 2435d7e..374c9f6 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -185,6 +185,7 @@ public:
     void viewStateDidChange(ViewStateFlags flags);
 
     WebCore::IntSize viewSize() const;
+    bool isViewVisible() const { return m_isVisible; }
 
     void executeEditCommand(const String& commandName);
     void validateMenuItem(const String& commandName);
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
index fb39bff..713994d 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
@@ -82,6 +82,8 @@ private:
     // FIXME: These should be pure virtual.
     virtual void setSize(const WebCore::IntSize&) { }
     virtual void didUpdate() { }
+    virtual void suspendPainting() { }
+    virtual void resumePainting() { }
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
index 6c628fb..682ef5a 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
@@ -22,5 +22,7 @@
 
 messages -> DrawingArea {
     SetSize(WebCore::IntSize size)
-    DidUpdate()    
+    DidUpdate()
+    SuspendPainting()
+    ResumePainting()
 }
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index a5dbf9a..72ed768 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -53,6 +53,7 @@ DrawingAreaImpl::~DrawingAreaImpl()
 DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParameters& parameters)
     : DrawingArea(DrawingAreaInfo::Impl, parameters.drawingAreaInfo.identifier, webPage)
     , m_isWaitingForDidUpdate(false)
+    , m_isPaintingSuspended(!parameters.isVisible)
     , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display)
 {
 }
@@ -156,11 +157,31 @@ void DrawingAreaImpl::didUpdate()
     display();
 }
 
+void DrawingAreaImpl::suspendPainting()
+{
+    ASSERT(!m_isPaintingSuspended);
+
+    m_isPaintingSuspended = true;
+    m_displayTimer.stop();
+}
+
+void DrawingAreaImpl::resumePainting()
+{
+    ASSERT(m_isPaintingSuspended);
+
+    m_isPaintingSuspended = false;
+
+    // FIXME: Repaint if needed.
+}
+
 void DrawingAreaImpl::scheduleDisplay()
 {
     if (m_isWaitingForDidUpdate)
         return;
 
+    if (m_isPaintingSuspended)
+        return;
+
     if (m_dirtyRegion.isEmpty())
         return;
 
@@ -172,6 +193,11 @@ void DrawingAreaImpl::scheduleDisplay()
 
 void DrawingAreaImpl::display()
 {
+    ASSERT(!m_isWaitingForDidUpdate);
+
+    if (m_isPaintingSuspended)
+        return;
+
     if (m_dirtyRegion.isEmpty())
         return;
 
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
index fc640eb..e008adc 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
@@ -55,6 +55,8 @@ private:
     // CoreIPC message handlers.
     virtual void setSize(const WebCore::IntSize&);
     virtual void didUpdate();
+    virtual void suspendPainting();
+    virtual void resumePainting();
 
     void scheduleDisplay();
     void display();
@@ -67,7 +69,11 @@ private:
     // Whether we're waiting for a DidUpdate message. Used for throttling paints so that the 
     // web process won't paint more frequent than the UI process can handle.
     bool m_isWaitingForDidUpdate;
-    
+
+    // Whether painting is suspended. We'll still keep track of the dirty region but we 
+    // won't paint until painting has resumed again.
+    bool m_isPaintingSuspended;
+
     RunLoop::Timer<DrawingAreaImpl> m_displayTimer;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list