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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 device_viewport_damage_rect.Union(viewport_damage_rect_); | 868 device_viewport_damage_rect.Union(viewport_damage_rect_); |
869 viewport_damage_rect_ = gfx::Rect(); | 869 viewport_damage_rect_ = gfx::Rect(); |
870 | 870 |
871 active_tree_->root_layer()->render_surface()->damage_tracker()-> | 871 active_tree_->root_layer()->render_surface()->damage_tracker()-> |
872 AddDamageNextUpdate(device_viewport_damage_rect); | 872 AddDamageNextUpdate(device_viewport_damage_rect); |
873 } | 873 } |
874 | 874 |
875 if (!CalculateRenderPasses(frame)) | 875 if (!CalculateRenderPasses(frame)) |
876 return false; | 876 return false; |
877 | 877 |
| 878 frame->latency_info = active_tree_->GetLatencyInfo(); |
| 879 |
878 // If we return true, then we expect DrawLayers() to be called before this | 880 // If we return true, then we expect DrawLayers() to be called before this |
879 // function is called again. | 881 // function is called again. |
880 return true; | 882 return true; |
881 } | 883 } |
882 | 884 |
883 void LayerTreeHostImpl::EnforceManagedMemoryPolicy( | 885 void LayerTreeHostImpl::EnforceManagedMemoryPolicy( |
884 const ManagedMemoryPolicy& policy) { | 886 const ManagedMemoryPolicy& policy) { |
885 bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread( | 887 bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread( |
886 visible_ ? policy.bytes_limit_when_visible | 888 visible_ ? policy.bytes_limit_when_visible |
887 : policy.bytes_limit_when_not_visible, | 889 : policy.bytes_limit_when_not_visible, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 gfx::Vector2dF(0.f, top_controls_manager_->controls_top_offset()); | 1014 gfx::Vector2dF(0.f, top_controls_manager_->controls_top_offset()); |
1013 metadata.location_bar_content_translation = | 1015 metadata.location_bar_content_translation = |
1014 gfx::Vector2dF(0.f, top_controls_manager_->content_top_offset()); | 1016 gfx::Vector2dF(0.f, top_controls_manager_->content_top_offset()); |
1015 metadata.overdraw_bottom_height = overdraw_bottom_height_; | 1017 metadata.overdraw_bottom_height = overdraw_bottom_height_; |
1016 } | 1018 } |
1017 | 1019 |
1018 if (!RootScrollLayer()) | 1020 if (!RootScrollLayer()) |
1019 return metadata; | 1021 return metadata; |
1020 | 1022 |
1021 metadata.root_scroll_offset = RootScrollLayer()->TotalScrollOffset(); | 1023 metadata.root_scroll_offset = RootScrollLayer()->TotalScrollOffset(); |
| 1024 metadata.latency_info = active_tree_->GetLatencyInfo(); |
1022 | 1025 |
1023 return metadata; | 1026 return metadata; |
1024 } | 1027 } |
1025 | 1028 |
1026 bool LayerTreeHostImpl::AllowPartialSwap() const { | 1029 bool LayerTreeHostImpl::AllowPartialSwap() const { |
1027 // We don't track damage on the HUD layer (it interacts with damage tracking | 1030 // We don't track damage on the HUD layer (it interacts with damage tracking |
1028 // visualizations), so disable partial swaps to make the HUD layer display | 1031 // visualizations), so disable partial swaps to make the HUD layer display |
1029 // properly. | 1032 // properly. |
1030 return !debug_state_.ShowHudRects(); | 1033 return !debug_state_.ShowHudRects(); |
1031 } | 1034 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 return renderer_ && renderer_->IsContextLost(); | 1114 return renderer_ && renderer_->IsContextLost(); |
1112 } | 1115 } |
1113 | 1116 |
1114 const RendererCapabilities& LayerTreeHostImpl::GetRendererCapabilities() const { | 1117 const RendererCapabilities& LayerTreeHostImpl::GetRendererCapabilities() const { |
1115 return renderer_->Capabilities(); | 1118 return renderer_->Capabilities(); |
1116 } | 1119 } |
1117 | 1120 |
1118 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { | 1121 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
1119 if (frame.has_no_damage) | 1122 if (frame.has_no_damage) |
1120 return false; | 1123 return false; |
1121 return renderer_->SwapBuffers(); | 1124 bool result = renderer_->SwapBuffers(frame.latency_info); |
| 1125 if (result) |
| 1126 active_tree_->ClearLatencyInfo(); |
| 1127 return result; |
1122 } | 1128 } |
1123 | 1129 |
1124 void LayerTreeHostImpl::EnableVSyncNotification(bool enable) { | 1130 void LayerTreeHostImpl::EnableVSyncNotification(bool enable) { |
1125 if (output_surface_) | 1131 if (output_surface_) |
1126 output_surface_->EnableVSyncNotification(enable); | 1132 output_surface_->EnableVSyncNotification(enable); |
1127 } | 1133 } |
1128 | 1134 |
1129 gfx::Size LayerTreeHostImpl::DeviceViewportSize() const { | 1135 gfx::Size LayerTreeHostImpl::DeviceViewportSize() const { |
1130 return device_viewport_size(); | 1136 return device_viewport_size(); |
1131 } | 1137 } |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 } | 2101 } |
2096 | 2102 |
2097 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2103 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2098 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2104 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2099 paint_time_counter_->ClearHistory(); | 2105 paint_time_counter_->ClearHistory(); |
2100 | 2106 |
2101 debug_state_ = debug_state; | 2107 debug_state_ = debug_state; |
2102 } | 2108 } |
2103 | 2109 |
2104 } // namespace cc | 2110 } // namespace cc |
OLD | NEW |