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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 1061993009: cc: Make SingleThreadProxy ignore commit requests inside Layout(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stp-snc: fixtest Created 5 years, 8 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
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | content/renderer/gpu/render_widget_compositor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index c25ed4d1dbb6d5f48337e29594a8044f09eab369..b9f6a4849131dfa14431b6f7a0b48dd4fe81fab9 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -50,11 +50,21 @@ SingleThreadProxy::SingleThreadProxy(
commit_requested_(false),
inside_synchronous_composite_(false),
output_surface_creation_requested_(false),
- external_begin_frame_source_(external_begin_frame_source.Pass()),
weak_factory_(this) {
TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
DCHECK(Proxy::IsMainThread());
DCHECK(layer_tree_host);
+
+ if (layer_tree_host->settings().single_thread_proxy_scheduler &&
+ !scheduler_on_impl_thread_) {
+ SchedulerSettings scheduler_settings(
+ layer_tree_host->settings().ToSchedulerSettings());
+ // SingleThreadProxy should run in main thread low latency mode.
+ scheduler_settings.main_thread_should_always_be_low_latency = true;
+ scheduler_on_impl_thread_ = Scheduler::Create(
+ this, scheduler_settings, layer_tree_host_->id(),
+ MainThreadTaskRunner(), external_begin_frame_source.Pass());
+ }
}
void SingleThreadProxy::Start() {
@@ -95,18 +105,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().ToSchedulerSettings());
- // SingleThreadProxy should run in main thread low latency mode.
- scheduler_settings.main_thread_should_always_be_low_latency = true;
- scheduler_on_impl_thread_ =
- Scheduler::Create(this,
- scheduler_settings,
- layer_tree_host_->id(),
- MainThreadTaskRunner(),
- external_begin_frame_source_.Pass());
+ if (scheduler_on_impl_thread_) {
scheduler_on_impl_thread_->SetCanStart();
scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
}
@@ -214,7 +213,6 @@ void SingleThreadProxy::DoCommit() {
// fixed.
tracked_objects::ScopedTracker tracking_profile1(
FROM_HERE_WITH_EXPLICIT_FUNCTION("461509 SingleThreadProxy::DoCommit1"));
- commit_requested_ = false;
layer_tree_host_->WillCommit();
devtools_instrumentation::ScopedCommitTrace commit_task(
layer_tree_host_->id());
@@ -334,8 +332,10 @@ void SingleThreadProxy::CommitComplete() {
void SingleThreadProxy::SetNeedsCommit() {
DCHECK(Proxy::IsMainThread());
- DebugScopedSetImplThread impl(this);
client_->ScheduleComposite();
+ if (commit_requested_)
+ return;
+ DebugScopedSetImplThread impl(this);
if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->SetNeedsCommit();
commit_requested_ = true;
@@ -766,7 +766,11 @@ void SingleThreadProxy::DidCommitAndDrawFrame() {
}
bool SingleThreadProxy::MainFrameWillHappenForTesting() {
- return false;
+ if (layer_tree_host_->output_surface_lost())
+ return false;
+ if (!scheduler_on_impl_thread_)
+ return false;
+ return scheduler_on_impl_thread_->MainFrameForTestingWillHappen();
}
void SingleThreadProxy::SetChildrenNeedBeginFrames(
@@ -804,6 +808,8 @@ void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() {
}
void SingleThreadProxy::BeginMainFrame() {
+ commit_requested_ = false;
+
if (defer_commits_) {
TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit",
TRACE_EVENT_SCOPE_THREAD);
@@ -831,6 +837,9 @@ void SingleThreadProxy::BeginMainFrame() {
return;
}
+ // Prevent new commits from being requested inside DoBeginMainFrame.
+ commit_requested_ = true;
+
const BeginFrameArgs& begin_frame_args =
layer_tree_host_impl_->CurrentBeginFrameArgs();
DoBeginMainFrame(begin_frame_args);
@@ -855,6 +864,9 @@ void SingleThreadProxy::DoBeginMainFrame(
DCHECK(!queue_for_commit_);
queue_for_commit_ = make_scoped_ptr(new ResourceUpdateQueue);
+ // New commits requested inside UpdateLayers should be respected.
+ commit_requested_ = false;
+
layer_tree_host_->UpdateLayers(queue_for_commit_.get());
timing_history_.DidBeginMainFrame();
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | content/renderer/gpu/render_widget_compositor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698