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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 2317493003: cc: Toward merging DrawFrame and SwapBuffers in DelegatingRenderer. (Closed)
Patch Set: merge-draw-swap Created 4 years, 3 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
« cc/test/layer_tree_test.cc ('K') | « cc/trees/proxy_impl.cc ('k') | no next file » | 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 81f09c5a9957acbf9fbc56a8b5ff8194a5da930f..bd972ed7f3bc3df13c46278a381f437bc20c2fd4 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -601,6 +601,17 @@ DrawResult SingleThreadProxy::DoComposite(LayerTreeHostImpl::FrameData* frame) {
return DRAW_ABORTED_CANT_DRAW;
}
+ // This CapturePostTasks should be destroyed before
+ // DidCommitAndDrawFrame() is called since that goes out to the
+ // embedder, and we want the embedder to receive its callbacks before that.
+ // NOTE: This maintains consistent ordering with the ThreadProxy since
+ // the DidCommitAndDrawFrame() must be post-tasked from the impl thread
+ // there as the main thread is not blocked, so any posted tasks inside
+ // the swap buffers will execute first.
+ DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
+ BlockingTaskRunner::CapturePostTasks blocked(
+ task_runner_provider_->blocking_main_thread_task_runner());
+
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
// is fixed.
tracked_objects::ScopedTracker tracking_profile2(
@@ -615,7 +626,19 @@ DrawResult SingleThreadProxy::DoComposite(LayerTreeHostImpl::FrameData* frame) {
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"461509 SingleThreadProxy::DoComposite3"));
layer_tree_host_impl_->DrawLayers(frame);
+
+ // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
+ // is fixed.
+ tracked_objects::ScopedTracker tracking_profile8(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 SingleThreadProxy::DoComposite8"));
+ if (layer_tree_host_impl_->SwapBuffers(*frame)) {
+ if (scheduler_on_impl_thread_)
+ scheduler_on_impl_thread_->DidSwapBuffers();
+ client_->DidPostSwapBuffers();
+ }
}
+
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
// is fixed.
tracked_objects::ScopedTracker tracking_profile4(
@@ -623,46 +646,13 @@ DrawResult SingleThreadProxy::DoComposite(LayerTreeHostImpl::FrameData* frame) {
"461509 SingleThreadProxy::DoComposite4"));
layer_tree_host_impl_->DidDrawAllLayers(*frame);
- bool start_ready_animations = draw_frame;
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
// is fixed.
tracked_objects::ScopedTracker tracking_profile5(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"461509 SingleThreadProxy::DoComposite5"));
+ bool start_ready_animations = draw_frame;
layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
-
- // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
- // is fixed.
- tracked_objects::ScopedTracker tracking_profile7(
- FROM_HERE_WITH_EXPLICIT_FUNCTION(
- "461509 SingleThreadProxy::DoComposite7"));
- }
-
- if (draw_frame) {
- DebugScopedSetImplThread impl(task_runner_provider_);
-
- // This CapturePostTasks should be destroyed before
- // DidCommitAndDrawFrame() is called since that goes out to the
- // embedder,
- // and we want the embedder to receive its callbacks before that.
- // NOTE: This maintains consistent ordering with the ThreadProxy since
- // the DidCommitAndDrawFrame() must be post-tasked from the impl thread
- // there as the main thread is not blocked, so any posted tasks inside
- // the swap buffers will execute first.
- DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
-
- BlockingTaskRunner::CapturePostTasks blocked(
- task_runner_provider_->blocking_main_thread_task_runner());
- // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
- // is fixed.
- tracked_objects::ScopedTracker tracking_profile8(
- FROM_HERE_WITH_EXPLICIT_FUNCTION(
- "461509 SingleThreadProxy::DoComposite8"));
- if (layer_tree_host_impl_->SwapBuffers(*frame)) {
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->DidSwapBuffers();
- client_->DidPostSwapBuffers();
- }
}
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 is
// fixed.
« cc/test/layer_tree_test.cc ('K') | « cc/trees/proxy_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698