cc: Remove things from OutputSurface and CompositorFrameSink.
After forking OutputSurface, there are a lot of things on both
OutputSurface and CompositorFrameSink that only belong on one or the
other. This patch removes such things from each of them.
Next up: Make OutputSurface::BindToClient not failable. Start
renaming SwapBuffers and friends for CompositorFrameSink.
TBR=dtrainor
R=boliu, [email protected], enne
BUG=606056
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel
Review-Url: https://codereview.chromium.org/2349743004
Cr-Commit-Position: refs/heads/master@{#419548}
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index c1e65537..f90ca32 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1472,22 +1472,10 @@
}
}
-void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) {
- if (damage_rect.IsEmpty())
- return;
- NotifySwapPromiseMonitorsOfSetNeedsRedraw();
- client_->SetNeedsRedrawRectOnImplThread(damage_rect);
-}
-
void LayerTreeHostImpl::DidSwapBuffersComplete() {
client_->DidSwapBuffersCompleteOnImplThread();
}
-void LayerTreeHostImpl::DidReceiveTextureInUseResponses(
- const gpu::TextureInUseResponses& responses) {
- NOTREACHED();
-}
-
void LayerTreeHostImpl::ReclaimResources(
const ReturnedResourceArray& resources) {
// TODO(piman): We may need to do some validation on this ack before
@@ -2304,7 +2292,6 @@
bool LayerTreeHostImpl::InitializeRenderer(
CompositorFrameSink* compositor_frame_sink) {
- DCHECK(compositor_frame_sink->capabilities().delegated_rendering);
TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer");
ReleaseCompositorFrameSink();
@@ -2356,15 +2343,11 @@
// TODO(brianderson): Don't use a hard-coded parent draw time.
base::TimeDelta parent_draw_time =
- (!settings_.use_external_begin_frame_source &&
- compositor_frame_sink_->capabilities().adjust_deadline_for_parent)
+ compositor_frame_sink_->capabilities().adjust_deadline_for_parent
? BeginFrameArgs::DefaultEstimatedParentDrawTime()
: base::TimeDelta();
client_->SetEstimatedParentDrawTime(parent_draw_time);
-
- DCHECK_EQ(1, compositor_frame_sink_->capabilities().max_frames_pending);
client_->OnCanDrawStateChanged(CanDraw());
-
SetFullViewportDamage();
// There will not be anything to draw here, so set high res
// to avoid checkerboards, typically when we are recovering
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 66be11fb..27f2f50 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -104,11 +104,9 @@
virtual void OnCanDrawStateChanged(bool can_draw) = 0;
virtual void NotifyReadyToActivate() = 0;
virtual void NotifyReadyToDraw() = 0;
- // Please call these 3 functions through
- // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and
- // SetNeedsOneBeginImplFrame().
+ // Please call these 2 functions through
+ // LayerTreeHostImpl's SetNeedsRedraw() and SetNeedsOneBeginImplFrame().
virtual void SetNeedsRedrawOnImplThread() = 0;
- virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0;
virtual void SetNeedsOneBeginImplFrameOnImplThread() = 0;
virtual void SetNeedsCommitOnImplThread() = 0;
virtual void SetNeedsPrepareTilesOnImplThread() = 0;
@@ -369,14 +367,11 @@
// CompositorFrameSinkClient implementation.
void SetBeginFrameSource(BeginFrameSource* source) override;
- void SetNeedsRedrawRect(const gfx::Rect& rect) override;
void SetExternalTilePriorityConstraints(
const gfx::Rect& viewport_rect,
const gfx::Transform& transform) override;
void DidLoseCompositorFrameSink() override;
void DidSwapBuffersComplete() override;
- void DidReceiveTextureInUseResponses(
- const gpu::TextureInUseResponses& responses) override;
void ReclaimResources(const ReturnedResourceArray& resources) override;
void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
void SetTreeActivationCallback(const base::Closure& callback) override;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 0201952..fd97ce6 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -144,9 +144,6 @@
}
void NotifyReadyToDraw() override {}
void SetNeedsRedrawOnImplThread() override { did_request_redraw_ = true; }
- void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) override {
- did_request_redraw_ = true;
- }
void SetNeedsOneBeginImplFrameOnImplThread() override {
did_request_next_frame_ = true;
}
@@ -8663,7 +8660,9 @@
new SimpleSwapPromiseMonitor(
NULL, host_impl_.get(), &set_needs_commit_count,
&set_needs_redraw_count, &forward_to_main_count));
- host_impl_->SetNeedsRedrawRect(gfx::Rect(10, 10));
+ // Redraw with damage.
+ host_impl_->SetFullViewportDamage();
+ host_impl_->SetNeedsRedraw();
EXPECT_EQ(0, set_needs_commit_count);
EXPECT_EQ(2, set_needs_redraw_count);
EXPECT_EQ(0, forward_to_main_count);
@@ -8674,17 +8673,18 @@
new SimpleSwapPromiseMonitor(
NULL, host_impl_.get(), &set_needs_commit_count,
&set_needs_redraw_count, &forward_to_main_count));
- // Empty damage rect won't signal the monitor.
- host_impl_->SetNeedsRedrawRect(gfx::Rect());
+ // Redraw without damage.
+ host_impl_->SetNeedsRedraw();
EXPECT_EQ(0, set_needs_commit_count);
- EXPECT_EQ(2, set_needs_redraw_count);
+ EXPECT_EQ(3, set_needs_redraw_count);
EXPECT_EQ(0, forward_to_main_count);
}
+ set_needs_commit_count = 0;
+ set_needs_redraw_count = 0;
+ forward_to_main_count = 0;
+
{
- set_needs_commit_count = 0;
- set_needs_redraw_count = 0;
- forward_to_main_count = 0;
std::unique_ptr<SimpleSwapPromiseMonitor> swap_promise_monitor(
new SimpleSwapPromiseMonitor(
NULL, host_impl_.get(), &set_needs_commit_count,
@@ -11067,8 +11067,7 @@
public:
MockReclaimResourcesCompositorFrameSink()
: FakeCompositorFrameSink(TestContextProvider::Create(),
- TestContextProvider::CreateWorker(),
- true) {}
+ TestContextProvider::CreateWorker()) {}
MOCK_METHOD0(ForceReclaimResources, void());
};
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 0ee33aa..00d1ee8c 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1876,8 +1876,10 @@
}
void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
- if (num_draws_ == 3)
- host_impl->SetNeedsRedrawRect(invalid_rect_);
+ if (num_draws_ == 3) {
+ host_impl->SetViewportDamage(invalid_rect_);
+ host_impl->SetNeedsRedraw();
+ }
}
DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
@@ -1895,7 +1897,7 @@
break;
case 1:
case 2:
- EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root_damage_rect);
+ EXPECT_EQ(gfx::Rect(), root_damage_rect);
break;
case 3:
EXPECT_EQ(invalid_rect_, root_damage_rect);
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc
index 50c8b62..ef0c1fbb 100644
--- a/cc/trees/layer_tree_host_unittest_copyrequest.cc
+++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -1244,7 +1244,8 @@
EXPECT_TRUE(saw_root);
EXPECT_TRUE(saw_child);
// Make another draw happen after doing the copy request.
- host_impl->SetNeedsRedrawRect(gfx::Rect(1, 1));
+ host_impl->SetViewportDamage(gfx::Rect(1, 1));
+ host_impl->SetNeedsRedraw();
break;
case 3:
// If LayerTreeHostImpl does the wrong thing, it will try to draw the
diff --git a/cc/trees/proxy_impl.cc b/cc/trees/proxy_impl.cc
index 7ae09613..67bd86da 100644
--- a/cc/trees/proxy_impl.cc
+++ b/cc/trees/proxy_impl.cc
@@ -159,7 +159,8 @@
void ProxyImpl::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) {
DCHECK(IsImplThread());
- SetNeedsRedrawRectOnImplThread(damage_rect);
+ layer_tree_host_impl_->SetViewportDamage(damage_rect);
+ SetNeedsRedrawOnImplThread();
}
void ProxyImpl::SetNeedsCommitOnImpl() {
@@ -311,12 +312,6 @@
scheduler_->SetNeedsRedraw();
}
-void ProxyImpl::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) {
- DCHECK(IsImplThread());
- layer_tree_host_impl_->SetViewportDamage(damage_rect);
- SetNeedsRedrawOnImplThread();
-}
-
void ProxyImpl::SetNeedsOneBeginImplFrameOnImplThread() {
TRACE_EVENT0("cc", "ProxyImpl::SetNeedsOneBeginImplFrameOnImplThread");
DCHECK(IsImplThread());
diff --git a/cc/trees/proxy_impl.h b/cc/trees/proxy_impl.h
index b073009..d9ed3ce2 100644
--- a/cc/trees/proxy_impl.h
+++ b/cc/trees/proxy_impl.h
@@ -74,11 +74,9 @@
void OnCanDrawStateChanged(bool can_draw) override;
void NotifyReadyToActivate() override;
void NotifyReadyToDraw() override;
- // Please call these 3 functions through
- // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and
- // SetNeedsOneBeginImplFrame().
+ // Please call these 2 functions through
+ // LayerTreeHostImpl's SetNeedsRedraw() and SetNeedsOneBeginImplFrame().
void SetNeedsRedrawOnImplThread() override;
- void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override;
void SetNeedsOneBeginImplFrameOnImplThread() override;
void SetNeedsPrepareTilesOnImplThread() override;
void SetNeedsCommitOnImplThread() override;
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 60b3a75..b85f0f8 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -249,8 +249,8 @@
TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw");
DCHECK(task_runner_provider_->IsMainThread());
DebugScopedSetImplThread impl(task_runner_provider_);
- client_->RequestScheduleComposite();
- SetNeedsRedrawRectOnImplThread(damage_rect);
+ layer_tree_host_impl_->SetViewportDamage(damage_rect);
+ SetNeedsRedrawOnImplThread();
}
void SingleThreadProxy::SetNextCommitWaitsForActivation() {
@@ -356,12 +356,6 @@
scheduler_on_impl_thread_->SetNeedsPrepareTiles();
}
-void SingleThreadProxy::SetNeedsRedrawRectOnImplThread(
- const gfx::Rect& damage_rect) {
- layer_tree_host_impl_->SetViewportDamage(damage_rect);
- SetNeedsRedrawOnImplThread();
-}
-
void SingleThreadProxy::SetNeedsCommitOnImplThread() {
client_->RequestScheduleComposite();
if (scheduler_on_impl_thread_)
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index 5277527a..6734e23 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -84,7 +84,6 @@
void NotifyReadyToActivate() override;
void NotifyReadyToDraw() override;
void SetNeedsRedrawOnImplThread() override;
- void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override;
void SetNeedsOneBeginImplFrameOnImplThread() override;
void SetNeedsPrepareTilesOnImplThread() override;
void SetNeedsCommitOnImplThread() override;