Title: [137921] trunk
Revision
137921
Author
[email protected]
Date
2012-12-17 10:44:44 -0800 (Mon, 17 Dec 2012)

Log Message

Source/WebKit/chromium: [chromium] Move ownership of WebLayerTreeView to WebWidgetClient
https://bugs.webkit.org/show_bug.cgi?id=105071

Patch by James Robinson <[email protected]> on 2012-12-17
Reviewed by Adrienne Walker.

This moves ownership of a given WebWidget's WebLayerTreeView from WebViewImpl out to the embedder by way of
WebWidgetClient. To deal with the two-sided nature of the patch, if construction by the new path fails
WebViewImpl constructs a WebLayerTreeView by the old path, which means it keeps ownership.

* public/WebWidgetClient.h:
(WebWidgetClient):
(WebKit::WebWidgetClient::initializeLayerTreeView):
(WebKit::WebWidgetClient::layerTreeView):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):
(WebKit::WebViewImpl::~WebViewImpl):
(WebKit::WebViewImpl::webLayerTreeView):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
* src/WebViewImpl.h:

Tools: [chromium] Move creation of WebLayerTreeView to WebWidgetClient
https://bugs.webkit.org/show_bug.cgi?id=105071

Patch by James Robinson <[email protected]> on 2012-12-17
Reviewed by Adrienne Walker.

Update WebViewHost for the new WebWidgetClient interface.

* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::initializeLayerTreeView):
(WebViewHost::layerTreeView):
(WebViewHost::~WebViewHost):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (137920 => 137921)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-12-17 18:27:28 UTC (rev 137920)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-12-17 18:44:44 UTC (rev 137921)
@@ -1,3 +1,25 @@
+2012-12-17  James Robinson  <[email protected]>
+
+        [chromium] Move ownership of WebLayerTreeView to WebWidgetClient
+        https://bugs.webkit.org/show_bug.cgi?id=105071
+
+        Reviewed by Adrienne Walker.
+
+        This moves ownership of a given WebWidget's WebLayerTreeView from WebViewImpl out to the embedder by way of
+        WebWidgetClient. To deal with the two-sided nature of the patch, if construction by the new path fails
+        WebViewImpl constructs a WebLayerTreeView by the old path, which means it keeps ownership.
+
+        * public/WebWidgetClient.h:
+        (WebWidgetClient):
+        (WebKit::WebWidgetClient::initializeLayerTreeView):
+        (WebKit::WebWidgetClient::layerTreeView):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl):
+        (WebKit::WebViewImpl::~WebViewImpl):
+        (WebKit::WebViewImpl::webLayerTreeView):
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        * src/WebViewImpl.h:
+
 2012-12-17  Pavel Feldman  <[email protected]>
 
         Web Inspector: [chromium] make toolbar render with Mountain Lion-friendly colors

Modified: trunk/Source/WebKit/chromium/public/WebWidgetClient.h (137920 => 137921)


--- trunk/Source/WebKit/chromium/public/WebWidgetClient.h	2012-12-17 18:27:28 UTC (rev 137920)
+++ trunk/Source/WebKit/chromium/public/WebWidgetClient.h	2012-12-17 18:44:44 UTC (rev 137921)
@@ -35,6 +35,7 @@
 #include "WebScreenInfo.h"
 #include "platform/WebCommon.h"
 #include "platform/WebRect.h"
