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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 2317493003: cc: Toward merging DrawFrame and SwapBuffers in DelegatingRenderer. (Closed)
Patch Set: merge-draw-swap: add-draw-result-checks 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
« no previous file with comments | « 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 1b28c6d7d8ec91baf0d9cf2a6949e0e05b36e0db..725d6123d4781f44b26e6ec0ca89b5cde05cb584 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -589,6 +589,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(
@@ -603,7 +614,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(
@@ -611,46 +634,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.
« no previous file with comments | « cc/trees/proxy_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698