Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 344743002: Make Android CompositorImpl use scheduled SingleThreadProxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index f2ddbb634040057f2ed40fe04e3918c4d82ac2ab..c5412f28ffc80f25d38de44c56538c1ae54699b4 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -49,6 +49,11 @@ SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host,
void SingleThreadProxy::Start() {
DebugScopedSetImplThread impl(this);
layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
+
+ SchedulerSettings scheduler_settings(layer_tree_host_->settings());
+ scheduler_on_impl_thread_ = Scheduler::Create(
+ this, scheduler_settings, layer_tree_host_->id(), MainThreadTaskRunner());
+ scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
}
SingleThreadProxy::~SingleThreadProxy() {
@@ -78,16 +83,7 @@ void SingleThreadProxy::SetLayerTreeHostClientReady() {
// nothing to do.
DCHECK(Proxy::IsMainThread());
DebugScopedSetImplThread impl(this);
- if (layer_tree_host_->settings().single_thread_proxy_scheduler &&
- !scheduler_on_impl_thread_) {
- SchedulerSettings scheduler_settings(layer_tree_host_->settings());
- scheduler_on_impl_thread_ = Scheduler::Create(this,
- scheduler_settings,
- layer_tree_host_->id(),
- MainThreadTaskRunner());
- scheduler_on_impl_thread_->SetCanStart();
- scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
- }
+ scheduler_on_impl_thread_->SetCanStart();
}
void SingleThreadProxy::SetVisible(bool visible) {
@@ -96,8 +92,7 @@ void SingleThreadProxy::SetVisible(bool visible) {
layer_tree_host_impl_->SetVisible(visible);
// Changing visibility could change ShouldComposite().
UpdateBackgroundAnimateTicking();
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
+ scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
}
void SingleThreadProxy::CreateAndInitializeOutputSurface() {
@@ -123,8 +118,7 @@ void SingleThreadProxy::CreateAndInitializeOutputSurface() {
layer_tree_host_->OnCreateAndInitializeOutputSurfaceAttempted(success);
if (success) {
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface();
+ scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface();
} else if (Proxy::MainThreadTaskRunner()) {
Proxy::MainThreadTaskRunner()->PostTask(
FROM_HERE,
@@ -142,14 +136,12 @@ const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const {
void SingleThreadProxy::SetNeedsAnimate() {
TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate");
DCHECK(Proxy::IsMainThread());
- client_->ScheduleAnimation();
SetNeedsCommit();
brianderson 2014/06/24 23:50:12 Until we have commit-less updates, we'll should in
}
void SingleThreadProxy::SetNeedsUpdateLayers() {
TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers");
DCHECK(Proxy::IsMainThread());
- client_->ScheduleComposite();
SetNeedsCommit();
}
@@ -236,16 +228,13 @@ void SingleThreadProxy::DoCommit(base::TimeTicks frame_begin_time) {
void SingleThreadProxy::SetNeedsCommit() {
DCHECK(Proxy::IsMainThread());
DebugScopedSetImplThread impl(this);
- client_->ScheduleComposite();
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->SetNeedsCommit();
+ scheduler_on_impl_thread_->SetNeedsCommit();
}
void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) {
TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw");
DCHECK(Proxy::IsMainThread());
DebugScopedSetImplThread impl(this);
- client_->ScheduleComposite();
SetNeedsRedrawRectOnImplThread(damage_rect);
}
@@ -256,7 +245,6 @@ void SingleThreadProxy::SetNextCommitWaitsForActivation() {
void SingleThreadProxy::SetDeferCommits(bool defer_commits) {
DCHECK(Proxy::IsMainThread());
- DCHECK(scheduler_on_impl_thread_);
brianderson 2014/06/24 23:50:12 Why is this DCHECK no longer valid?
if (defer_commits_ == defer_commits)
return;
@@ -308,8 +296,7 @@ void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) {
"cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
DCHECK(Proxy::IsImplThread());
UpdateBackgroundAnimateTicking();
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->SetCanDraw(can_draw);
+ scheduler_on_impl_thread_->SetCanDraw(can_draw);
}
void SingleThreadProxy::NotifyReadyToActivate() {
@@ -318,9 +305,7 @@ void SingleThreadProxy::NotifyReadyToActivate() {
}
void SingleThreadProxy::SetNeedsRedrawOnImplThread() {
- client_->ScheduleComposite();
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->SetNeedsRedraw();
+ scheduler_on_impl_thread_->SetNeedsRedraw();
}
void SingleThreadProxy::SetNeedsAnimateOnImplThread() {
@@ -344,9 +329,7 @@ void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() {
}
void SingleThreadProxy::SetNeedsCommitOnImplThread() {
- client_->ScheduleComposite();
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->SetNeedsCommit();
+ scheduler_on_impl_thread_->SetNeedsCommit();
}
void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread(
@@ -417,28 +400,24 @@ void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() {
layer_tree_host_->DidLoseOutputSurface();
}
client_->DidAbortSwapBuffers();
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->DidLoseOutputSurface();
+ scheduler_on_impl_thread_->DidLoseOutputSurface();
}
void SingleThreadProxy::DidSwapBuffersOnImplThread() {
TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersOnImplThread");
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->DidSwapBuffers();
+ scheduler_on_impl_thread_->DidSwapBuffers();
client_->DidPostSwapBuffers();
}
void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() {
TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread");
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->DidSwapBuffersComplete();
+ scheduler_on_impl_thread_->DidSwapBuffersComplete();
layer_tree_host_->DidCompleteSwapBuffers();
}
void SingleThreadProxy::BeginFrame(const BeginFrameArgs& args) {
TRACE_EVENT0("cc", "SingleThreadProxy::BeginFrame");
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->BeginImplFrame(args);
+ scheduler_on_impl_thread_->BeginImplFrame(args);
}
void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
@@ -585,7 +564,6 @@ void SingleThreadProxy::ScheduledActionSendBeginMainFrame() {
}
timing_history_.DidBeginMainFrame();
- DCHECK(scheduler_on_impl_thread_);
scheduler_on_impl_thread_->NotifyBeginMainFrameStarted();
scheduler_on_impl_thread_->NotifyReadyToCommit();
}
@@ -629,7 +607,6 @@ void SingleThreadProxy::ScheduledActionActivatePendingTree() {
void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() {
DebugScopedSetMainThread main(this);
- DCHECK(scheduler_on_impl_thread_);
// If possible, create the output surface in a post task. Synchronously
// creating the output surface makes tests more awkward since this differs
// from the ThreadProxy behavior. However, sometimes there is no

Powered by Google App Engine
This is Rietveld 408576698