[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:51:40 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit b492e3a8ab5b76f6db816ef1c81d84764da5dc66
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 26 00:18:06 2011 +0000

    2011-01-25  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Adam Roben.
    
            Add and implement LayerTreeHost::scheduleLayerFlush
            https://bugs.webkit.org/show_bug.cgi?id=53135
    
            * WebKit2.xcodeproj/project.pbxproj:
            Add LayerTreeHostMac.mm.
    
            * WebProcess/WebPage/DrawingAreaImpl.cpp:
            (WebKit::DrawingAreaImpl::scheduleCompositingLayerSync):
            Call LayerTreeHost::scheduleLayerFlush.
    
            * WebProcess/WebPage/LayerTreeHost.cpp:
            (WebKit::LayerTreeHost::~LayerTreeHost):
            Call platformInvalidate().
    
            (WebKit::LayerTreeHost::flushPendingLayerChanges):
            Rename from syncCompositingLayers.
    
            * WebProcess/WebPage/mac/LayerTreeHostMac.mm: Added.
            (WebKit::LayerTreeHost::scheduleLayerFlush):
            Create a run loop observer if needed. This code is copied from LayerBackedDrawingAreaMac.mm
    
            (WebKit::LayerTreeHost::platformInvalidate):
            Invalidate the run loop observer.
    
            (WebKit::LayerTreeHost::flushPendingLayerChangesRunLoopObserverCallback):
            Call flushPendingChanges() and remove the run loop observer if it succeeded.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76653 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index e22f01a..5e3beed 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,5 +1,36 @@
 2011-01-25  Anders Carlsson  <andersca at apple.com>
 
+        Reviewed by Adam Roben.
+
+        Add and implement LayerTreeHost::scheduleLayerFlush
+        https://bugs.webkit.org/show_bug.cgi?id=53135
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add LayerTreeHostMac.mm.
+
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::scheduleCompositingLayerSync):
+        Call LayerTreeHost::scheduleLayerFlush.
+
+        * WebProcess/WebPage/LayerTreeHost.cpp:
+        (WebKit::LayerTreeHost::~LayerTreeHost):
+        Call platformInvalidate().
+
+        (WebKit::LayerTreeHost::flushPendingLayerChanges):
+        Rename from syncCompositingLayers.
+
+        * WebProcess/WebPage/mac/LayerTreeHostMac.mm: Added.
+        (WebKit::LayerTreeHost::scheduleLayerFlush):
+        Create a run loop observer if needed. This code is copied from LayerBackedDrawingAreaMac.mm
+
+        (WebKit::LayerTreeHost::platformInvalidate):
+        Invalidate the run loop observer.
+
+        (WebKit::LayerTreeHost::flushPendingLayerChangesRunLoopObserverCallback):
+        Call flushPendingChanges() and remove the run loop observer if it succeeded.
+
+2011-01-25  Anders Carlsson  <andersca at apple.com>
+
         Reviewed by Simon Fraser.
 
         Add LayerTreeHost class
diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 375d23e..93f22c4 100644
--- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -69,6 +69,7 @@
 		1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A119A94127B796200A9ECB1 /* MessageSender.h */; };
 		1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */; };
 		1A186EEB12EF7618008E5F37 /* LayerTreeHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A186EE912EF7618008E5F37 /* LayerTreeHost.cpp */; };
+		1A18718512EF9877008E5F37 /* LayerTreeHostMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A18718412EF9877008E5F37 /* LayerTreeHostMac.mm */; };
 		1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; };
 		1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C648611F415B700553C19 /* WebContextMac.mm */; };
 		1A1FA285127A13BC0050E709 /* NPObjectProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA284127A13BC0050E709 /* NPObjectProxy.cpp */; };
@@ -799,6 +800,7 @@
 		1A119A94127B796200A9ECB1 /* MessageSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageSender.h; sourceTree = "<group>"; };
 		1A186EE812EF7618008E5F37 /* LayerTreeHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeHost.h; sourceTree = "<group>"; };
 		1A186EE912EF7618008E5F37 /* LayerTreeHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerTreeHost.cpp; sourceTree = "<group>"; };
+		1A18718412EF9877008E5F37 /* LayerTreeHostMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayerTreeHostMac.mm; sourceTree = "<group>"; };
 		1A1C648611F415B700553C19 /* WebContextMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMac.mm; sourceTree = "<group>"; };
 		1A1FA251127A0E4F0050E709 /* NPRemoteObjectMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPRemoteObjectMap.h; sourceTree = "<group>"; };
 		1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRemoteObjectMap.cpp; sourceTree = "<group>"; };
@@ -2545,6 +2547,7 @@
 				29CD55A9128E294F00133C85 /* AccessibilityWebPageObject.mm */,
 				BC5F7BB8118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp */,
 				0F5265B511DD37700006D33C /* LayerBackedDrawingAreaMac.mm */,
