summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-20 21:53:15 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-20 21:53:15 +0000
commit497edf843b74a3a3f61c498b3a7dff7dbddacde2 (patch)
tree54bae299df9b7a7703cc91eaf5592f487323bf34 /cc
parent582507170e6f19ead4447a8e098fc58f79ddbfa9 (diff)
downloadchromium_src-497edf843b74a3a3f61c498b3a7dff7dbddacde2.zip
chromium_src-497edf843b74a3a3f61c498b3a7dff7dbddacde2.tar.gz
chromium_src-497edf843b74a3a3f61c498b3a7dff7dbddacde2.tar.bz2
cc: Remove CreateAndInitializeOutputSurface from the Proxy interface.
Move it to be non-virtual methods on SingleThreadProxy and ThreadProxy. LayerTreeHost only needs to call it on the SingleThreadProxy, and make it do that before calling Composite() instead of having Composite() early out. Merge LTH::InitializeOutputSurfaceIfNeeded into LTH::Composite. NOTRY=true R=enne BUG=374287 Review URL: https://codereview.chromium.org/286293002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/test/fake_proxy.cc5
-rw-r--r--cc/test/fake_proxy.h1
-rw-r--r--cc/trees/layer_tree_host.cc14
-rw-r--r--cc/trees/layer_tree_host.h3
-rw-r--r--cc/trees/layer_tree_host_unittest.cc18
-rw-r--r--cc/trees/proxy.h5
-rw-r--r--cc/trees/single_thread_proxy.cc5
-rw-r--r--cc/trees/single_thread_proxy.h5
-rw-r--r--cc/trees/thread_proxy.h2
9 files changed, 23 insertions, 35 deletions
diff --git a/cc/test/fake_proxy.cc b/cc/test/fake_proxy.cc
index 29ca100..7799ff3 100644
--- a/cc/test/fake_proxy.cc
+++ b/cc/test/fake_proxy.cc
@@ -12,11 +12,6 @@ void FakeProxy::SetLayerTreeHost(LayerTreeHost* host) {
bool FakeProxy::IsStarted() const { return true; }
-void FakeProxy::CreateAndInitializeOutputSurface() {
- DCHECK(layer_tree_host_);
- layer_tree_host_->OnCreateAndInitializeOutputSurfaceAttempted(true);
-}
-
const RendererCapabilities& FakeProxy::GetRendererCapabilities() const {
return capabilities_;
}
diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h
index b6240c2..1d62c6f 100644
--- a/cc/test/fake_proxy.h
+++ b/cc/test/fake_proxy.h
@@ -25,7 +25,6 @@ class FakeProxy : public Proxy {
virtual bool IsStarted() const OVERRIDE;
virtual void SetLayerTreeHostClientReady() OVERRIDE {}
virtual void SetVisible(bool visible) OVERRIDE {}
- virtual void CreateAndInitializeOutputSurface() OVERRIDE;
virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE;
virtual void SetNeedsAnimate() OVERRIDE {}
virtual void SetNeedsUpdateLayers() OVERRIDE {}
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 105c392..82a49b5 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -96,7 +96,6 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
client_(client),
source_frame_number_(0),
rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),
- output_surface_can_be_initialized_(true),
output_surface_lost_(true),
num_failed_recreate_attempts_(0),
settings_(settings),
@@ -698,16 +697,13 @@ void LayerTreeHost::NotifyInputThrottledUntilCommit() {
void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) {
DCHECK(!proxy_->HasImplThread());
SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get());
- proxy->CompositeImmediately(frame_begin_time);
-}
-
-bool LayerTreeHost::InitializeOutputSurfaceIfNeeded() {
- if (!output_surface_can_be_initialized_)
- return false;
if (output_surface_lost_)
- proxy_->CreateAndInitializeOutputSurface();
- return !output_surface_lost_;
+ proxy->CreateAndInitializeOutputSurface();
+ if (output_surface_lost_)
+ return;
+
+ proxy->CompositeImmediately(frame_begin_time);
}
bool LayerTreeHost::UpdateLayers(ResourceUpdateQueue* queue) {
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 03bfeca..793cd69 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -118,8 +118,6 @@ class CC_EXPORT LayerTreeHost {
void DidCommitAndDrawFrame() { client_->DidCommitAndDrawFrame(); }
void DidCompleteSwapBuffers() { client_->DidCompleteSwapBuffers(); }
void DeleteContentsTexturesOnImplThread(ResourceProvider* resource_provider);
- // Returns false if we should abort this frame due to initialization failure.
- bool InitializeOutputSurfaceIfNeeded();
bool UpdateLayers(ResourceUpdateQueue* queue);
LayerTreeHostClient* client() { return client_; }
@@ -364,7 +362,6 @@ class CC_EXPORT LayerTreeHost {
int source_frame_number_;
scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation_;
- bool output_surface_can_be_initialized_;
bool output_surface_lost_;
int num_failed_recreate_attempts_;
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 40650a6..adf4353 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2036,7 +2036,7 @@ TEST(LayerTreeHostTest, LimitPartialUpdates) {
settings.max_partial_texture_updates = 10;
LayerTreeHostWithProxy host(&client, settings, proxy.Pass());
- EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded());
+ host.OnCreateAndInitializeOutputSurfaceAttempted(true);
EXPECT_EQ(0u, host.MaxPartialTextureUpdates());
}
@@ -2054,7 +2054,7 @@ TEST(LayerTreeHostTest, LimitPartialUpdates) {
settings.max_partial_texture_updates = 10;
LayerTreeHostWithProxy host(&client, settings, proxy.Pass());
- EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded());
+ host.OnCreateAndInitializeOutputSurfaceAttempted(true);
EXPECT_EQ(5u, host.MaxPartialTextureUpdates());
}
@@ -2072,7 +2072,7 @@ TEST(LayerTreeHostTest, LimitPartialUpdates) {
settings.max_partial_texture_updates = 10;
LayerTreeHostWithProxy host(&client, settings, proxy.Pass());
- EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded());
+ host.OnCreateAndInitializeOutputSurfaceAttempted(true);
EXPECT_EQ(10u, host.MaxPartialTextureUpdates());
}
@@ -2088,7 +2088,8 @@ TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) {
new TestSharedBitmapManager());
scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
&client, &client, shared_bitmap_manager.get(), settings);
- EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
+ host->Composite(base::TimeTicks::Now());
+
EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
}
@@ -2102,7 +2103,8 @@ TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) {
new TestSharedBitmapManager());
scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
&client, &client, shared_bitmap_manager.get(), settings);
- EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
+ host->Composite(base::TimeTicks::Now());
+
EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
}
@@ -2116,7 +2118,8 @@ TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) {
new TestSharedBitmapManager());
scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
&client, &client, shared_bitmap_manager.get(), settings);
- EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
+ host->Composite(base::TimeTicks::Now());
+
EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
}
@@ -2131,7 +2134,8 @@ TEST(LayerTreeHostTest,
new TestSharedBitmapManager());
scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
&client, &client, shared_bitmap_manager.get(), settings);
- EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
+ host->Composite(base::TimeTicks::Now());
+
EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
}
diff --git a/cc/trees/proxy.h b/cc/trees/proxy.h
index bd2ccfe..af7a926 100644
--- a/cc/trees/proxy.h
+++ b/cc/trees/proxy.h
@@ -57,11 +57,6 @@ class CC_EXPORT Proxy {
virtual void SetVisible(bool visible) = 0;
- // Attempts to recreate the context and renderer synchronously after the
- // output surface is lost. Calls
- // LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted with the result.
- virtual void CreateAndInitializeOutputSurface() = 0;
-
virtual const RendererCapabilities& GetRendererCapabilities() const = 0;
virtual void SetNeedsAnimate() = 0;
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 35524fd..157ecbe 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -88,6 +88,7 @@ void SingleThreadProxy::CreateAndInitializeOutputSurface() {
TRACE_EVENT0(
"cc", "SingleThreadProxy::CreateAndInitializeOutputSurface");
DCHECK(Proxy::IsMainThread());
+ DCHECK(layer_tree_host_->output_surface_lost());
scoped_ptr<OutputSurface> output_surface =
layer_tree_host_->CreateOutputSurface();
@@ -340,9 +341,7 @@ void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() {
void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately");
DCHECK(Proxy::IsMainThread());
-
- if (!layer_tree_host_->InitializeOutputSurfaceIfNeeded())
- return;
+ DCHECK(!layer_tree_host_->output_surface_lost());
layer_tree_host_->AnimateLayers(frame_begin_time);
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index e727284..dc87f5f 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -31,7 +31,6 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient {
virtual bool IsStarted() const OVERRIDE;
virtual void SetLayerTreeHostClientReady() OVERRIDE;
virtual void SetVisible(bool visible) OVERRIDE;
- virtual void CreateAndInitializeOutputSurface() OVERRIDE;
virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE;
virtual void SetNeedsAnimate() OVERRIDE;
virtual void SetNeedsUpdateLayers() OVERRIDE;
@@ -84,6 +83,10 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient {
virtual void DidManageTiles() OVERRIDE {}
virtual void SetDebugState(const LayerTreeDebugState& debug_state) OVERRIDE {}
+ // Attempts to create the context and renderer synchronously. Calls
+ // LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted with the result.
+ void CreateAndInitializeOutputSurface();
+
// Called by the legacy path where RenderWidget does the scheduling.
void CompositeImmediately(base::TimeTicks frame_begin_time);
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index b114469..7af16cd 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -47,7 +47,6 @@ class ThreadProxy : public Proxy,
virtual bool IsStarted() const OVERRIDE;
virtual void SetLayerTreeHostClientReady() OVERRIDE;
virtual void SetVisible(bool visible) OVERRIDE;
- virtual void CreateAndInitializeOutputSurface() OVERRIDE;
virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE;
virtual void SetNeedsAnimate() OVERRIDE;
virtual void SetNeedsUpdateLayers() OVERRIDE;
@@ -148,6 +147,7 @@ class ThreadProxy : public Proxy,
void DidCommitAndDrawFrame();
void DidCompleteSwapBuffers();
void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue);
+ void CreateAndInitializeOutputSurface();
void DoCreateAndInitializeOutputSurface();
void SendCommitRequestToImplThreadIfNeeded();