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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 DCHECK(IsMainThread()); | 531 DCHECK(IsMainThread()); |
532 return commit_requested_; | 532 return commit_requested_; |
533 } | 533 } |
534 | 534 |
535 void ThreadProxy::SetNeedsRedrawOnImplThread() { | 535 void ThreadProxy::SetNeedsRedrawOnImplThread() { |
536 DCHECK(IsImplThread()); | 536 DCHECK(IsImplThread()); |
537 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedrawOnImplThread"); | 537 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedrawOnImplThread"); |
538 scheduler_on_impl_thread_->SetNeedsRedraw(); | 538 scheduler_on_impl_thread_->SetNeedsRedraw(); |
539 } | 539 } |
540 | 540 |
| 541 void ThreadProxy::SetNeedsManageTilesOnImplThread() { |
| 542 DCHECK(IsImplThread()); |
| 543 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsManageTilesOnImplThread"); |
| 544 scheduler_on_impl_thread_->SetNeedsManageTiles(); |
| 545 } |
| 546 |
541 void ThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { | 547 void ThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { |
542 DCHECK(IsImplThread()); | 548 DCHECK(IsImplThread()); |
543 layer_tree_host_impl_->SetViewportDamage(damage_rect); | 549 layer_tree_host_impl_->SetViewportDamage(damage_rect); |
544 SetNeedsRedrawOnImplThread(); | 550 SetNeedsRedrawOnImplThread(); |
545 } | 551 } |
546 | 552 |
547 void ThreadProxy::SetSwapUsedIncompleteTileOnImplThread( | 553 void ThreadProxy::SetSwapUsedIncompleteTileOnImplThread( |
548 bool used_incomplete_tile) { | 554 bool used_incomplete_tile) { |
549 DCHECK(IsImplThread()); | 555 DCHECK(IsImplThread()); |
550 if (used_incomplete_tile) { | 556 if (used_incomplete_tile) { |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 base::TimeDelta::FromMilliseconds(1), | 1147 base::TimeDelta::FromMilliseconds(1), |
1142 base::TimeDelta::FromMilliseconds(100), | 1148 base::TimeDelta::FromMilliseconds(100), |
1143 50); | 1149 50); |
1144 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationOverestimate", | 1150 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationOverestimate", |
1145 draw_duration_overestimate, | 1151 draw_duration_overestimate, |
1146 base::TimeDelta::FromMilliseconds(1), | 1152 base::TimeDelta::FromMilliseconds(1), |
1147 base::TimeDelta::FromMilliseconds(100), | 1153 base::TimeDelta::FromMilliseconds(100), |
1148 50); | 1154 50); |
1149 } | 1155 } |
1150 | 1156 |
1151 // Update the tile state after drawing. This prevents manage tiles from | |
1152 // being in the critical path for getting things on screen, but still | |
1153 // makes sure that tile state is updated on a semi-regular basis. | |
1154 if (layer_tree_host_impl_->settings().impl_side_painting) | |
1155 layer_tree_host_impl_->ManageTiles(); | |
1156 | |
1157 return result; | 1157 return result; |
1158 } | 1158 } |
1159 | 1159 |
1160 void ThreadProxy::AcquireLayerTextures() { | 1160 void ThreadProxy::AcquireLayerTextures() { |
1161 // Called when the main thread needs to modify a layer texture that is used | 1161 // Called when the main thread needs to modify a layer texture that is used |
1162 // directly by the compositor. | 1162 // directly by the compositor. |
1163 // This method will block until the next compositor draw if there is a | 1163 // This method will block until the next compositor draw if there is a |
1164 // previously committed frame that is still undrawn. This is necessary to | 1164 // previously committed frame that is still undrawn. This is necessary to |
1165 // ensure that the main thread does not monopolize access to the textures. | 1165 // ensure that the main thread does not monopolize access to the textures. |
1166 DCHECK(IsMainThread()); | 1166 DCHECK(IsMainThread()); |
(...skipping 24 matching lines...) Expand all Loading... |
1191 texture_acquisition_completion_event_on_impl_thread_ = completion; | 1191 texture_acquisition_completion_event_on_impl_thread_ = completion; |
1192 scheduler_on_impl_thread_->SetMainThreadNeedsLayerTextures(); | 1192 scheduler_on_impl_thread_->SetMainThreadNeedsLayerTextures(); |
1193 } | 1193 } |
1194 | 1194 |
1195 void ThreadProxy::ScheduledActionAcquireLayerTexturesForMainThread() { | 1195 void ThreadProxy::ScheduledActionAcquireLayerTexturesForMainThread() { |
1196 DCHECK(texture_acquisition_completion_event_on_impl_thread_); | 1196 DCHECK(texture_acquisition_completion_event_on_impl_thread_); |
1197 texture_acquisition_completion_event_on_impl_thread_->Signal(); | 1197 texture_acquisition_completion_event_on_impl_thread_->Signal(); |
1198 texture_acquisition_completion_event_on_impl_thread_ = NULL; | 1198 texture_acquisition_completion_event_on_impl_thread_ = NULL; |
1199 } | 1199 } |
1200 | 1200 |
| 1201 void ThreadProxy::ScheduledActionManageTiles() { |
| 1202 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionManageTiles"); |
| 1203 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 1204 layer_tree_host_impl_->ManageTiles(); |
| 1205 } |
| 1206 |
1201 DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() { | 1207 DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() { |
1202 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndSwap"); | 1208 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndSwap"); |
1203 bool forced_draw = false; | 1209 bool forced_draw = false; |
1204 bool swap_requested = true; | 1210 bool swap_requested = true; |
1205 bool readback_requested = false; | 1211 bool readback_requested = false; |
1206 return DrawSwapReadbackInternal( | 1212 return DrawSwapReadbackInternal( |
1207 forced_draw, swap_requested, readback_requested); | 1213 forced_draw, swap_requested, readback_requested); |
1208 } | 1214 } |
1209 | 1215 |
1210 DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapForced() { | 1216 DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapForced() { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1568 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1563 } | 1569 } |
1564 | 1570 |
1565 UpdateBackgroundAnimateTicking(); | 1571 UpdateBackgroundAnimateTicking(); |
1566 | 1572 |
1567 commit_to_activate_duration_history_.InsertSample( | 1573 commit_to_activate_duration_history_.InsertSample( |
1568 base::TimeTicks::HighResNow() - commit_complete_time_); | 1574 base::TimeTicks::HighResNow() - commit_complete_time_); |
1569 } | 1575 } |
1570 | 1576 |
1571 } // namespace cc | 1577 } // namespace cc |
OLD | NEW |