summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/test/fake_proxy.h2
-rw-r--r--cc/test/layer_tree_test.cc12
-rw-r--r--cc/test/layer_tree_test.h9
-rw-r--r--cc/trees/layer_tree_host.cc28
-rw-r--r--cc/trees/layer_tree_host.h8
-rw-r--r--cc/trees/layer_tree_host_unittest.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc165
-rw-r--r--cc/trees/proxy.h2
-rw-r--r--cc/trees/single_thread_proxy.cc9
-rw-r--r--cc/trees/single_thread_proxy.h6
-rw-r--r--cc/trees/thread_proxy.cc9
-rw-r--r--cc/trees/thread_proxy.h5
-rw-r--r--content/renderer/gpu/render_widget_compositor.cc7
-rw-r--r--content/renderer/gpu/render_widget_compositor.h2
-rw-r--r--content/test/test_webkit_platform_support.cc3
-rw-r--r--content/test/web_layer_tree_view_impl_for_testing.cc6
-rw-r--r--content/test/web_layer_tree_view_impl_for_testing.h2
17 files changed, 105 insertions, 172 deletions
diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h
index 295cd9d..bcde11e 100644
--- a/cc/test/fake_proxy.h
+++ b/cc/test/fake_proxy.h
@@ -38,7 +38,7 @@ class FakeProxy : public Proxy {
virtual void MainThreadHasStoppedFlinging() OVERRIDE {}
virtual bool BeginMainFrameRequested() const OVERRIDE;
virtual bool CommitRequested() const OVERRIDE;
- virtual void Start() OVERRIDE {}
+ virtual void Start(scoped_ptr<OutputSurface> first_output_surface) OVERRIDE {}
virtual void Stop() OVERRIDE {}
virtual void ForceSerializeOnSwapBuffers() OVERRIDE {}
virtual size_t MaxPartialTextureUpdates() const OVERRIDE;
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index d854488..b723c56 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -288,10 +288,12 @@ class LayerTreeHostForTesting : public LayerTreeHost {
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
scoped_ptr<LayerTreeHostForTesting> layer_tree_host(
new LayerTreeHostForTesting(test_hooks, client, settings));
+ bool success;
if (impl_task_runner.get())
- layer_tree_host->InitializeThreaded(impl_task_runner);
+ success = layer_tree_host->InitializeThreaded(impl_task_runner);
else
- layer_tree_host->InitializeSingleThreaded(client);
+ success = layer_tree_host->InitializeSingleThreaded(client);
+ EXPECT_TRUE(success);
return layer_tree_host.Pass();
}
@@ -456,10 +458,6 @@ void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() {
main_thread_weak_ptr_));
}
-void LayerTreeTest::WillBeginTest() {
- layer_tree_host_->SetLayerTreeHostClientReady();
-}
-
void LayerTreeTest::DoBeginTest() {
client_ = LayerTreeHostClientForTesting::Create(this);
@@ -474,7 +472,7 @@ void LayerTreeTest::DoBeginTest() {
started_ = true;
beginning_ = true;
SetupTree();
- WillBeginTest();
+ layer_tree_host_->SetLayerTreeHostClientReady();
BeginTest();
beginning_ = false;
if (end_when_begin_returns_)
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index c32bcd9..ac35a65 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -103,6 +103,10 @@ class LayerTreeTest : public testing::Test, public TestHooks {
public:
virtual ~LayerTreeTest();
+ virtual void AfterTest() = 0;
+ virtual void BeginTest() = 0;
+ virtual void SetupTree();
+
virtual void EndTest();
void EndTestAfterDelay(int delay_milliseconds);
@@ -143,11 +147,6 @@ class LayerTreeTest : public testing::Test, public TestHooks {
void DispatchComposite();
void DispatchDidAddAnimation();
- virtual void AfterTest() = 0;
- virtual void WillBeginTest();
- virtual void BeginTest() = 0;
- virtual void SetupTree();
-
virtual void RunTest(bool threaded,
bool delegating_renderer,
bool impl_side_painting);
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 5addf28..c1e1d4b 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -70,7 +70,8 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
DCHECK(impl_task_runner);
scoped_ptr<LayerTreeHost> layer_tree_host(
new LayerTreeHost(client, manager, settings));
- layer_tree_host->InitializeThreaded(impl_task_runner);
+ if (!layer_tree_host->InitializeThreaded(impl_task_runner))
+ return scoped_ptr<LayerTreeHost>();
return layer_tree_host.Pass();
}
@@ -81,7 +82,8 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
const LayerTreeSettings& settings) {
scoped_ptr<LayerTreeHost> layer_tree_host(
new LayerTreeHost(client, manager, settings));
- layer_tree_host->InitializeSingleThreaded(single_thread_client);
+ if (!layer_tree_host->InitializeSingleThreaded(single_thread_client))
+ return scoped_ptr<LayerTreeHost>();
return layer_tree_host.Pass();
}
@@ -124,25 +126,31 @@ LayerTreeHost::LayerTreeHost(
debug_state_.RecordRenderingStats());
}
-void LayerTreeHost::InitializeThreaded(
+bool LayerTreeHost::InitializeThreaded(
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
- InitializeProxy(ThreadProxy::Create(this, impl_task_runner));
+ return InitializeProxy(ThreadProxy::Create(this, impl_task_runner));
}
-void LayerTreeHost::InitializeSingleThreaded(
+bool LayerTreeHost::InitializeSingleThreaded(
LayerTreeHostSingleThreadClient* single_thread_client) {
- InitializeProxy(SingleThreadProxy::Create(this, single_thread_client));
+ return InitializeProxy(
+ SingleThreadProxy::Create(this, single_thread_client));
}
-void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) {
- InitializeProxy(proxy_for_testing.Pass());
+bool LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) {
+ return InitializeProxy(proxy_for_testing.Pass());
}
-void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) {
+bool LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) {
TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal");
+ scoped_ptr<OutputSurface> output_surface(CreateOutputSurface());
+ if (!output_surface)
+ return false;
+
proxy_ = proxy.Pass();
- proxy_->Start();
+ proxy_->Start(output_surface.Pass());
+ return true;
}
LayerTreeHost::~LayerTreeHost() {
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index acc32bb..53ec30e 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -295,11 +295,11 @@ class CC_EXPORT LayerTreeHost {
LayerTreeHost(LayerTreeHostClient* client,
SharedBitmapManager* manager,
const LayerTreeSettings& settings);
- void InitializeThreaded(
+ bool InitializeThreaded(
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
- void InitializeSingleThreaded(
+ bool InitializeSingleThreaded(
LayerTreeHostSingleThreadClient* single_thread_client);
- void InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing);
+ bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing);
void SetOutputSurfaceLostForTesting(bool is_lost) {
output_surface_lost_ = is_lost;
}
@@ -307,7 +307,7 @@ class CC_EXPORT LayerTreeHost {
MicroBenchmarkController micro_benchmark_controller_;
private:
- void InitializeProxy(scoped_ptr<Proxy> proxy);
+ bool InitializeProxy(scoped_ptr<Proxy> proxy);
void PaintLayerContents(
const RenderSurfaceLayerList& render_surface_layer_list,
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index c74eeb7..9b301e2 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2308,7 +2308,7 @@ class LayerTreeHostWithProxy : public LayerTreeHost {
scoped_ptr<FakeProxy> proxy)
: LayerTreeHost(client, NULL, settings) {
proxy->SetLayerTreeHost(this);
- InitializeForTesting(proxy.PassAs<Proxy>());
+ EXPECT_TRUE(InitializeForTesting(proxy.PassAs<Proxy>()));
}
};
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index d28f239..eb7f0d9 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -409,37 +409,6 @@ class LayerTreeHostContextTestLostContextSucceeds
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds);
-class LayerTreeHostClientNotReadyDoesNotCreateOutputSurface
- : public LayerTreeHostContextTest {
- public:
- LayerTreeHostClientNotReadyDoesNotCreateOutputSurface()
- : LayerTreeHostContextTest() {}
-
- virtual void WillBeginTest() OVERRIDE {
- // Override and do not signal SetLayerTreeHostClientReady.
- }
-
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- EndTest();
- }
-
- virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
- OVERRIDE {
- EXPECT_TRUE(false);
- return scoped_ptr<OutputSurface>();
- }
-
- virtual void DidInitializeOutputSurface(bool succeeded) OVERRIDE {
- EXPECT_TRUE(false);
- }
-
- virtual void AfterTest() OVERRIDE {
- }
-};
-
-MULTI_THREAD_TEST_F(LayerTreeHostClientNotReadyDoesNotCreateOutputSurface);
-
class LayerTreeHostContextTestLostContextSucceedsWithContent
: public LayerTreeHostContextTestLostContextSucceeds {
public:
@@ -558,97 +527,6 @@ TEST_F(LayerTreeHostContextTestLostContextSucceedsWithContent,
RunTest(true, false, false);
}
-class LayerTreeHostContextTestCreateOutputSurfaceFails
- : public LayerTreeHostContextTest {
- public:
- // Run a test that initially fails OutputSurface creation |times_to_fail|
- // times. If |expect_fallback_attempt| is |true|, an attempt to create a
- // fallback/software OutputSurface is expected to occur.
- LayerTreeHostContextTestCreateOutputSurfaceFails(int times_to_fail,
- bool expect_fallback_attempt,
- bool expect_to_give_up)
- : times_to_fail_(times_to_fail),
- expect_fallback_attempt_(expect_fallback_attempt),
- expect_to_give_up_(expect_to_give_up),
- did_attempt_fallback_(false),
- times_initialized_(0) {}
-
- virtual void BeginTest() OVERRIDE {
- times_to_fail_create_ = times_to_fail_;
- PostSetNeedsCommitToMainThread();
- }
-
- virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
- OVERRIDE {
- scoped_ptr<OutputSurface> surface =
- LayerTreeHostContextTest::CreateOutputSurface(fallback);
-
- if (surface)
- EXPECT_EQ(times_to_fail_, times_create_failed_);
-
- did_attempt_fallback_ = fallback;
- return surface.Pass();
- }
-
- virtual void DidInitializeOutputSurface(bool succeeded) OVERRIDE {
- if (succeeded)
- times_initialized_++;
- else
- EndTest();
- }
-
- virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- EndTest();
- }
-
- virtual void AfterTest() OVERRIDE {
- EXPECT_EQ(times_to_fail_, times_create_failed_);
- EXPECT_EQ(expect_to_give_up_, times_initialized_ == 0);
- EXPECT_EQ(expect_fallback_attempt_, did_attempt_fallback_);
- }
-
- private:
- int times_to_fail_;
- bool expect_fallback_attempt_;
- bool expect_to_give_up_;
- bool did_attempt_fallback_;
- int times_initialized_;
-};
-
-class LayerTreeHostContextTestCreateOutputSurfaceFailsOnce
- : public LayerTreeHostContextTestCreateOutputSurfaceFails {
- public:
- LayerTreeHostContextTestCreateOutputSurfaceFailsOnce()
- : LayerTreeHostContextTestCreateOutputSurfaceFails(1, false, false) {}
-};
-
-SINGLE_AND_MULTI_THREAD_TEST_F(
- LayerTreeHostContextTestCreateOutputSurfaceFailsOnce);
-
-// After 4 failures we expect an attempt to create a fallback/software
-// OutputSurface.
-class LayerTreeHostContextTestCreateOutputSurfaceFailsWithFallback
- : public LayerTreeHostContextTestCreateOutputSurfaceFails {
- public:
- LayerTreeHostContextTestCreateOutputSurfaceFailsWithFallback()
- : LayerTreeHostContextTestCreateOutputSurfaceFails(4, true, false) {}
-};
-
-SINGLE_AND_MULTI_THREAD_TEST_F(
- LayerTreeHostContextTestCreateOutputSurfaceFailsWithFallback);
-
-// If we fail that often, we should be giving up cleanly.
-class LayerTreeHostContextTestCreateOutputSurfaceIsHopeless
- : public LayerTreeHostContextTestCreateOutputSurfaceFails {
- public:
- LayerTreeHostContextTestCreateOutputSurfaceIsHopeless()
- : LayerTreeHostContextTestCreateOutputSurfaceFails(5, true, true) {}
-};
-
-SINGLE_AND_MULTI_THREAD_TEST_F(
- LayerTreeHostContextTestCreateOutputSurfaceIsHopeless);
-
-
class LayerTreeHostContextTestOffscreenContextFails
: public LayerTreeHostContextTest {
public:
@@ -1407,11 +1285,7 @@ class LayerTreeHostContextTestDontUseLostResources
virtual scoped_ptr<OutputSurface> CreateOutputSurface(
bool fallback) OVERRIDE {
- // This will get called twice:
- // First when we create the initial output surface...
- if (layer_tree_host()->source_frame_number() > 0) {
- // ... and then again after we forced the context to be lost on the third
- // frame. Verify this assumption here.
+ if (layer_tree_host()) {
lost_context_ = true;
EXPECT_EQ(layer_tree_host()->source_frame_number(), 3);
}
@@ -1887,6 +1761,43 @@ class LayerTreeHostContextTestFailsToCreateSurface
SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostContextTestFailsToCreateSurface);
+// Not reusing LayerTreeTest because it expects creating LTH to always succeed.
+class LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface
+ : public testing::Test,
+ public FakeLayerTreeHostClient {
+ public:
+ LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface()
+ : FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D) {}
+
+ // FakeLayerTreeHostClient implementation.
+ virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
+ OVERRIDE {
+ return scoped_ptr<OutputSurface>();
+ }
+
+ void RunTest(bool threaded,
+ bool delegating_renderer,
+ bool impl_side_painting) {
+ LayerTreeSettings settings;
+ settings.impl_side_painting = impl_side_painting;
+ if (threaded) {
+ scoped_ptr<base::Thread> impl_thread(new base::Thread("LayerTreeTest"));
+ ASSERT_TRUE(impl_thread->Start());
+ ASSERT_TRUE(impl_thread->message_loop_proxy().get());
+ scoped_ptr<LayerTreeHost> layer_tree_host = LayerTreeHost::CreateThreaded(
+ this, NULL, settings, impl_thread->message_loop_proxy());
+ EXPECT_FALSE(layer_tree_host);
+ } else {
+ scoped_ptr<LayerTreeHost> layer_tree_host =
+ LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings);
+ EXPECT_FALSE(layer_tree_host);
+ }
+ }
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface);
+
class UIResourceLostTest : public LayerTreeHostContextTest {
public:
UIResourceLostTest() : time_step_(0) {}
diff --git a/cc/trees/proxy.h b/cc/trees/proxy.h
index 8949a02..69975a6 100644
--- a/cc/trees/proxy.h
+++ b/cc/trees/proxy.h
@@ -84,7 +84,7 @@ class CC_EXPORT Proxy {
virtual bool BeginMainFrameRequested() const = 0;
// Must be called before using the proxy.
- virtual void Start() = 0;
+ virtual void Start(scoped_ptr<OutputSurface> first_output_surface) = 0;
virtual void Stop() = 0; // Must be called before deleting the proxy.
// Forces 3D commands on all contexts to wait for all previous SwapBuffers
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 85085ab..57f3557 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -44,9 +44,11 @@ SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host,
<< "Threaded compositing must be enabled to use impl-side painting.";
}
-void SingleThreadProxy::Start() {
+void SingleThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) {
+ DCHECK(first_output_surface);
DebugScopedSetImplThread impl(this);
layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
+ first_output_surface_ = first_output_surface.Pass();
}
SingleThreadProxy::~SingleThreadProxy() {
@@ -111,8 +113,9 @@ void SingleThreadProxy::CreateAndInitializeOutputSurface() {
"cc", "SingleThreadProxy::CreateAndInitializeOutputSurface");
DCHECK(Proxy::IsMainThread());
- scoped_ptr<OutputSurface> output_surface =
- layer_tree_host_->CreateOutputSurface();
+ scoped_ptr<OutputSurface> output_surface = first_output_surface_.Pass();
+ if (!output_surface)
+ output_surface = layer_tree_host_->CreateOutputSurface();
if (!output_surface) {
OnOutputSurfaceInitializeAttempted(false);
return;
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index 2d9c647..50e6bf2 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -44,7 +44,7 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient {
virtual bool CommitRequested() const OVERRIDE;
virtual bool BeginMainFrameRequested() const OVERRIDE;
virtual void MainThreadHasStoppedFlinging() OVERRIDE {}
- virtual void Start() OVERRIDE;
+ virtual void Start(scoped_ptr<OutputSurface> first_output_surface) OVERRIDE;
virtual void Stop() OVERRIDE;
virtual size_t MaxPartialTextureUpdates() const OVERRIDE;
virtual void AcquireLayerTextures() OVERRIDE {}
@@ -108,6 +108,10 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient {
LayerTreeHostSingleThreadClient* client_;
bool created_offscreen_context_provider_;
+ // Holds the first output surface passed from Start. Should not be used for
+ // anything else.
+ scoped_ptr<OutputSurface> first_output_surface_;
+
// Used on the Thread, but checked on main thread during
// initialization/shutdown.
scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_;
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index f2c3ce8..8958004 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -267,8 +267,9 @@ void ThreadProxy::DoCreateAndInitializeOutputSurface() {
TRACE_EVENT0("cc", "ThreadProxy::DoCreateAndInitializeOutputSurface");
DCHECK(IsMainThread());
- scoped_ptr<OutputSurface> output_surface =
- layer_tree_host()->CreateOutputSurface();
+ scoped_ptr<OutputSurface> output_surface = first_output_surface_.Pass();
+ if (!output_surface)
+ output_surface = layer_tree_host()->CreateOutputSurface();
RendererCapabilities capabilities;
bool success = !!output_surface;
@@ -641,9 +642,10 @@ ThreadProxy::contents_texture_manager_on_impl_thread() {
return contents_texture_manager_unsafe_;
}
-void ThreadProxy::Start() {
+void ThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) {
DCHECK(IsMainThread());
DCHECK(Proxy::HasImplThread());
+ DCHECK(first_output_surface);
// Create LayerTreeHostImpl.
DebugScopedSetMainThreadBlocked main_thread_blocked(this);
@@ -656,6 +658,7 @@ void ThreadProxy::Start() {
completion.Wait();
main_thread_weak_ptr_ = weak_factory_.GetWeakPtr();
+ first_output_surface_ = first_output_surface.Pass();
started_ = true;
}
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index 6abc1ae..1e226b2 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -58,7 +58,7 @@ class ThreadProxy : public Proxy,
virtual bool CommitRequested() const OVERRIDE;
virtual bool BeginMainFrameRequested() const OVERRIDE;
virtual void MainThreadHasStoppedFlinging() OVERRIDE;
- virtual void Start() OVERRIDE;
+ virtual void Start(scoped_ptr<OutputSurface> first_output_surface) OVERRIDE;
virtual void Stop() OVERRIDE;
virtual size_t MaxPartialTextureUpdates() const OVERRIDE;
virtual void AcquireLayerTextures() OVERRIDE;
@@ -224,6 +224,9 @@ class ThreadProxy : public Proxy,
bool manage_tiles_pending_;
// Weak pointer to use when posting tasks to the impl thread.
base::WeakPtr<ThreadProxy> impl_thread_weak_ptr_;
+ // Holds the first output surface passed from Start. Should not be used for
+ // anything else.
+ scoped_ptr<OutputSurface> first_output_surface_;
// Accessed on the main thread, or when main thread is blocked.
bool commit_waits_for_activation_;
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index bc4d652..ec12089 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -279,7 +279,8 @@ scoped_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create(
}
#endif
- compositor->Initialize(settings);
+ if (!compositor->Initialize(settings))
+ return scoped_ptr<RenderWidgetCompositor>();
return compositor.Pass();
}
@@ -386,7 +387,7 @@ bool RenderWidgetCompositor::ScheduleMicroBenchmark(
return layer_tree_host_->ScheduleMicroBenchmark(name, value.Pass(), callback);
}
-void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) {
+bool RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) {
scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy =
RenderThreadImpl::current()->compositor_message_loop_proxy();
if (compositor_message_loop_proxy.get()) {
@@ -396,7 +397,7 @@ void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) {
layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(
this, this, NULL, settings);
}
- DCHECK(layer_tree_host_);
+ return layer_tree_host_;
}
void RenderWidgetCompositor::setSurfaceReady() {
diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h
index c0f91c7..7fc8f15 100644
--- a/content/renderer/gpu/render_widget_compositor.h
+++ b/content/renderer/gpu/render_widget_compositor.h
@@ -137,7 +137,7 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
private:
RenderWidgetCompositor(RenderWidget* widget, bool threaded);
- void Initialize(cc::LayerTreeSettings settings);
+ bool Initialize(cc::LayerTreeSettings settings);
bool threaded_;
bool suppress_schedule_composite_;
diff --git a/content/test/test_webkit_platform_support.cc b/content/test/test_webkit_platform_support.cc
index ea6ea71..bc93658 100644
--- a/content/test/test_webkit_platform_support.cc
+++ b/content/test/test_webkit_platform_support.cc
@@ -303,7 +303,8 @@ TestWebKitPlatformSupport::createLayerTreeViewForTesting() {
scoped_ptr<WebLayerTreeViewImplForTesting> view(
new WebLayerTreeViewImplForTesting());
- view->Initialize();
+ if (!view->Initialize())
+ return NULL;
return view.release();
}
diff --git a/content/test/web_layer_tree_view_impl_for_testing.cc b/content/test/web_layer_tree_view_impl_for_testing.cc
index d29e68b..1470e03 100644
--- a/content/test/web_layer_tree_view_impl_for_testing.cc
+++ b/content/test/web_layer_tree_view_impl_for_testing.cc
@@ -36,7 +36,7 @@ WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() {}
WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {}
-void WebLayerTreeViewImplForTesting::Initialize() {
+bool WebLayerTreeViewImplForTesting::Initialize() {
cc::LayerTreeSettings settings;
// For web contents, layer transforms should scale up the contents of layers
@@ -47,7 +47,9 @@ void WebLayerTreeViewImplForTesting::Initialize() {
settings.accelerated_animation_enabled = true;
layer_tree_host_ =
cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings);
- DCHECK(layer_tree_host_);
+ if (!layer_tree_host_)
+ return false;
+ return true;
}
void WebLayerTreeViewImplForTesting::setSurfaceReady() {
diff --git a/content/test/web_layer_tree_view_impl_for_testing.h b/content/test/web_layer_tree_view_impl_for_testing.h
index 4f496bb..6fec0e3 100644
--- a/content/test/web_layer_tree_view_impl_for_testing.h
+++ b/content/test/web_layer_tree_view_impl_for_testing.h
@@ -26,7 +26,7 @@ class WebLayerTreeViewImplForTesting
WebLayerTreeViewImplForTesting();
virtual ~WebLayerTreeViewImplForTesting();
- void Initialize();
+ bool Initialize();
// blink::WebLayerTreeView implementation.
virtual void setSurfaceReady();