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/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 client_->SendManagedMemoryStats(); | 231 client_->SendManagedMemoryStats(); |
232 } | 232 } |
233 | 233 |
234 bool LayerTreeHostImpl::CanDraw() { | 234 bool LayerTreeHostImpl::CanDraw() { |
235 // Note: If you are changing this function or any other function that might | 235 // Note: If you are changing this function or any other function that might |
236 // affect the result of CanDraw, make sure to call | 236 // affect the result of CanDraw, make sure to call |
237 // client_->OnCanDrawStateChanged in the proper places and update the | 237 // client_->OnCanDrawStateChanged in the proper places and update the |
238 // NotifyIfCanDrawChanged test. | 238 // NotifyIfCanDrawChanged test. |
239 | 239 |
240 if (!active_tree_->root_layer()) { | 240 if (!active_tree_->root_layer()) { |
241 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer"); | 241 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer", |
| 242 TRACE_EVENT_SCOPE_THREAD); |
242 return false; | 243 return false; |
243 } | 244 } |
244 if (device_viewport_size_.IsEmpty()) { | 245 if (device_viewport_size_.IsEmpty()) { |
245 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport"); | 246 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport", |
| 247 TRACE_EVENT_SCOPE_THREAD); |
246 return false; | 248 return false; |
247 } | 249 } |
248 if (active_tree_->ViewportSizeInvalid()) { | 250 if (active_tree_->ViewportSizeInvalid()) { |
249 TRACE_EVENT_INSTANT0( | 251 TRACE_EVENT_INSTANT0( |
250 "cc", "LayerTreeHostImpl::CanDraw viewport size recently changed"); | 252 "cc", "LayerTreeHostImpl::CanDraw viewport size recently changed", |
| 253 TRACE_EVENT_SCOPE_THREAD); |
251 return false; | 254 return false; |
252 } | 255 } |
253 if (!renderer_) { | 256 if (!renderer_) { |
254 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer"); | 257 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer", |
| 258 TRACE_EVENT_SCOPE_THREAD); |
255 return false; | 259 return false; |
256 } | 260 } |
257 if (active_tree_->ContentsTexturesPurged()) { | 261 if (active_tree_->ContentsTexturesPurged()) { |
258 TRACE_EVENT_INSTANT0( | 262 TRACE_EVENT_INSTANT0( |
259 "cc", "LayerTreeHostImpl::CanDraw contents textures purged"); | 263 "cc", "LayerTreeHostImpl::CanDraw contents textures purged", |
| 264 TRACE_EVENT_SCOPE_THREAD); |
260 return false; | 265 return false; |
261 } | 266 } |
262 return true; | 267 return true; |
263 } | 268 } |
264 | 269 |
265 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time, | 270 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time, |
266 base::Time wall_clock_time) { | 271 base::Time wall_clock_time) { |
267 AnimatePageScale(monotonic_time); | 272 AnimatePageScale(monotonic_time); |
268 AnimateLayers(monotonic_time, wall_clock_time); | 273 AnimateLayers(monotonic_time, wall_clock_time); |
269 AnimateScrollbars(monotonic_time); | 274 AnimateScrollbars(monotonic_time); |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 if (debug_state_.ShowHudRects()) { | 972 if (debug_state_.ShowHudRects()) { |
968 debug_rect_history_->SaveDebugRectsForCurrentFrame( | 973 debug_rect_history_->SaveDebugRectsForCurrentFrame( |
969 active_tree_->root_layer(), | 974 active_tree_->root_layer(), |
970 *frame->render_surface_layer_list, | 975 *frame->render_surface_layer_list, |
971 frame->occluding_screen_space_rects, | 976 frame->occluding_screen_space_rects, |
972 frame->non_occluding_screen_space_rects, | 977 frame->non_occluding_screen_space_rects, |
973 debug_state_); | 978 debug_state_); |
974 } | 979 } |
975 | 980 |
976 if (debug_state_.trace_all_rendered_frames) { | 981 if (debug_state_.trace_all_rendered_frames) { |
977 TRACE_EVENT_INSTANT1("cc.debug", "Frame", | 982 TRACE_EVENT_INSTANT1("cc.debug", "Frame", TRACE_EVENT_SCOPE_THREAD, |
978 "frame", ValueToString(FrameStateAsValue())); | 983 "frame", ValueToString(FrameStateAsValue())); |
979 } | 984 } |
980 | 985 |
981 // Because the contents of the HUD depend on everything else in the frame, the | 986 // Because the contents of the HUD depend on everything else in the frame, the |
982 // contents of its texture are updated as the last thing before the frame is | 987 // contents of its texture are updated as the last thing before the frame is |
983 // drawn. | 988 // drawn. |
984 if (active_tree_->hud_layer()) | 989 if (active_tree_->hud_layer()) |
985 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); | 990 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); |
986 | 991 |
987 renderer_->DrawFrame(frame->render_passes); | 992 renderer_->DrawFrame(frame->render_passes); |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 | 1906 |
1902 void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer, | 1907 void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer, |
1903 base::TimeTicks time) { | 1908 base::TimeTicks time) { |
1904 if (!layer) | 1909 if (!layer) |
1905 return; | 1910 return; |
1906 | 1911 |
1907 ScrollbarAnimationController* scrollbar_controller = | 1912 ScrollbarAnimationController* scrollbar_controller = |
1908 layer->scrollbar_animation_controller(); | 1913 layer->scrollbar_animation_controller(); |
1909 if (scrollbar_controller && scrollbar_controller->Animate(time)) { | 1914 if (scrollbar_controller && scrollbar_controller->Animate(time)) { |
1910 TRACE_EVENT_INSTANT0( | 1915 TRACE_EVENT_INSTANT0( |
1911 "cc", "LayerTreeHostImpl::SetNeedsRedraw due to AnimateScrollbars"); | 1916 "cc", "LayerTreeHostImpl::SetNeedsRedraw due to AnimateScrollbars", |
| 1917 TRACE_EVENT_SCOPE_THREAD); |
1912 client_->SetNeedsRedrawOnImplThread(); | 1918 client_->SetNeedsRedrawOnImplThread(); |
1913 } | 1919 } |
1914 | 1920 |
1915 for (size_t i = 0; i < layer->children().size(); ++i) | 1921 for (size_t i = 0; i < layer->children().size(); ++i) |
1916 AnimateScrollbarsRecursive(layer->children()[i], time); | 1922 AnimateScrollbarsRecursive(layer->children()[i], time); |
1917 } | 1923 } |
1918 | 1924 |
1919 void LayerTreeHostImpl::StartScrollbarAnimation(base::TimeTicks time) { | 1925 void LayerTreeHostImpl::StartScrollbarAnimation(base::TimeTicks time) { |
1920 TRACE_EVENT0("cc", "LayerTreeHostImpl::StartScrollbarAnimation"); | 1926 TRACE_EVENT0("cc", "LayerTreeHostImpl::StartScrollbarAnimation"); |
1921 StartScrollbarAnimationRecursive(RootLayer(), time); | 1927 StartScrollbarAnimationRecursive(RootLayer(), time); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 debug_state_ = debug_state; | 2028 debug_state_ = debug_state; |
2023 } | 2029 } |
2024 | 2030 |
2025 void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time, | 2031 void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time, |
2026 int commit_number) { | 2032 int commit_number) { |
2027 DCHECK(debug_state_.continuous_painting); | 2033 DCHECK(debug_state_.continuous_painting); |
2028 paint_time_counter_->SavePaintTime(total_paint_time, commit_number); | 2034 paint_time_counter_->SavePaintTime(total_paint_time, commit_number); |
2029 } | 2035 } |
2030 | 2036 |
2031 } // namespace cc | 2037 } // namespace cc |
OLD | NEW |