| Index: content/renderer/render_widget.cc
|
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
|
| index 537694ea95cf7573da4334b78af6a6b0059e8990..e6888f9a627e209a25df11d876965c8f4a116855 100644
|
| --- a/content/renderer/render_widget.cc
|
| +++ b/content/renderer/render_widget.cc
|
| @@ -35,6 +35,7 @@
|
| #include "content/public/common/context_menu_params.h"
|
| #include "content/renderer/cursor_utils.h"
|
| #include "content/renderer/external_popup_menu.h"
|
| +#include "content/renderer/gpu/compositor_dependencies_impl.h"
|
| #include "content/renderer/gpu/compositor_output_surface.h"
|
| #include "content/renderer/gpu/compositor_software_output_device.h"
|
| #include "content/renderer/gpu/delegated_compositor_output_surface.h"
|
| @@ -153,11 +154,6 @@ ui::TextInputMode ConvertInputMode(const blink::WebString& input_mode) {
|
| return it->second;
|
| }
|
|
|
| -bool IsThreadedCompositingEnabled() {
|
| - content::RenderThreadImpl* impl = content::RenderThreadImpl::current();
|
| - return impl && !!impl->compositor_message_loop_proxy().get();
|
| -}
|
| -
|
| // TODO(brianderson): Replace the hard-coded threshold with a fraction of
|
| // the BeginMainFrame interval.
|
| // 4166us will allow 1/4 of a 60Hz interval or 1/2 of a 120Hz interval to
|
| @@ -963,7 +959,7 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
|
|
|
| uint32 output_surface_id = next_output_surface_id_++;
|
| if (command_line.HasSwitch(switches::kEnableDelegatedRenderer)) {
|
| - DCHECK(IsThreadedCompositingEnabled());
|
| + DCHECK(compositor_deps_->GetCompositorImplThreadTaskRunner());
|
| return scoped_ptr<cc::OutputSurface>(
|
| new DelegatedCompositorOutputSurface(routing_id(),
|
| output_surface_id,
|
| @@ -987,8 +983,7 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
|
| // Composite-to-mailbox is currently used for layout tests in order to cause
|
| // them to draw inside in the renderer to do the readback there. This should
|
| // no longer be the case when crbug.com/311404 is fixed.
|
| - DCHECK(IsThreadedCompositingEnabled() ||
|
| - RenderThreadImpl::current()->layout_test_mode());
|
| + DCHECK(RenderThreadImpl::current()->layout_test_mode());
|
| cc::ResourceFormat format = cc::RGBA_8888;
|
| if (base::SysInfo::IsLowEndDevice())
|
| format = cc::RGB_565;
|
| @@ -1293,8 +1288,16 @@ void RenderWidget::AutoResizeCompositor() {
|
| void RenderWidget::initializeLayerTreeView() {
|
| DCHECK(!host_closing_);
|
|
|
| - compositor_ =
|
| - RenderWidgetCompositor::Create(this, IsThreadedCompositingEnabled());
|
| + RenderThreadImpl* render_thread = RenderThreadImpl::current();
|
| + // RenderThreadImpl can be null in tests, but is not null for tests that use
|
| + // a compositor. For future tests that end up wanting to use a compositor but
|
| + // have a null RenderThreadImpl, they should inject a custom
|
| + // CompositorDependencies instead of using the default implementation here.
|
| + DCHECK(render_thread);
|
| +
|
| + compositor_deps_ =
|
| + make_scoped_ptr(new CompositorDependenciesImpl(render_thread));
|
| + compositor_ = RenderWidgetCompositor::Create(this, compositor_deps_.get());
|
| compositor_->setViewportSize(size_, physical_backing_size_);
|
| if (init_complete_)
|
| StartCompositor();
|
| @@ -2152,6 +2155,10 @@ void RenderWidget::StartCompositor() {
|
| // at all.
|
| if (never_visible_)
|
| return;
|
| + // In tests without a RenderThreadImpl, don't set ready as this kicks
|
| + // off creating output surfaces that the test can't create.
|
| + if (!RenderThreadImpl::current())
|
| + return;
|
| compositor_->setSurfaceReady();
|
| }
|
|
|
|
|