| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 event_listener_properties_(), | 243 event_listener_properties_(), |
| 244 animation_host_(std::move(params->animation_host)), | 244 animation_host_(std::move(params->animation_host)), |
| 245 did_complete_scale_animation_(false), | 245 did_complete_scale_animation_(false), |
| 246 in_paint_layer_contents_(false), | 246 in_paint_layer_contents_(false), |
| 247 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 247 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
| 248 next_commit_forces_redraw_(false), | 248 next_commit_forces_redraw_(false), |
| 249 shared_bitmap_manager_(params->shared_bitmap_manager), | 249 shared_bitmap_manager_(params->shared_bitmap_manager), |
| 250 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), | 250 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), |
| 251 task_graph_runner_(params->task_graph_runner), | 251 task_graph_runner_(params->task_graph_runner), |
| 252 image_serialization_processor_(params->image_serialization_processor), | 252 image_serialization_processor_(params->image_serialization_processor), |
| 253 surface_id_namespace_(0u), | 253 surface_client_id_(0u), |
| 254 next_surface_sequence_(1u) { | 254 next_surface_sequence_(1u) { |
| 255 DCHECK(task_graph_runner_); | 255 DCHECK(task_graph_runner_); |
| 256 | 256 |
| 257 DCHECK(animation_host_); | 257 DCHECK(animation_host_); |
| 258 animation_host_->SetMutatorHostClient(this); | 258 animation_host_->SetMutatorHostClient(this); |
| 259 | 259 |
| 260 rendering_stats_instrumentation_->set_record_rendering_stats( | 260 rendering_stats_instrumentation_->set_record_rendering_stats( |
| 261 debug_state_.RecordRenderingStats()); | 261 debug_state_.RecordRenderingStats()); |
| 262 } | 262 } |
| 263 | 263 |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 for (const auto& swap_promise : swap_promise_list_) | 1289 for (const auto& swap_promise : swap_promise_list_) |
| 1290 swap_promise->DidNotSwap(reason); | 1290 swap_promise->DidNotSwap(reason); |
| 1291 swap_promise_list_.clear(); | 1291 swap_promise_list_.clear(); |
| 1292 } | 1292 } |
| 1293 | 1293 |
| 1294 void LayerTreeHost::OnCommitForSwapPromises() { | 1294 void LayerTreeHost::OnCommitForSwapPromises() { |
| 1295 for (const auto& swap_promise : swap_promise_list_) | 1295 for (const auto& swap_promise : swap_promise_list_) |
| 1296 swap_promise->OnCommit(); | 1296 swap_promise->OnCommit(); |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { | 1299 void LayerTreeHost::set_surface_client_id(uint32_t client_id) { |
| 1300 surface_id_namespace_ = id_namespace; | 1300 surface_client_id_ = client_id; |
| 1301 } | 1301 } |
| 1302 | 1302 |
| 1303 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { | 1303 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { |
| 1304 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); | 1304 return SurfaceSequence(surface_client_id_, next_surface_sequence_++); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 void LayerTreeHost::SetLayerTreeMutator( | 1307 void LayerTreeHost::SetLayerTreeMutator( |
| 1308 std::unique_ptr<LayerTreeMutator> mutator) { | 1308 std::unique_ptr<LayerTreeMutator> mutator) { |
| 1309 proxy_->SetMutator(std::move(mutator)); | 1309 proxy_->SetMutator(std::move(mutator)); |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 Layer* LayerTreeHost::LayerById(int id) const { | 1312 Layer* LayerTreeHost::LayerById(int id) const { |
| 1313 LayerIdMap::const_iterator iter = layer_id_map_.find(id); | 1313 LayerIdMap::const_iterator iter = layer_id_map_.find(id); |
| 1314 return iter != layer_id_map_.end() ? iter->second : nullptr; | 1314 return iter != layer_id_map_.end() ? iter->second : nullptr; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 inner_viewport_scroll_layer_ ? inner_viewport_scroll_layer_->id() | 1580 inner_viewport_scroll_layer_ ? inner_viewport_scroll_layer_->id() |
| 1581 : Layer::INVALID_ID); | 1581 : Layer::INVALID_ID); |
| 1582 proto->set_outer_viewport_scroll_layer_id( | 1582 proto->set_outer_viewport_scroll_layer_id( |
| 1583 outer_viewport_scroll_layer_ ? outer_viewport_scroll_layer_->id() | 1583 outer_viewport_scroll_layer_ ? outer_viewport_scroll_layer_->id() |
| 1584 : Layer::INVALID_ID); | 1584 : Layer::INVALID_ID); |
| 1585 | 1585 |
| 1586 LayerSelectionToProtobuf(selection_, proto->mutable_selection()); | 1586 LayerSelectionToProtobuf(selection_, proto->mutable_selection()); |
| 1587 | 1587 |
| 1588 property_trees_.ToProtobuf(proto->mutable_property_trees()); | 1588 property_trees_.ToProtobuf(proto->mutable_property_trees()); |
| 1589 | 1589 |
| 1590 proto->set_surface_id_namespace(surface_id_namespace_); | 1590 proto->set_surface_client_id(surface_client_id_); |
| 1591 proto->set_next_surface_sequence(next_surface_sequence_); | 1591 proto->set_next_surface_sequence(next_surface_sequence_); |
| 1592 | 1592 |
| 1593 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 1593 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
| 1594 "cc.remote", "LayerTreeHostProto", source_frame_number_, | 1594 "cc.remote", "LayerTreeHostProto", source_frame_number_, |
| 1595 ComputeLayerTreeHostProtoSizeSplitAsValue(proto)); | 1595 ComputeLayerTreeHostProtoSizeSplitAsValue(proto)); |
| 1596 } | 1596 } |
| 1597 | 1597 |
| 1598 void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) { | 1598 void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) { |
| 1599 DCHECK(client_picture_cache_); | 1599 DCHECK(client_picture_cache_); |
| 1600 | 1600 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 // Forcefully override the sequence number of all layers in the tree to have | 1682 // Forcefully override the sequence number of all layers in the tree to have |
| 1683 // a valid sequence number. Changing the sequence number for a layer does not | 1683 // a valid sequence number. Changing the sequence number for a layer does not |
| 1684 // need a commit, so the value will become out of date for layers that are not | 1684 // need a commit, so the value will become out of date for layers that are not |
| 1685 // updated for other reasons. All layers that at this point are part of the | 1685 // updated for other reasons. All layers that at this point are part of the |
| 1686 // layer tree are valid, so it is OK that they have a valid sequence number. | 1686 // layer tree are valid, so it is OK that they have a valid sequence number. |
| 1687 int seq_num = property_trees_.sequence_number; | 1687 int seq_num = property_trees_.sequence_number; |
| 1688 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { | 1688 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { |
| 1689 layer->set_property_tree_sequence_number(seq_num); | 1689 layer->set_property_tree_sequence_number(seq_num); |
| 1690 }); | 1690 }); |
| 1691 | 1691 |
| 1692 surface_id_namespace_ = proto.surface_id_namespace(); | 1692 surface_client_id_ = proto.surface_client_id(); |
| 1693 next_surface_sequence_ = proto.next_surface_sequence(); | 1693 next_surface_sequence_ = proto.next_surface_sequence(); |
| 1694 } | 1694 } |
| 1695 | 1695 |
| 1696 } // namespace cc | 1696 } // namespace cc |
| OLD | NEW |