| OLD | NEW | 
|    1 // Copyright 2016 The Chromium Authors. All rights reserved. |    1 // Copyright 2016 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.h" |    5 #include "cc/trees/layer_tree.h" | 
|    6  |    6  | 
|    7 #include "base/auto_reset.h" |    7 #include "base/auto_reset.h" | 
|    8 #include "base/time/time.h" |    8 #include "base/time/time.h" | 
|    9 #include "cc/animation/animation_host.h" |    9 #include "cc/animation/animation_host.h" | 
|   10 #include "cc/input/page_scale_animation.h" |   10 #include "cc/input/page_scale_animation.h" | 
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  223 } |  223 } | 
|  224  |  224  | 
|  225 void LayerTree::SetPaintedDeviceScaleFactor(float painted_device_scale_factor) { |  225 void LayerTree::SetPaintedDeviceScaleFactor(float painted_device_scale_factor) { | 
|  226   if (inputs_.painted_device_scale_factor == painted_device_scale_factor) |  226   if (inputs_.painted_device_scale_factor == painted_device_scale_factor) | 
|  227     return; |  227     return; | 
|  228   inputs_.painted_device_scale_factor = painted_device_scale_factor; |  228   inputs_.painted_device_scale_factor = painted_device_scale_factor; | 
|  229  |  229  | 
|  230   SetNeedsCommit(); |  230   SetNeedsCommit(); | 
|  231 } |  231 } | 
|  232  |  232  | 
 |  233 void LayerTree::SetDeviceColorSpace(const gfx::ColorSpace& device_color_space) { | 
 |  234   if (inputs_.device_color_space == device_color_space) | 
 |  235     return; | 
 |  236   inputs_.device_color_space = device_color_space; | 
 |  237   LayerTreeHostCommon::CallFunctionForEveryLayer( | 
 |  238       this, [](Layer* layer) { layer->SetNeedsDisplay(); }); | 
 |  239 } | 
 |  240  | 
|  233 void LayerTree::RegisterLayer(Layer* layer) { |  241 void LayerTree::RegisterLayer(Layer* layer) { | 
|  234   DCHECK(!LayerById(layer->id())); |  242   DCHECK(!LayerById(layer->id())); | 
|  235   DCHECK(!in_paint_layer_contents_); |  243   DCHECK(!in_paint_layer_contents_); | 
|  236   layer_id_map_[layer->id()] = layer; |  244   layer_id_map_[layer->id()] = layer; | 
|  237   if (layer->element_id()) { |  245   if (layer->element_id()) { | 
|  238     animation_host_->RegisterElement(layer->element_id(), |  246     animation_host_->RegisterElement(layer->element_id(), | 
|  239                                      ElementListType::ACTIVE); |  247                                      ElementListType::ACTIVE); | 
|  240   } |  248   } | 
|  241 } |  249 } | 
|  242  |  250  | 
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  401   tree_impl->set_top_controls_height(inputs_.top_controls_height); |  409   tree_impl->set_top_controls_height(inputs_.top_controls_height); | 
|  402   tree_impl->set_bottom_controls_height(inputs_.bottom_controls_height); |  410   tree_impl->set_bottom_controls_height(inputs_.bottom_controls_height); | 
|  403   tree_impl->PushTopControlsFromMainThread(inputs_.top_controls_shown_ratio); |  411   tree_impl->PushTopControlsFromMainThread(inputs_.top_controls_shown_ratio); | 
|  404   tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); |  412   tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); | 
|  405   if (tree_impl->IsActiveTree()) |  413   if (tree_impl->IsActiveTree()) | 
|  406     tree_impl->elastic_overscroll()->PushPendingToActive(); |  414     tree_impl->elastic_overscroll()->PushPendingToActive(); | 
|  407  |  415  | 
|  408   tree_impl->set_painted_device_scale_factor( |  416   tree_impl->set_painted_device_scale_factor( | 
|  409       inputs_.painted_device_scale_factor); |  417       inputs_.painted_device_scale_factor); | 
|  410  |  418  | 
 |  419   tree_impl->SetDeviceColorSpace(inputs_.device_color_space); | 
 |  420  | 
|  411   if (inputs_.pending_page_scale_animation) { |  421   if (inputs_.pending_page_scale_animation) { | 
|  412     tree_impl->SetPendingPageScaleAnimation( |  422     tree_impl->SetPendingPageScaleAnimation( | 
|  413         std::move(inputs_.pending_page_scale_animation)); |  423         std::move(inputs_.pending_page_scale_animation)); | 
|  414   } |  424   } | 
|  415  |  425  | 
|  416   DCHECK(!tree_impl->ViewportSizeInvalid()); |  426   DCHECK(!tree_impl->ViewportSizeInvalid()); | 
|  417  |  427  | 
|  418   tree_impl->set_has_ever_been_drawn(false); |  428   tree_impl->set_has_ever_been_drawn(false); | 
|  419 } |  429 } | 
|  420  |  430  | 
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  729 LayerListReverseIterator<Layer> LayerTree::rend() { |  739 LayerListReverseIterator<Layer> LayerTree::rend() { | 
|  730   return LayerListReverseIterator<Layer>(nullptr); |  740   return LayerListReverseIterator<Layer>(nullptr); | 
|  731 } |  741 } | 
|  732  |  742  | 
|  733 void LayerTree::SetNeedsDisplayOnAllLayers() { |  743 void LayerTree::SetNeedsDisplayOnAllLayers() { | 
|  734   for (auto* layer : *this) |  744   for (auto* layer : *this) | 
|  735     layer->SetNeedsDisplay(); |  745     layer->SetNeedsDisplay(); | 
|  736 } |  746 } | 
|  737  |  747  | 
|  738 }  // namespace cc |  748 }  // namespace cc | 
| OLD | NEW |