Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (123253 => 123254)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-07-20 20:09:02 UTC (rev 123253)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-07-20 20:24:29 UTC (rev 123254)
@@ -1,3 +1,44 @@
+2012-07-20 Daniel Murphy <dmu...@chromium.org>
+
+ Introduce WebViewBenchmarkSupport for performance experiments on a real WebView
+ https://bugs.webkit.org/show_bug.cgi?id=88271
+
+ Reviewed by Darin Fisher.
+
+ * WebKit.gyp:
+ * public/WebView.h:
+ (WebKit):
+ (WebView):
+ (WebKit::WebView::benchmarkSupport):
+ * public/WebViewBenchmarkSupport.h: Added.
+ (WebKit):
+ (WebViewBenchmarkSupport):
+ (PaintClient):
+ (WebKit::WebViewBenchmarkSupport::PaintClient::willPaint):
+ (WebKit::WebViewBenchmarkSupport::PaintClient::didPaint):
+ (WebKit::WebViewBenchmarkSupport::PaintClient::~PaintClient):
+ (WebKit::WebViewBenchmarkSupport::~WebViewBenchmarkSupport):
+ * src/WebViewBenchmarkSupportImpl.cpp: Added.
+ (WebKit):
+ (WebKit::WebViewBenchmarkSupportImpl::paintLayer):
+ (WebKit::WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped):
+ (WebKit::WebViewBenchmarkSupportImpl::softwarePaint):
+ (WebKit::WebViewBenchmarkSupportImpl::paint):
+ * src/WebViewBenchmarkSupportImpl.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebViewBenchmarkSupportImpl):
+ (WebKit::WebViewBenchmarkSupportImpl::WebViewBenchmarkSupportImpl):
+ (WebKit::WebViewBenchmarkSupportImpl::~WebViewBenchmarkSupportImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::benchmarkSupport):
+ (WebKit):
+ (WebKit::WebViewImpl::rootGraphicsLayer):
+ * src/WebViewImpl.h:
+ (WebKit):
+ (WebViewImpl):
+
2012-07-20 Han Shen <shen...@google.com>
[Chromium] Compilation fails under gcc 4.7
Modified: trunk/Source/WebKit/chromium/WebKit.gyp (123253 => 123254)
--- trunk/Source/WebKit/chromium/WebKit.gyp 2012-07-20 20:09:02 UTC (rev 123253)
+++ trunk/Source/WebKit/chromium/WebKit.gyp 2012-07-20 20:24:29 UTC (rev 123254)
@@ -279,6 +279,7 @@
'public/WebUserMediaClient.h',
'public/WebUserMediaRequest.h',
'public/WebView.h',
+ 'public/WebViewBenchmarkSupport.h',
'public/WebViewClient.h',
'public/WebWidget.h',
'public/WebWidgetClient.h',
@@ -661,6 +662,8 @@
'src/WebTextFieldDecoratorClient.cpp',
'src/WebUserMediaRequest.cpp',
'src/WebVideoLayer.cpp',
+ 'src/WebViewBenchmarkSupportImpl.cpp',
+ 'src/WebViewBenchmarkSupportImpl.h',
'src/WebViewImpl.cpp',
'src/WebViewImpl.h',
'src/WebWorkerBase.cpp',
Modified: trunk/Source/WebKit/chromium/public/WebView.h (123253 => 123254)
--- trunk/Source/WebKit/chromium/public/WebView.h 2012-07-20 20:09:02 UTC (rev 123253)
+++ trunk/Source/WebKit/chromium/public/WebView.h 2012-07-20 20:24:29 UTC (rev 123254)
@@ -52,6 +52,7 @@
class WebPageOverlay;
class WebPermissionClient;
class WebPrerendererClient;
+class WebViewBenchmarkSupport;
class WebRange;
class WebSettings;
class WebSpellCheckClient;
@@ -457,6 +458,10 @@
// This call is relatively expensive in threaded mode as it blocks on the compositor thread.
virtual void renderingStats(WebRenderingStats&) const { }
+ // Benchmarking support --------------------------------------------
+
+ virtual WebViewBenchmarkSupport* benchmarkSupport() { return 0; }
+
// Visibility -----------------------------------------------------------
// Sets the visibility of the WebView.
Added: trunk/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h (0 => 123254)
--- trunk/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h 2012-07-20 20:24:29 UTC (rev 123254)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2012 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+ *
+ */
+
+#ifndef WebViewBenchmarkSupport_h
+#define WebViewBenchmarkSupport_h
+
+#include "platform/WebCanvas.h"
+#include "platform/WebSize.h"
+
+namespace WebKit {
+
+// Support for benchmarks accessing the WebView.
+class WebViewBenchmarkSupport {
+public:
+ enum PaintMode {
+ // Paint the entire page.
+ PaintModeEverything
+ };
+
+ // Client for creating canvases where multiple canvases
+ // may be used for layered rendering and sizes defined by the benchmark.
+ // Also contains reporting methods called by the WebViewBenchmarkSupport
+ // when painting is about to occur and when painting is complete.
+ class PaintClient {
+ public:
+ virtual WebCanvas* createCanvas(const WebSize&) = 0;
+
+ // Called by the WebViewBenchmarkSupport when painting is about to
+ // occur.
+ virtual void willPaint(const WebCanvas&) { }
+
+ // Called by the WebViewBenchmarkSupport when painting is complete.
+ virtual void didPaint(const WebCanvas&) { }
+ protected:
+ virtual ~PaintClient() { }
+ };
+
+ // Paints the web view on canvases created from the client, using the given
+ // paint mode.
+ virtual void paint(PaintClient*, PaintMode) = 0;
+
+protected:
+ virtual ~WebViewBenchmarkSupport() { }
+};
+} // namespace WebKit
+
+#endif // WebViewBenchmarkSupport_h
Added: trunk/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp (0 => 123254)
--- trunk/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp 2012-07-20 20:24:29 UTC (rev 123254)
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2012 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 "config.h"
+#include "WebViewBenchmarkSupportImpl.h"
+
+#include "FloatSize.h"
+#include "FrameView.h"
+#include "GraphicsLayer.h"
+#include "IntRect.h"
+#include "IntSize.h"
+#include "WebViewImpl.h"
+#include "painting/GraphicsContextBuilder.h"
+
+#include <public/WebCanvas.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebViewBenchmarkSupportImpl::paintLayer(PaintClient* paintClient, GraphicsLayer& layer, const IntRect& clip)
+{
+ WebSize canvasSize(clip.width(), clip.height());
+ OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize));
+ GraphicsContextBuilder builder(canvas.get());
+
+ paintClient->willPaint(*canvas.get());
+ layer.paintGraphicsLayerContents(builder.context(), clip);
+ paintClient->didPaint(*canvas.get());
+}
+
+void WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped(PaintClient* paintClient, GraphicsLayer& layer)
+{
+ FloatSize layerSize = layer.size();
+ IntRect clip(0, 0, layerSize.width(), layerSize.height());
+
+ paintLayer(paintClient, layer, clip);
+
+ const Vector<GraphicsLayer*>& children = layer.children();
+ Vector<GraphicsLayer*>::const_iterator it;
+ for (it = children.begin(); it != children.end(); ++it)
+ acceleratedPaintUnclipped(paintClient, **it);
+}
+
+void WebViewBenchmarkSupportImpl::softwarePaint(PaintClient* paintClient, PaintMode paintMode)
+{
+ WebSize size = m_webViewImpl->size();
+ WebRect paintSize;
+ switch (paintMode) {
+ case PaintModeEverything:
+ if (m_webViewImpl->page() && m_webViewImpl->page()->mainFrame()) {
+ FrameView* view = m_webViewImpl->page()->mainFrame()->view();
+ IntSize contentsSize = view->contentsSize();
+ paintSize = WebRect(0, 0, contentsSize.width(), contentsSize.height());
+ } else
+ paintSize = WebRect(0, 0, size.width, size.height);
+ break;
+ }
+
+ WebSize canvasSize(paintSize.width, paintSize.height);
+ OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize));
+ paintClient->willPaint(*canvas.get());
+ m_webViewImpl->paint(canvas.get(), paintSize);
+ paintClient->didPaint(*canvas.get());
+}
+
+void WebViewBenchmarkSupportImpl::paint(PaintClient* paintClient, PaintMode paintMode)
+{
+ m_webViewImpl->layout();
+ if (!m_webViewImpl->isAcceleratedCompositingActive())
+ return softwarePaint(paintClient, paintMode);
+ GraphicsLayer* layer = m_webViewImpl->rootGraphicsLayer();
+ switch (paintMode) {
+ case PaintModeEverything:
+ acceleratedPaintUnclipped(paintClient, *layer);
+ break;
+ }
+}
+}
Added: trunk/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h (0 => 123254)
--- trunk/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h 2012-07-20 20:24:29 UTC (rev 123254)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+ */
+
+#ifndef WebViewBenchmarkSupportImpl_h
+#define WebViewBenchmarkSupportImpl_h
+
+#include "WebViewBenchmarkSupport.h"
+
+namespace WebCore {
+class IntRect;
+class GraphicsLayer;
+}
+
+namespace WebKit {
+class WebViewImpl;
+
+class WebViewBenchmarkSupportImpl : public WebViewBenchmarkSupport {
+public:
+ explicit WebViewBenchmarkSupportImpl(WebViewImpl* webViewImpl) : m_webViewImpl(webViewImpl) { }
+ virtual ~WebViewBenchmarkSupportImpl() { }
+
+ // Paints the WebViewImpl onto canvases created from the PaintClient.
+ // If we're in accelerated mode, a new canvas is created for each graphics
+ // layer. Layout() will be called on the web view prior to painting.
+ virtual void paint(PaintClient*, PaintMode) OVERRIDE;
+
+private:
+ void paintLayer(PaintClient*, WebCore::GraphicsLayer&, const WebCore::IntRect& clip);
+
+ // Paints the given graphics layer hierarchy to canvases created by the
+ // canvas factory.
+ void acceleratedPaintUnclipped(PaintClient*, WebCore::GraphicsLayer&);
+ void softwarePaint(PaintClient*, PaintMode);
+
+ WebViewImpl* m_webViewImpl;
+};
+}
+
+#endif // WebViewBenchmarkSupportImpl_h
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (123253 => 123254)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-07-20 20:09:02 UTC (rev 123253)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-07-20 20:24:29 UTC (rev 123254)
@@ -407,6 +407,7 @@
, m_tabsToLinks(false)
, m_dragScrollTimer(adoptPtr(new DragScrollTimer))
, m_isCancelingFullScreen(false)
+ , m_benchmarkSupport(this)
#if USE(ACCELERATED_COMPOSITING)
, m_rootGraphicsLayer(0)
, m_isAcceleratedCompositingActive(false)
@@ -754,6 +755,11 @@
}
#endif
+WebViewBenchmarkSupport* WebViewImpl::benchmarkSupport()
+{
+ return &m_benchmarkSupport;
+}
+
bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event)
{
ASSERT((event.type == WebInputEvent::RawKeyDown)
@@ -3501,6 +3507,11 @@
m_layerTreeView.setBackgroundColor(webDocumentBackgroundColor);
}
+WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer()
+{
+ return m_rootGraphicsLayer;
+}
+
#if ENABLE(REQUEST_ANIMATION_FRAME)
void WebViewImpl::scheduleAnimation()
{
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (123253 => 123254)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-07-20 20:09:02 UTC (rev 123253)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-07-20 20:24:29 UTC (rev 123254)
@@ -56,6 +56,7 @@
#include "PageWidgetDelegate.h"
#include "PlatformGestureCurveTarget.h"
#include "UserMediaClientImpl.h"
+#include "WebViewBenchmarkSupportImpl.h"
#include <wtf/OwnPtr.h>
#include <wtf/RefCounted.h>
@@ -106,6 +107,7 @@
class WebGestureEvent;
class WebPagePopupImpl;
class WebPrerendererClient;
+class WebViewBenchmarkSupport;
class WebImage;
class WebKeyboardEvent;
class WebMouseEvent;
@@ -295,6 +297,7 @@
#endif
virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&);
virtual void renderingStats(WebRenderingStats&) const;
+ virtual WebViewBenchmarkSupport* benchmarkSupport();
// WebLayerTreeViewClient
virtual void willBeginFrame();
@@ -507,6 +510,7 @@
return m_currentInputEvent;
}
+ WebCore::GraphicsLayer* rootGraphicsLayer();
#if USE(ACCELERATED_COMPOSITING)
bool allowsAcceleratedCompositing();
void setRootGraphicsLayer(WebCore::GraphicsLayer*);
@@ -789,6 +793,8 @@
RefPtr<WebCore::Frame> m_fullScreenFrame;
bool m_isCancelingFullScreen;
+ WebViewBenchmarkSupportImpl m_benchmarkSupport;
+
#if USE(ACCELERATED_COMPOSITING)
WebCore::IntRect m_rootLayerScrollDamage;
OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;