+				1A18718412EF9877008E5F37 /* LayerTreeHostMac.mm */,
 				1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */,
 				BC963D6D113DD1A500574BE2 /* WebPageMac.mm */,
 			);
@@ -3544,6 +3547,7 @@
 				C574A58212E66681002DFE98 /* PasteboardTypes.mm in Sources */,
 				E134F01A12EA5D99004EC58D /* WKPrintingView.mm in Sources */,
 				1A186EEB12EF7618008E5F37 /* LayerTreeHost.cpp in Sources */,
+				1A18718512EF9877008E5F37 /* LayerTreeHostMac.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index bbd8547..70ccf26 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -134,6 +134,7 @@ void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
 
 void DrawingAreaImpl::scheduleCompositingLayerSync()
 {
+    m_layerTreeHost.scheduleLayerFlush();
 }
 
 void DrawingAreaImpl::syncCompositingLayers()
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
index 5b2bddf..fbd1373 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
@@ -45,6 +45,7 @@ LayerTreeHost::LayerTreeHost(WebPage* webPage)
 
 LayerTreeHost::~LayerTreeHost()
 {
+    platformInvalidate();
 }
 
 void LayerTreeHost::attachRootCompositingLayer(GraphicsLayer* graphicsLayer)
@@ -57,7 +58,7 @@ void LayerTreeHost::detachRootCompositingLayer()
     // FIXME: Implement.
 }
 
-bool LayerTreeHost::syncCompositingLayers()
+bool LayerTreeHost::flushPendingLayerChanges()
 {
     return m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
 }
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
index 3923ce3..b5e2628 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
@@ -50,10 +50,21 @@ public:
     void attachRootCompositingLayer(WebCore::GraphicsLayer*);
     void detachRootCompositingLayer();
 
+    void scheduleLayerFlush();
+
 private:
-    WebPage* m_webPage;
+    void platformInvalidate();
 
-    bool syncCompositingLayers();
+    bool flushPendingLayerChanges();
+
+#if PLATFORM(MAC)
+    static void flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
+    void flushPendingLayerChangesRunLoopObserverCallback();
+    
+    RetainPtr<CFRunLoopObserverRef> m_flushPendingLayerChangesRunLoopObserver;
+#endif
+
+    WebPage* m_webPage;
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
new file mode 100644
index 0000000..746cac3
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "LayerTreeHost.h"
+
+namespace WebKit {
+
+void LayerTreeHost::scheduleLayerFlush()
+{
+    CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
+    
+    // Make sure we wake up the loop or the observer could be delayed until some other source fires.
+    CFRunLoopWakeUp(currentRunLoop);
+
+    if (m_flushPendingLayerChangesRunLoopObserver)
+        return;
+
+    // Run before the Core Animation commit observer, which has order 2000000.
+    const CFIndex runLoopOrder = 2000000 - 1;
+    CFRunLoopObserverContext context = { 0, this, 0, 0, 0 };
+    m_flushPendingLayerChangesRunLoopObserver.adoptCF(CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, true, runLoopOrder, flushPendingLayerChangesRunLoopObserverCallback, &context));
+
+    CFRunLoopAddObserver(currentRunLoop, m_flushPendingLayerChangesRunLoopObserver.get(), kCFRunLoopCommonModes);
+}
+
+void LayerTreeHost::platformInvalidate()
+{
+    if (m_flushPendingLayerChangesRunLoopObserver)
+        CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+}
+
+void LayerTreeHost::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
+{
+    static_cast<LayerTreeHost*>(context)->flushPendingLayerChangesRunLoopObserverCallback();
+}
+
+void LayerTreeHost::flushPendingLayerChangesRunLoopObserverCallback()
+{
+    if (!flushPendingLayerChanges())
+        return;
+
+    // We successfully flushed the pending layer changes, remove the run loop observer.
+    ASSERT(m_flushPendingLayerChangesRunLoopObserver);
+    CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+    m_flushPendingLayerChangesRunLoopObserver = 0;
+}
+
+} // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list