+#include <public/WebLayerTreeView.h>
 
 namespace WebKit {
 
@@ -64,6 +65,15 @@
     virtual void didActivateCompositor(int inputHandlerIdentifier) { }
     virtual void didDeactivateCompositor() { }
 
+    // Attempt to initialize compositing for this widget using the given
+    // parameters. If this is successful, layerTreeView() will return a valid
+    // WebLayerTreeView. If not, nothing happens.
+    virtual void initializeLayerTreeView(WebLayerTreeViewClient*, const WebLayer& rootLayer, const WebLayerTreeView::Settings&) { }
+
+    // Return a compositing view used for this widget. This is owned by the
+    // WebWidgetClient.
+    virtual WebLayerTreeView* layerTreeView() { return 0; }
+
     // Indicates to the embedder that the compositor is about to begin a
     // frame. This is primarily to signal to flow control mechanisms that a
     // frame is beginning, not to perform actual painting work.

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (137920 => 137921)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-12-17 18:27:28 UTC (rev 137920)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-12-17 18:44:44 UTC (rev 137921)
@@ -418,6 +418,8 @@
     , m_isCancelingFullScreen(false)
     , m_benchmarkSupport(this)
 #if USE(ACCELERATED_COMPOSITING)
+    , m_layerTreeView(0)
+    , m_ownsLayerTreeView(false)
     , m_rootLayer(0)
     , m_rootGraphicsLayer(0)
     , m_isAcceleratedCompositingActive(false)
@@ -509,6 +511,8 @@
 
 WebViewImpl::~WebViewImpl()
 {
+    if (m_ownsLayerTreeView)
+        delete m_layerTreeView;
     ASSERT(!m_page);
 }
 
@@ -1731,7 +1735,7 @@
 
 WebLayerTreeView* WebViewImpl::webLayerTreeView()
 {
-    return m_layerTreeView.get();
+    return m_layerTreeView;
 }
 
 void WebViewImpl::animate(double)
@@ -4027,7 +4031,12 @@
         m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
         m_nonCompositedContentHost->setOpaque(!isTransparent());
 
-        m_layerTreeView = adoptPtr(Platform::current()->compositorSupport()->createLayerTreeView(this, *m_rootLayer, layerTreeViewSettings));
+        m_client->initializeLayerTreeView(this, *m_rootLayer, layerTreeViewSettings);
+        m_layerTreeView = m_client->layerTreeView();
+        if (!m_layerTreeView) {
+            m_layerTreeView = Platform::current()->compositorSupport()->createLayerTreeView(this, *m_rootLayer, layerTreeViewSettings);
+            m_ownsLayerTreeView = true;
+        }
         if (m_layerTreeView) {
             if (m_webSettings->applyDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) {
                 ASSERT(page()->deviceScaleFactor());

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (137920 => 137921)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-12-17 18:27:28 UTC (rev 137920)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-12-17 18:44:44 UTC (rev 137921)
@@ -837,7 +837,8 @@
 #if USE(ACCELERATED_COMPOSITING)
     WebCore::IntRect m_rootLayerScrollDamage;
     OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;
-    OwnPtr<WebLayerTreeView> m_layerTreeView;
+    WebLayerTreeView* m_layerTreeView;
+    bool m_ownsLayerTreeView;
     WebLayer* m_rootLayer;
     WebCore::GraphicsLayer* m_rootGraphicsLayer;
     bool m_isAcceleratedCompositingActive;

Modified: trunk/Tools/ChangeLog (137920 => 137921)


--- trunk/Tools/ChangeLog	2012-12-17 18:27:28 UTC (rev 137920)
+++ trunk/Tools/ChangeLog	2012-12-17 18:44:44 UTC (rev 137921)
@@ -1,3 +1,19 @@
+2012-12-17  James Robinson  <[email protected]>
+
+        [chromium] Move creation of WebLayerTreeView to WebWidgetClient
+        https://bugs.webkit.org/show_bug.cgi?id=105071
+
+        Reviewed by Adrienne Walker.
+
+        Update WebViewHost for the new WebWidgetClient interface.
+
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::initializeLayerTreeView):
+        (WebViewHost::layerTreeView):
+        (WebViewHost::~WebViewHost):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebViewHost):
+
 2012-12-17  Kenneth Rohde Christiansen  <[email protected]>
 
         [EFL][WK2] window_create doesn't receive the url

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (137920 => 137921)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-12-17 18:27:28 UTC (rev 137920)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-12-17 18:44:44 UTC (rev 137921)
@@ -689,6 +689,16 @@
     setWindowRect(WebRect(0, 0, newSize.width, newSize.height));
 }
 
+void WebViewHost::initializeLayerTreeView(WebLayerTreeViewClient* client, const WebLayer& rootLayer, const WebLayerTreeView::Settings& settings)
+{
+    m_layerTreeView = adoptPtr(Platform::current()->compositorSupport()->createLayerTreeView(client, rootLayer, settings));
+}
+
+WebLayerTreeView* WebViewHost::layerTreeView()
+{
+    return m_layerTreeView.get();
+}
+
 void WebViewHost::scheduleAnimation()
 {
     if (webView()->settings()->scrollAnimatorEnabled())
@@ -1437,6 +1447,7 @@
          it < m_popupmenus.end(); ++it)
         (*it)->close();
 
+    m_layerTreeView.clear();
     webWidget()->close();
     if (m_inModalLoop)
         webkit_support::QuitMessageLoop();

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (137920 => 137921)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2012-12-17 18:27:28 UTC (rev 137920)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2012-12-17 18:44:44 UTC (rev 137921)
@@ -211,6 +211,8 @@
 
     // WebKit::WebWidgetClient
     virtual void didAutoResize(const WebKit::WebSize& newSize);
+    virtual void initializeLayerTreeView(WebKit::WebLayerTreeViewClient*, const WebKit::WebLayer& rootLayer, const WebKit::WebLayerTreeView::Settings&);
+    virtual WebKit::WebLayerTreeView* layerTreeView();
     virtual void scheduleAnimation();
     virtual void didFocus();
     virtual void didBlur();
@@ -463,6 +465,8 @@
 
     // For web intents: holds the current request, if any.
     WebKit::WebIntentRequest m_currentRequest;
+
+    OwnPtr<WebKit::WebLayerTreeView> m_layerTreeView;
 };
 
 #endif // WebViewHost_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to