OLD | NEW |
---|---|
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 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1052 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); | 1052 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); |
1053 DrawResult result; | 1053 DrawResult result; |
1054 | 1054 |
1055 DCHECK(IsImplThread()); | 1055 DCHECK(IsImplThread()); |
1056 DCHECK(impl().layer_tree_host_impl.get()); | 1056 DCHECK(impl().layer_tree_host_impl.get()); |
1057 | 1057 |
1058 impl().timing_history.DidStartDrawing(); | 1058 impl().timing_history.DidStartDrawing(); |
1059 base::TimeDelta draw_duration_estimate = DrawDurationEstimate(); | 1059 base::TimeDelta draw_duration_estimate = DrawDurationEstimate(); |
1060 base::AutoReset<bool> mark_inside(&impl().inside_draw, true); | 1060 base::AutoReset<bool> mark_inside(&impl().inside_draw, true); |
1061 | 1061 |
1062 if (impl().did_commit_after_animating) { | |
1063 impl().layer_tree_host_impl->Animate(impl().animation_time); | |
danakj
2014/06/18 15:23:18
This change is not part of the CL description.
mithro-old
2014/07/02 05:39:50
This was from the CL this one was based on. It sho
| |
1064 impl().did_commit_after_animating = false; | |
1065 } | |
1066 | |
1067 if (impl().layer_tree_host_impl->pending_tree()) | 1062 if (impl().layer_tree_host_impl->pending_tree()) |
1068 impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties(); | 1063 impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties(); |
1069 | 1064 |
1070 // This method is called on a forced draw, regardless of whether we are able | 1065 // This method is called on a forced draw, regardless of whether we are able |
1071 // to produce a frame, as the calling site on main thread is blocked until its | 1066 // to produce a frame, as the calling site on main thread is blocked until its |
1072 // request completes, and we signal completion here. If CanDraw() is false, we | 1067 // request completes, and we signal completion here. If CanDraw() is false, we |
1073 // will indicate success=false to the caller, but we must still signal | 1068 // will indicate success=false to the caller, but we must still signal |
1074 // completion to avoid deadlock. | 1069 // completion to avoid deadlock. |
1075 | 1070 |
1076 // We guard PrepareToDraw() with CanDraw() because it always returns a valid | 1071 // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
1077 // frame, so can only be used when such a frame is possible. Since | 1072 // frame, so can only be used when such a frame is possible. Since |
1078 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on | 1073 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on |
1079 // CanDraw() as well. | 1074 // CanDraw() as well. |
1080 | 1075 |
1081 LayerTreeHostImpl::FrameData frame; | 1076 LayerTreeHostImpl::FrameData frame; |
1082 bool draw_frame = false; | 1077 bool draw_frame = false; |
1083 | 1078 |
1084 if (impl().layer_tree_host_impl->CanDraw()) { | 1079 if (impl().layer_tree_host_impl->CanDraw()) { |
1085 result = impl().layer_tree_host_impl->PrepareToDraw(&frame); | 1080 result = impl().layer_tree_host_impl->PrepareToDraw(&frame); |
1086 draw_frame = forced_draw || result == DRAW_SUCCESS; | 1081 draw_frame = forced_draw || result == DRAW_SUCCESS; |
1087 } else { | 1082 } else { |
1088 result = DRAW_ABORTED_CANT_DRAW; | 1083 result = DRAW_ABORTED_CANT_DRAW; |
1089 } | 1084 } |
1090 | 1085 |
1091 if (draw_frame) { | 1086 if (draw_frame) { |
1092 impl().layer_tree_host_impl->DrawLayers( | 1087 impl().layer_tree_host_impl->DrawLayers(&frame); |
1093 &frame, impl().scheduler->LastBeginImplFrameTime()); | |
1094 result = DRAW_SUCCESS; | 1088 result = DRAW_SUCCESS; |
1095 impl().animations_frozen_until_next_draw = false; | 1089 impl().animations_frozen_until_next_draw = false; |
1096 } else if (result == DRAW_ABORTED_CHECKERBOARD_ANIMATIONS && | 1090 } else if (result == DRAW_ABORTED_CHECKERBOARD_ANIMATIONS && |
1097 !impl().layer_tree_host_impl->settings().impl_side_painting) { | 1091 !impl().layer_tree_host_impl->settings().impl_side_painting) { |
1098 // Without impl-side painting, the animated layer that is checkerboarding | 1092 // Without impl-side painting, the animated layer that is checkerboarding |
1099 // will continue to checkerboard until the next commit. If this layer | 1093 // will continue to checkerboard until the next commit. If this layer |
1100 // continues to move during the commit, it may continue to checkerboard | 1094 // continues to move during the commit, it may continue to checkerboard |
1101 // after the commit since the region rasterized during the commit will not | 1095 // after the commit since the region rasterized during the commit will not |
1102 // match the region that is currently visible; eventually this | 1096 // match the region that is currently visible; eventually this |
1103 // checkerboarding will be displayed when we force a draw. To avoid this, | 1097 // checkerboarding will be displayed when we force a draw. To avoid this, |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1455 | 1449 |
1456 impl().timing_history.DidActivatePendingTree(); | 1450 impl().timing_history.DidActivatePendingTree(); |
1457 } | 1451 } |
1458 | 1452 |
1459 void ThreadProxy::DidManageTiles() { | 1453 void ThreadProxy::DidManageTiles() { |
1460 DCHECK(IsImplThread()); | 1454 DCHECK(IsImplThread()); |
1461 impl().scheduler->DidManageTiles(); | 1455 impl().scheduler->DidManageTiles(); |
1462 } | 1456 } |
1463 | 1457 |
1464 } // namespace cc | 1458 } // namespace cc |
OLD | NEW |