Title: [134656] trunk/Source/WebKit2
Revision
134656
Author
ander...@apple.com
Date
2012-11-14 13:16:41 -0800 (Wed, 14 Nov 2012)

Log Message

More steps towards actually hosting layers in the UI process
https://bugs.webkit.org/show_bug.cgi?id=102275

Reviewed by Andreas Kling.

* Shared/mac/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::rootLayerID):
Add a getter for the root layer ID.

* UIProcess/mac/RemoteLayerTreeHost.h:
(RemoteLayerTreeHost):
Add root layer member variable. Make the RemoteLayerTreeHost class a GraphicsLayerClient.

* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost):
Initialize the root layer to null.

(WebKit::RemoteLayerTreeHost::notifyAnimationStarted):
(WebKit::RemoteLayerTreeHost::notifyFlushRequired):
(WebKit::RemoteLayerTreeHost::paintContents):
Add empty stubs.

(WebKit::RemoteLayerTreeHost::commit):
Try to get the root layer.

(WebKit::RemoteLayerTreeHost::getOrCreateLayer):
Look up the layer with the given ID in the m_layers hash table and create it if it doesn't exist.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (134655 => 134656)


--- trunk/Source/WebKit2/ChangeLog	2012-11-14 21:05:40 UTC (rev 134655)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-14 21:16:41 UTC (rev 134656)
@@ -1,3 +1,33 @@
+2012-11-14  Anders Carlsson  <ander...@apple.com>
+
+        More steps towards actually hosting layers in the UI process
+        https://bugs.webkit.org/show_bug.cgi?id=102275
+
+        Reviewed by Andreas Kling.
+
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        (WebKit::RemoteLayerTreeTransaction::rootLayerID):
+        Add a getter for the root layer ID.
+
+        * UIProcess/mac/RemoteLayerTreeHost.h:
+        (RemoteLayerTreeHost):
+        Add root layer member variable. Make the RemoteLayerTreeHost class a GraphicsLayerClient.
+
+        * UIProcess/mac/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost):
+        Initialize the root layer to null.
+
+        (WebKit::RemoteLayerTreeHost::notifyAnimationStarted):
+        (WebKit::RemoteLayerTreeHost::notifyFlushRequired):
+        (WebKit::RemoteLayerTreeHost::paintContents):
+        Add empty stubs.
+
+        (WebKit::RemoteLayerTreeHost::commit):
+        Try to get the root layer.
+
+        (WebKit::RemoteLayerTreeHost::getOrCreateLayer):
+        Look up the layer with the given ID in the m_layers hash table and create it if it doesn't exist.
+
 2012-11-14  Brady Eidson  <beid...@apple.com>
 
         Fix the Production build after r134640 broke it.

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (134655 => 134656)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2012-11-14 21:05:40 UTC (rev 134655)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2012-11-14 21:16:41 UTC (rev 134656)
@@ -70,6 +70,7 @@
     void encode(CoreIPC::ArgumentEncoder&) const;
     static bool decode(CoreIPC::ArgumentDecoder*, RemoteLayerTreeTransaction&);
 
+    uint64_t rootLayerID() const { return m_rootLayerID; }
     void setRootLayerID(uint64_t rootLayerID);
     void layerPropertiesChanged(const RemoteGraphicsLayer*, unsigned changedProperties);
     void setDestroyedLayerIDs(Vector<uint64_t>);

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h (134655 => 134656)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h	2012-11-14 21:05:40 UTC (rev 134655)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h	2012-11-14 21:16:41 UTC (rev 134656)
@@ -27,13 +27,15 @@
 #define RemoteLayerTreeHost_h
 
 #include "MessageReceiver.h"
+#include <WebCore/GraphicsLayerClient.h>
+#include <wtf/HashMap.h>
 
 namespace WebKit {
 
 class RemoteLayerTreeTransaction;
 class WebPageProxy;
 
-class RemoteLayerTreeHost : CoreIPC::MessageReceiver {
+class RemoteLayerTreeHost : private CoreIPC::MessageReceiver, WebCore::GraphicsLayerClient {
 public:
     explicit RemoteLayerTreeHost(WebPageProxy*);
     ~RemoteLayerTreeHost();
@@ -42,13 +44,23 @@
     // CoreIPC::MessageReceiver.
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
 
+    // WebCore::GraphicsLayerClient.
+    virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) OVERRIDE;
+    virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) OVERRIDE;
+    virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect) OVERRIDE;
+
     // Implemented in generated RemoteLayerTreeHostMessageReceiver.cpp
     void didReceiveRemoteLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
 
     // Message handlers.
     void commit(const RemoteLayerTreeTransaction&);
 
+    WebCore::GraphicsLayer* getOrCreateLayer(uint64_t layerID);
+
     WebPageProxy* m_webPageProxy;
+
+    WebCore::GraphicsLayer* m_rootLayer;
+    HashMap<uint64_t, OwnPtr<WebCore::GraphicsLayer>> m_layers;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (134655 => 134656)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2012-11-14 21:05:40 UTC (rev 134655)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2012-11-14 21:16:41 UTC (rev 134656)
@@ -30,11 +30,15 @@
 #include "RemoteLayerTreeTransaction.h"
 #include "WebPageProxy.h"
 #include "WebProcessProxy.h"
+#include <WebCore/GraphicsLayer.h>
 
+using namespace WebCore;
+
 namespace WebKit {
 
 RemoteLayerTreeHost::RemoteLayerTreeHost(WebPageProxy* webPageProxy)
     : m_webPageProxy(webPageProxy)
+    , m_rootLayer(nullptr)
 {
     m_webPageProxy->process()->addMessageReceiver(Messages::RemoteLayerTreeHost::messageReceiverName(), m_webPageProxy->pageID(), this);
 }
@@ -49,12 +53,38 @@
     didReceiveRemoteLayerTreeHostMessage(connection, messageID, decoder);
 }
 
+void RemoteLayerTreeHost::notifyAnimationStarted(const GraphicsLayer*, double time)
+{
+}
+
+void RemoteLayerTreeHost::notifyFlushRequired(const GraphicsLayer*)
+{
+}
+
+void RemoteLayerTreeHost::paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&)
+{
+}
+
 void RemoteLayerTreeHost::commit(const RemoteLayerTreeTransaction& transaction)
 {
+    GraphicsLayer* rootLayer = getOrCreateLayer(transaction.rootLayerID());
+    if (m_rootLayer != rootLayer) {
+        // FIXME: Update the root layer.
+    }
+
 #ifndef NDEBUG
     // FIXME: Apply the transaction instead of dumping it to stderr.
     transaction.dump();
 #endif
 }
 
+GraphicsLayer* RemoteLayerTreeHost::getOrCreateLayer(uint64_t layerID)
+{
+    auto addResult = m_layers.add(layerID, nullptr);
+    if (addResult.isNewEntry)
+        addResult.iterator->value = GraphicsLayer::create(this);
+
+    return addResult.iterator->value.get();
+}
+
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to