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

Side by Side Diff: cc/trees/thread_proxy.cc

Issue 621823003: Making scheduler run ANIMATE after a COMMIT (instead of LayerTreeHostImpl). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing unneeded lines in cc/trees/layer_tree_host_impl.cc Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/thread_proxy.h" 5 #include "cc/trees/thread_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 ThreadProxy* proxy, 100 ThreadProxy* proxy,
101 int layer_tree_host_id, 101 int layer_tree_host_id,
102 RenderingStatsInstrumentation* rendering_stats_instrumentation) 102 RenderingStatsInstrumentation* rendering_stats_instrumentation)
103 : layer_tree_host_id(layer_tree_host_id), 103 : layer_tree_host_id(layer_tree_host_id),
104 contents_texture_manager(NULL), 104 contents_texture_manager(NULL),
105 commit_completion_event(NULL), 105 commit_completion_event(NULL),
106 completion_event_for_commit_held_on_tree_activation(NULL), 106 completion_event_for_commit_held_on_tree_activation(NULL),
107 next_frame_is_newly_committed_frame(false), 107 next_frame_is_newly_committed_frame(false),
108 inside_draw(false), 108 inside_draw(false),
109 input_throttled_until_commit(false), 109 input_throttled_until_commit(false),
110 did_commit_after_animating(false),
111 smoothness_priority_expiration_notifier( 110 smoothness_priority_expiration_notifier(
112 proxy->ImplThreadTaskRunner(), 111 proxy->ImplThreadTaskRunner(),
113 base::Bind(&ThreadProxy::RenewTreePriority, base::Unretained(proxy)), 112 base::Bind(&ThreadProxy::RenewTreePriority, base::Unretained(proxy)),
114 base::TimeDelta::FromMilliseconds( 113 base::TimeDelta::FromMilliseconds(
115 kSmoothnessTakesPriorityExpirationDelay * 1000)), 114 kSmoothnessTakesPriorityExpirationDelay * 1000)),
116 timing_history(rendering_stats_instrumentation), 115 timing_history(rendering_stats_instrumentation),
117 weak_factory(proxy) { 116 weak_factory(proxy) {
118 } 117 }
119 118
120 ThreadProxy::CompositorThreadOnly::~CompositorThreadOnly() {} 119 ThreadProxy::CompositorThreadOnly::~CompositorThreadOnly() {}
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 impl().scheduler->BeginMainFrameAborted(did_handle); 929 impl().scheduler->BeginMainFrameAborted(did_handle);
931 } 930 }
932 931
933 void ThreadProxy::ScheduledActionAnimate() { 932 void ThreadProxy::ScheduledActionAnimate() {
934 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); 933 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate");
935 DCHECK(IsImplThread()); 934 DCHECK(IsImplThread());
936 935
937 impl().animation_time = 936 impl().animation_time =
938 impl().layer_tree_host_impl->CurrentBeginFrameArgs().frame_time; 937 impl().layer_tree_host_impl->CurrentBeginFrameArgs().frame_time;
939 impl().layer_tree_host_impl->Animate(impl().animation_time); 938 impl().layer_tree_host_impl->Animate(impl().animation_time);
940 impl().did_commit_after_animating = false;
941 } 939 }
942 940
943 void ThreadProxy::ScheduledActionCommit() { 941 void ThreadProxy::ScheduledActionCommit() {
944 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); 942 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit");
945 DCHECK(IsImplThread()); 943 DCHECK(IsImplThread());
946 DCHECK(IsMainThreadBlocked()); 944 DCHECK(IsMainThreadBlocked());
947 DCHECK(impl().commit_completion_event); 945 DCHECK(impl().commit_completion_event);
948 DCHECK(impl().current_resource_update_controller); 946 DCHECK(impl().current_resource_update_controller);
949 947
950 // Complete all remaining texture updates. 948 // Complete all remaining texture updates.
951 impl().current_resource_update_controller->Finalize(); 949 impl().current_resource_update_controller->Finalize();
952 impl().current_resource_update_controller = nullptr; 950 impl().current_resource_update_controller = nullptr;
953 951
954 impl().did_commit_after_animating = true;
955
956 blocked_main().main_thread_inside_commit = true; 952 blocked_main().main_thread_inside_commit = true;
957 impl().layer_tree_host_impl->BeginCommit(); 953 impl().layer_tree_host_impl->BeginCommit();
958 layer_tree_host()->BeginCommitOnImplThread(impl().layer_tree_host_impl.get()); 954 layer_tree_host()->BeginCommitOnImplThread(impl().layer_tree_host_impl.get());
959 layer_tree_host()->FinishCommitOnImplThread( 955 layer_tree_host()->FinishCommitOnImplThread(
960 impl().layer_tree_host_impl.get()); 956 impl().layer_tree_host_impl.get());
961 blocked_main().main_thread_inside_commit = false; 957 blocked_main().main_thread_inside_commit = false;
962 958
963 bool hold_commit = layer_tree_host()->settings().impl_side_painting && 959 bool hold_commit = layer_tree_host()->settings().impl_side_painting &&
964 blocked_main().commit_waits_for_activation; 960 blocked_main().commit_waits_for_activation;
965 blocked_main().commit_waits_for_activation = false; 961 blocked_main().commit_waits_for_activation = false;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) { 1009 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) {
1014 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); 1010 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap");
1015 DrawResult result; 1011 DrawResult result;
1016 1012
1017 DCHECK(IsImplThread()); 1013 DCHECK(IsImplThread());
1018 DCHECK(impl().layer_tree_host_impl.get()); 1014 DCHECK(impl().layer_tree_host_impl.get());
1019 1015
1020 impl().timing_history.DidStartDrawing(); 1016 impl().timing_history.DidStartDrawing();
1021 base::AutoReset<bool> mark_inside(&impl().inside_draw, true); 1017 base::AutoReset<bool> mark_inside(&impl().inside_draw, true);
1022 1018
1023 if (impl().did_commit_after_animating) {
1024 impl().layer_tree_host_impl->Animate(impl().animation_time);
1025 impl().did_commit_after_animating = false;
1026 }
1027
1028 if (impl().layer_tree_host_impl->pending_tree()) 1019 if (impl().layer_tree_host_impl->pending_tree())
1029 impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties(); 1020 impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties();
1030 1021
1031 // This method is called on a forced draw, regardless of whether we are able 1022 // This method is called on a forced draw, regardless of whether we are able
1032 // to produce a frame, as the calling site on main thread is blocked until its 1023 // to produce a frame, as the calling site on main thread is blocked until its
1033 // request completes, and we signal completion here. If CanDraw() is false, we 1024 // request completes, and we signal completion here. If CanDraw() is false, we
1034 // will indicate success=false to the caller, but we must still signal 1025 // will indicate success=false to the caller, but we must still signal
1035 // completion to avoid deadlock. 1026 // completion to avoid deadlock.
1036 1027
1037 // We guard PrepareToDraw() with CanDraw() because it always returns a valid 1028 // We guard PrepareToDraw() with CanDraw() because it always returns a valid
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 1364
1374 impl().timing_history.DidActivateSyncTree(); 1365 impl().timing_history.DidActivateSyncTree();
1375 } 1366 }
1376 1367
1377 void ThreadProxy::DidManageTiles() { 1368 void ThreadProxy::DidManageTiles() {
1378 DCHECK(IsImplThread()); 1369 DCHECK(IsImplThread());
1379 impl().scheduler->DidManageTiles(); 1370 impl().scheduler->DidManageTiles();
1380 } 1371 }
1381 1372
1382 } // namespace cc 1373 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698