| 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 base::TimeDelta::FromMilliseconds(1), | 1136 base::TimeDelta::FromMilliseconds(1), |
| 1131 base::TimeDelta::FromMilliseconds(100), | 1137 base::TimeDelta::FromMilliseconds(100), |
| 1132 50); | 1138 50); |
| 1133 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationOverestimate", | 1139 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationOverestimate", |
| 1134 draw_duration_overestimate, | 1140 draw_duration_overestimate, |
| 1135 base::TimeDelta::FromMilliseconds(1), | 1141 base::TimeDelta::FromMilliseconds(1), |
| 1136 base::TimeDelta::FromMilliseconds(100), | 1142 base::TimeDelta::FromMilliseconds(100), |
| 1137 50); | 1143 50); |
| 1138 } | 1144 } |
| 1139 | 1145 |
| 1140 // Update the tile state after drawing. This prevents manage tiles from | |
| 1141 // being in the critical path for getting things on screen, but still | |
| 1142 // makes sure that tile state is updated on a semi-regular basis. | |
| 1143 if (layer_tree_host_impl_->settings().impl_side_painting) | |
| 1144 layer_tree_host_impl_->ManageTiles(); | |
| 1145 | |
| 1146 return result; | 1146 return result; |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 void ThreadProxy::AcquireLayerTextures() { | 1149 void ThreadProxy::AcquireLayerTextures() { |
| 1150 // Called when the main thread needs to modify a layer texture that is used | 1150 // Called when the main thread needs to modify a layer texture that is used |
| 1151 // directly by the compositor. | 1151 // directly by the compositor. |
| 1152 // This method will block until the next compositor draw if there is a | 1152 // This method will block until the next compositor draw if there is a |
| 1153 // previously committed frame that is still undrawn. This is necessary to | 1153 // previously committed frame that is still undrawn. This is necessary to |
| 1154 // ensure that the main thread does not monopolize access to the textures. | 1154 // ensure that the main thread does not monopolize access to the textures. |
| 1155 DCHECK(IsMainThread()); | 1155 DCHECK(IsMainThread()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1180 texture_acquisition_completion_event_on_impl_thread_ = completion; | 1180 texture_acquisition_completion_event_on_impl_thread_ = completion; |
| 1181 scheduler_on_impl_thread_->SetMainThreadNeedsLayerTextures(); | 1181 scheduler_on_impl_thread_->SetMainThreadNeedsLayerTextures(); |
| 1182 } | 1182 } |
| 1183 | 1183 |
| 1184 void ThreadProxy::ScheduledActionAcquireLayerTexturesForMainThread() { | 1184 void ThreadProxy::ScheduledActionAcquireLayerTexturesForMainThread() { |
| 1185 DCHECK(texture_acquisition_completion_event_on_impl_thread_); | 1185 DCHECK(texture_acquisition_completion_event_on_impl_thread_); |
| 1186 texture_acquisition_completion_event_on_impl_thread_->Signal(); | 1186 texture_acquisition_completion_event_on_impl_thread_->Signal(); |
| 1187 texture_acquisition_completion_event_on_impl_thread_ = NULL; | 1187 texture_acquisition_completion_event_on_impl_thread_ = NULL; |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 void ThreadProxy::ScheduledActionManageTiles() { |
| 1191 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionManageTiles"); |
| 1192 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 1193 layer_tree_host_impl_->ManageTiles(); |
| 1194 } |
| 1195 |
| 1190 DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() { | 1196 DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() { |
| 1191 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndSwap"); | 1197 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndSwap"); |
| 1192 bool forced_draw = false; | 1198 bool forced_draw = false; |
| 1193 bool swap_requested = true; | 1199 bool swap_requested = true; |
| 1194 bool readback_requested = false; | 1200 bool readback_requested = false; |
| 1195 return DrawSwapReadbackInternal( | 1201 return DrawSwapReadbackInternal( |
| 1196 forced_draw, swap_requested, readback_requested); | 1202 forced_draw, swap_requested, readback_requested); |
| 1197 } | 1203 } |
| 1198 | 1204 |
| 1199 DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapForced() { | 1205 DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapForced() { |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1556 completion_event_for_commit_held_on_tree_activation_ = NULL; |
| 1551 } | 1557 } |
| 1552 | 1558 |
| 1553 UpdateBackgroundAnimateTicking(); | 1559 UpdateBackgroundAnimateTicking(); |
| 1554 | 1560 |
| 1555 commit_to_activate_duration_history_.InsertSample( | 1561 commit_to_activate_duration_history_.InsertSample( |
| 1556 base::TimeTicks::HighResNow() - commit_complete_time_); | 1562 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1557 } | 1563 } |
| 1558 | 1564 |
| 1559 } // namespace cc | 1565 } // namespace cc |
| OLD | NEW |