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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 main_frame_events.Pass()); | 1089 main_frame_events.Pass()); |
1090 } | 1090 } |
1091 | 1091 |
1092 Layer* LayerTreeHost::LayerById(int id) const { | 1092 Layer* LayerTreeHost::LayerById(int id) const { |
1093 LayerIdMap::const_iterator iter = layer_id_map_.find(id); | 1093 LayerIdMap::const_iterator iter = layer_id_map_.find(id); |
1094 return iter != layer_id_map_.end() ? iter->second : NULL; | 1094 return iter != layer_id_map_.end() ? iter->second : NULL; |
1095 } | 1095 } |
1096 | 1096 |
1097 void LayerTreeHost::RegisterLayer(Layer* layer) { | 1097 void LayerTreeHost::RegisterLayer(Layer* layer) { |
1098 DCHECK(!LayerById(layer->id())); | 1098 DCHECK(!LayerById(layer->id())); |
| 1099 DCHECK(!in_paint_layer_contents_); |
1099 layer_id_map_[layer->id()] = layer; | 1100 layer_id_map_[layer->id()] = layer; |
1100 if (animation_host_) | 1101 if (animation_host_) |
1101 animation_host_->RegisterLayer(layer->id(), LayerTreeType::ACTIVE); | 1102 animation_host_->RegisterLayer(layer->id(), LayerTreeType::ACTIVE); |
1102 } | 1103 } |
1103 | 1104 |
1104 void LayerTreeHost::UnregisterLayer(Layer* layer) { | 1105 void LayerTreeHost::UnregisterLayer(Layer* layer) { |
1105 DCHECK(LayerById(layer->id())); | 1106 DCHECK(LayerById(layer->id())); |
| 1107 DCHECK(!in_paint_layer_contents_); |
1106 if (animation_host_) | 1108 if (animation_host_) |
1107 animation_host_->UnregisterLayer(layer->id(), LayerTreeType::ACTIVE); | 1109 animation_host_->UnregisterLayer(layer->id(), LayerTreeType::ACTIVE); |
1108 layer_id_map_.erase(layer->id()); | 1110 layer_id_map_.erase(layer->id()); |
1109 } | 1111 } |
1110 | 1112 |
1111 bool LayerTreeHost::IsLayerInTree(int layer_id, LayerTreeType tree_type) const { | 1113 bool LayerTreeHost::IsLayerInTree(int layer_id, LayerTreeType tree_type) const { |
1112 return tree_type == LayerTreeType::ACTIVE; | 1114 return tree_type == LayerTreeType::ACTIVE; |
1113 } | 1115 } |
1114 | 1116 |
1115 void LayerTreeHost::SetMutatorsNeedCommit() { | 1117 void LayerTreeHost::SetMutatorsNeedCommit() { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1209 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
1208 : false; | 1210 : false; |
1209 } | 1211 } |
1210 | 1212 |
1211 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1213 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
1212 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1214 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
1213 : false; | 1215 : false; |
1214 } | 1216 } |
1215 | 1217 |
1216 } // namespace cc | 1218 } // namespace cc |
OLD | NEW |