Get rid of LayerTreeContext::seed on Mac.
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Feb 2011 22:27:24 +0000 (22:27 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Feb 2011 22:27:24 +0000 (22:27 +0000)
Add sequence checks to enterAcceleratedCompositingMode and exitAcceleratedCompositingMode and
have them call newly added overloads that don't have the checks.

Reviewed by Dan Bernstein.

* Shared/LayerTreeContext.h:
* Shared/mac/LayerTreeContextMac.mm:
(WebKit::LayerTreeContext::LayerTreeContext):
(WebKit::LayerTreeContext::encode):
(WebKit::LayerTreeContext::decode):
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode):
(WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode):
* UIProcess/DrawingAreaProxyImpl.h:
* WebProcess/WebPage/mac/LayerTreeHostMac.mm:
(WebKit::LayerTreeHostMac::LayerTreeHostMac):

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/LayerTreeContext.h
Source/WebKit2/Shared/mac/LayerTreeContextMac.mm
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm

index 5a6b4bf..aa4a54d 100644 (file)
@@ -2,6 +2,26 @@
 
         Reviewed by Dan Bernstein.
 
+        Get rid of LayerTreeContext::seed on Mac.
+        Add sequence checks to enterAcceleratedCompositingMode and exitAcceleratedCompositingMode and
+        have them call newly added overloads that don't have the checks.
+
+        * Shared/LayerTreeContext.h:
+        * Shared/mac/LayerTreeContextMac.mm:
+        (WebKit::LayerTreeContext::LayerTreeContext):
+        (WebKit::LayerTreeContext::encode):
+        (WebKit::LayerTreeContext::decode):
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        (WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode):
+        (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode):
+        * UIProcess/DrawingAreaProxyImpl.h:
+        * WebProcess/WebPage/mac/LayerTreeHostMac.mm:
+        (WebKit::LayerTreeHostMac::LayerTreeHostMac):
+
+2011-02-03  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Dan Bernstein.
+
         Get rid of timestamps in UpdateInfo
         https://bugs.webkit.org/show_bug.cgi?id=53713
 
index a739452..dab04f3 100644 (file)
@@ -40,15 +40,12 @@ public:
     LayerTreeContext();
     ~LayerTreeContext();
 
-    static LayerTreeContext makeWithSeed();
-
     void encode(CoreIPC::ArgumentEncoder*) const;
     static bool decode(CoreIPC::ArgumentDecoder*, LayerTreeContext&);
 
     bool isEmpty() const;
 
 #if PLATFORM(MAC)
-    uint64_t seed;
     uint32_t contextID;
 #endif
 };
index a61708d..f503908 100644 (file)
@@ -32,8 +32,7 @@
 namespace WebKit {
 
 LayerTreeContext::LayerTreeContext()
-    : seed(0)
-    , contextID(0)
+    : contextID(0)
 {
 }
 
@@ -41,29 +40,17 @@ LayerTreeContext::~LayerTreeContext()
 {
 }
 
-LayerTreeContext LayerTreeContext::makeWithSeed()
-{
-    static uint64_t seed;
-
-    LayerTreeContext layerTreeContext;
-    layerTreeContext.seed = ++seed;
-    ASSERT(layerTreeContext.seed);
-
-    return layerTreeContext;
-}
-
 void LayerTreeContext::encode(CoreIPC::ArgumentEncoder* encoder) const
 {
-    encoder->encode(seed);
     encoder->encode(contextID);
 }
 
 bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder* decoder, LayerTreeContext& result)
 {
-    if (!decoder->decode(result.seed))
+    if (!decoder->decode(result.contextID))
         return false;
 
-    return decoder->decode(result.contextID);
+    return true;
 }
 
 bool LayerTreeContext::isEmpty() const
index 9f85d3b..dae5c73 100644 (file)
@@ -163,19 +163,18 @@ void DrawingAreaProxyImpl::didSetSize(uint64_t sequenceNumber, const UpdateInfo&
 
 void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext& layerTreeContext)
 {
-    ASSERT(!m_isInAcceleratedCompositingMode);
-    m_isInAcceleratedCompositingMode = true;
+    if (sequenceNumber < m_lastDidSetSizeSequenceNumber)
+        return;
 
-    m_backingStore = nullptr;
-    m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext);
+    enterAcceleratedCompositingMode(layerTreeContext);
 }
 
 void DrawingAreaProxyImpl::exitAcceleratedCompositingMode(uint64_t sequenceNumber)
 {
-    ASSERT(m_isInAcceleratedCompositingMode);
-    m_isInAcceleratedCompositingMode = false;
+    if (sequenceNumber < m_lastDidSetSizeSequenceNumber)
+        return;
 
-    m_webPageProxy->exitAcceleratedCompositingMode();
+    exitAcceleratedCompositingMode();
 }
 
 void DrawingAreaProxyImpl::incorporateUpdate(const UpdateInfo& updateInfo)
@@ -214,4 +213,21 @@ void DrawingAreaProxyImpl::sendSetSize()
     m_webPageProxy->process()->send(Messages::DrawingArea::SetSize(m_size), m_webPageProxy->pageID());
 }
 
+void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
+{
+    ASSERT(!m_isInAcceleratedCompositingMode);
+    m_isInAcceleratedCompositingMode = true;
+    
+    m_backingStore = nullptr;
+    m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext);
+}
+
+void DrawingAreaProxyImpl::exitAcceleratedCompositingMode()
+{
+    ASSERT(m_isInAcceleratedCompositingMode);
+    m_isInAcceleratedCompositingMode = false;
+    
+    m_webPageProxy->exitAcceleratedCompositingMode();
+}
+
 } // namespace WebKit
index d91ba87..ebc1e8a 100644 (file)
@@ -62,6 +62,9 @@ private:
     void incorporateUpdate(const UpdateInfo&);
     void sendSetSize();
 
+    void enterAcceleratedCompositingMode(const LayerTreeContext&);
+    void exitAcceleratedCompositingMode();
+
     // Whether we've sent a SetSize message and are now waiting for a DidSetSize message.
     // Used to throttle SetSize messages so we don't send them faster than the Web process can handle.
     bool m_isWaitingForDidSetSize;
index afce617..9b445a3 100644 (file)
@@ -45,7 +45,6 @@ PassRefPtr<LayerTreeHostMac> LayerTreeHostMac::create(WebPage* webPage, Graphics
 
 LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage, GraphicsLayer* graphicsLayer)
     : LayerTreeHost(webPage)
-    , m_layerTreeContext(LayerTreeContext::makeWithSeed())
     , m_isValid(true)
 {
     mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();