summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-07 19:20:40 +0000
committervangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-07 19:20:40 +0000
commitc3d455395eb870c87ca8e62679ec44b99f5479de (patch)
treeae566c5a9506be4e8f168fffa71b009e7191217d
parente305d381cf1836513374baad83a6ebfc861c194d (diff)
downloadchromium_src-c3d455395eb870c87ca8e62679ec44b99f5479de.zip
chromium_src-c3d455395eb870c87ca8e62679ec44b99f5479de.tar.gz
chromium_src-c3d455395eb870c87ca8e62679ec44b99f5479de.tar.bz2
Turning the threaded compositor into a runtime option. This CL
must land after https://bugs.webkit.org/show_bug.cgi?id=69391 BUG=none TEST=Covered by existing compositor tests Review URL: http://codereview.chromium.org/8139020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104542 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc11
-rw-r--r--content/renderer/render_view.cc4
-rw-r--r--content/renderer/render_view.h1
-rw-r--r--content/renderer/render_widget.cc42
-rw-r--r--content/renderer/render_widget.h4
5 files changed, 27 insertions, 35 deletions
diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
index 46e74d7..da50f0c 100644
--- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
@@ -42,9 +42,7 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl()
: initialize_failed_(false),
context_(NULL),
gl_(NULL),
-#ifndef WTF_USE_THREADED_COMPOSITING
web_view_(NULL),
-#endif
#if defined(OS_MACOSX)
plugin_handle_(NULL),
#endif // defined(OS_MACOSX)
@@ -102,9 +100,7 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize(
if (!render_view)
return false;
render_view_routing_id_ = render_view->routing_id();
-#ifndef WTF_USE_THREADED_COMPOSITING
web_view_ = web_view;
-#endif
}
return true;
}
@@ -244,12 +240,10 @@ WebGLId WebGraphicsContext3DCommandBufferImpl::getPlatformTextureId() {
void WebGraphicsContext3DCommandBufferImpl::prepareTexture() {
// Copies the contents of the off-screen render target into the texture
// used by the compositor.
-#ifndef WTF_USE_THREADED_COMPOSITING
RenderView* renderview =
web_view_ ? RenderView::FromWebView(web_view_) : NULL;
if (renderview)
renderview->OnViewContextSwapBuffersPosted();
-#endif
context_->SwapBuffers();
context_->Echo(method_factory_.NewRunnableMethod(
&WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete));
@@ -1027,13 +1021,12 @@ void WebGraphicsContext3DCommandBufferImpl::deleteTexture(WebGLId texture) {
}
void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete() {
-#ifndef WTF_USE_THREADED_COMPOSITING
// This may be called after tear-down of the RenderView.
RenderView* renderview =
web_view_ ? RenderView::FromWebView(web_view_) : NULL;
if (renderview)
renderview->OnViewContextSwapBuffersComplete();
-#endif
+
if (swapbuffers_complete_callback_)
swapbuffers_complete_callback_->onSwapBuffersComplete();
}
@@ -1088,12 +1081,10 @@ void WebGraphicsContext3DCommandBufferImpl::OnContextLost(
if (context_lost_callback_) {
context_lost_callback_->onContextLost();
}
-#ifndef WTF_USE_THREADED_COMPOSITING
RenderView* renderview =
web_view_ ? RenderView::FromWebView(web_view_) : NULL;
if (renderview)
renderview->OnViewContextSwapBuffersAborted();
-#endif
}
#endif // defined(ENABLE_GPU)
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 348c506..e482ac4 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -4462,3 +4462,7 @@ void RenderView::OnLockMouseACK(bool succeeded) {
void RenderView::OnMouseLockLost() {
pepper_delegate_.OnMouseLockLost();
}
+
+bool RenderView::WebWidgetHandlesCompositorScheduling() const {
+ return webview()->settings()->useThreadedCompositor();
+}
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index 37899c0..682707b 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -661,6 +661,7 @@ class RenderView : public RenderWidget,
virtual void OnImeConfirmComposition(const string16& text) OVERRIDE;
virtual ui::TextInputType GetTextInputType() OVERRIDE;
virtual bool CanComposeInline() OVERRIDE;
+ virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE;
private:
// For unit tests.
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 68594e4..06aaeb0 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -323,11 +323,7 @@ void RenderWidget::OnWasRestored(bool needs_repainting) {
if (!is_accelerated_compositing_active_) {
didInvalidateRect(gfx::Rect(size_.width(), size_.height()));
} else {
-#ifdef WTF_USE_THREADED_COMPOSITING
- webwidget_->composite(false);
-#else
scheduleComposite();
-#endif
}
}
@@ -926,9 +922,9 @@ void RenderWidget::didActivateCompositor(int compositorIdentifier) {
Send(new ViewHostMsg_DidActivateAcceleratedCompositing(
routing_id_, is_accelerated_compositing_active_));
-#ifndef WTF_USE_THREADED_COMPOSITING
+ // Note: asynchronous swapbuffer support currently only matters if
+ // compositing scheduling happens on the RenderWidget.
using_asynchronous_swapbuffers_ = SupportsAsynchronousSwapBuffers();
-#endif
}
void RenderWidget::didDeactivateCompositor() {
@@ -938,24 +934,22 @@ void RenderWidget::didDeactivateCompositor() {
Send(new ViewHostMsg_DidActivateAcceleratedCompositing(
routing_id_, is_accelerated_compositing_active_));
-#ifndef WTF_USE_THREADED_COMPOSITING
if (using_asynchronous_swapbuffers_)
using_asynchronous_swapbuffers_ = false;
-#endif
}
void RenderWidget::scheduleComposite() {
-#if WTF_USE_THREADED_COMPOSITING
- NOTREACHED();
-#else
- // TODO(nduca): replace with something a little less hacky. The reason this
- // hack is still used is because the Invalidate-DoDeferredUpdate loop
- // contains a lot of host-renderer synchronization logic that is still
- // important for the accelerated compositing case. The option of simply
- // duplicating all that code is less desirable than "faking out" the
- // invalidation path using a magical damage rect.
- didInvalidateRect(WebRect(0, 0, 1, 1));
-#endif
+ if (WebWidgetHandlesCompositorScheduling())
+ webwidget_->composite(false);
+ else {
+ // TODO(nduca): replace with something a little less hacky. The reason this
+ // hack is still used is because the Invalidate-DoDeferredUpdate loop
+ // contains a lot of host-renderer synchronization logic that is still
+ // important for the accelerated compositing case. The option of simply
+ // duplicating all that code is less desirable than "faking out" the
+ // invalidation path using a magical damage rect.
+ didInvalidateRect(WebRect(0, 0, 1, 1));
+ }
}
void RenderWidget::scheduleAnimation() {
@@ -1224,13 +1218,7 @@ void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) {
set_next_paint_is_repaint_ack();
if (is_accelerated_compositing_active_) {
-#ifndef WTF_USE_THREADED_COMPOSITING
scheduleComposite();
-#else
-#ifdef WEBWIDGET_HAS_THREADED_COMPOSITING_CHANGES
- webwidget_->composite(false);
-#endif
-#endif
} else {
gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height());
didInvalidateRect(repaint_rect);
@@ -1411,3 +1399,7 @@ void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
return false;
}
+
+bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
+ return false;
+}
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index f4bed58..f54b3ad 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -315,6 +315,10 @@ class CONTENT_EXPORT RenderWidget
// just handled.
virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {}
+ // Should return true if the underlying WebWidget is responsible for
+ // the scheduling of compositing requests.
+ virtual bool WebWidgetHandlesCompositorScheduling() const;
+
// Routing ID that allows us to communicate to the parent browser process
// RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
int32 routing_id_;