Chromium Code Reviews| 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 | 216 |
| 217 void LayerTreeHost::DidBeginMainFrame() { | 217 void LayerTreeHost::DidBeginMainFrame() { |
| 218 client_->DidBeginMainFrame(); | 218 client_->DidBeginMainFrame(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void LayerTreeHost::BeginMainFrameNotExpectedSoon() { | 221 void LayerTreeHost::BeginMainFrameNotExpectedSoon() { |
| 222 client_->BeginMainFrameNotExpectedSoon(); | 222 client_->BeginMainFrameNotExpectedSoon(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void LayerTreeHost::BeginMainFrame(const BeginFrameArgs& args) { | 225 void LayerTreeHost::BeginMainFrame(const BeginFrameArgs& args) { |
| 226 inside_begin_main_frame_ = true; | 226 inside_begin_main_frame_ = true; |
|
danakj
2015/09/21 19:48:33
this var is no longer used, can go?
| |
| 227 client_->BeginMainFrame(args); | 227 client_->BeginMainFrame(args); |
| 228 inside_begin_main_frame_ = false; | 228 inside_begin_main_frame_ = false; |
| 229 } | 229 } |
| 230 | 230 |
| 231 void LayerTreeHost::DidStopFlinging() { | 231 void LayerTreeHost::DidStopFlinging() { |
| 232 proxy_->MainThreadHasStoppedFlinging(); | 232 proxy_->MainThreadHasStoppedFlinging(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void LayerTreeHost::Layout() { | 235 void LayerTreeHost::Layout() { |
| 236 client_->Layout(); | 236 client_->Layout(); |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 // TODO(ccameron): pass the elastic overscroll here so that input events | 848 // TODO(ccameron): pass the elastic overscroll here so that input events |
| 849 // may be translated appropriately. | 849 // may be translated appropriately. |
| 850 client_->ApplyViewportDeltas( | 850 client_->ApplyViewportDeltas( |
| 851 inner_viewport_scroll_delta, outer_viewport_scroll_delta, | 851 inner_viewport_scroll_delta, outer_viewport_scroll_delta, |
| 852 info->elastic_overscroll_delta, info->page_scale_delta, | 852 info->elastic_overscroll_delta, info->page_scale_delta, |
| 853 info->top_controls_delta); | 853 info->top_controls_delta); |
| 854 SetNeedsUpdateLayers(); | 854 SetNeedsUpdateLayers(); |
| 855 } | 855 } |
| 856 } | 856 } |
| 857 | 857 |
| 858 void LayerTreeHost::StartRateLimiter() { | |
| 859 if (inside_begin_main_frame_) | |
| 860 return; | |
| 861 | |
| 862 if (!rate_limit_timer_.IsRunning()) { | |
| 863 rate_limit_timer_.Start(FROM_HERE, | |
| 864 base::TimeDelta(), | |
| 865 this, | |
| 866 &LayerTreeHost::RateLimit); | |
| 867 } | |
| 868 } | |
| 869 | |
| 870 void LayerTreeHost::StopRateLimiter() { | |
| 871 rate_limit_timer_.Stop(); | |
| 872 } | |
| 873 | |
| 874 void LayerTreeHost::RateLimit() { | |
| 875 // Force a no-op command on the compositor context, so that any ratelimiting | |
| 876 // commands will wait for the compositing context, and therefore for the | |
| 877 // SwapBuffers. | |
| 878 proxy_->ForceSerializeOnSwapBuffers(); | |
| 879 client_->RateLimitSharedMainThreadContext(); | |
| 880 } | |
| 881 | |
| 882 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { | 858 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { |
| 883 if (device_scale_factor == device_scale_factor_) | 859 if (device_scale_factor == device_scale_factor_) |
| 884 return; | 860 return; |
| 885 device_scale_factor_ = device_scale_factor; | 861 device_scale_factor_ = device_scale_factor; |
| 886 | 862 |
| 887 property_trees_.needs_rebuild = true; | 863 property_trees_.needs_rebuild = true; |
| 888 SetNeedsCommit(); | 864 SetNeedsCommit(); |
| 889 } | 865 } |
| 890 | 866 |
| 891 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, | 867 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1236 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1212 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
| 1237 : false; | 1213 : false; |
| 1238 } | 1214 } |
| 1239 | 1215 |
| 1240 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1216 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
| 1241 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1217 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
| 1242 : false; | 1218 : false; |
| 1243 } | 1219 } |
| 1244 | 1220 |
| 1245 } // namespace cc | 1221 } // namespace cc |
| OLD | NEW |