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 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 // The LayerTreeHost on the server does not have an impl task runner. | 1489 // The LayerTreeHost on the server does not have an impl task runner. |
1490 return compositor_mode_ == CompositorMode::REMOTE && | 1490 return compositor_mode_ == CompositorMode::REMOTE && |
1491 !task_runner_provider_->HasImplThread(); | 1491 !task_runner_provider_->HasImplThread(); |
1492 } | 1492 } |
1493 | 1493 |
1494 bool LayerTreeHost::IsRemoteClient() const { | 1494 bool LayerTreeHost::IsRemoteClient() const { |
1495 return compositor_mode_ == CompositorMode::REMOTE && | 1495 return compositor_mode_ == CompositorMode::REMOTE && |
1496 task_runner_provider_->HasImplThread(); | 1496 task_runner_provider_->HasImplThread(); |
1497 } | 1497 } |
1498 | 1498 |
1499 void LayerTreeHost::ToProtobufForCommit(proto::LayerTreeHost* proto) { | 1499 void LayerTreeHost::ToProtobufForCommit( |
| 1500 proto::LayerTreeHost* proto, |
| 1501 std::vector<std::unique_ptr<SwapPromise>>* swap_promises) { |
1500 // Not all fields are serialized, as they are either not needed for a commit, | 1502 // Not all fields are serialized, as they are either not needed for a commit, |
1501 // or implementation isn't ready yet. | 1503 // or implementation isn't ready yet. |
1502 // Unsupported items: | 1504 // Unsupported items: |
1503 // - animations | 1505 // - animations |
1504 // - UI resources | 1506 // - UI resources |
1505 // - instrumentation of stats | 1507 // - instrumentation of stats |
1506 // - histograms | 1508 // - histograms |
1507 // Skipped items: | 1509 // Skipped items: |
1508 // - SwapPromise as they are mostly used for perf measurements. | 1510 // - SwapPromise as they are mostly used for perf measurements. |
1509 // - The bitmap and GPU memory related items. | 1511 // - The bitmap and GPU memory related items. |
1510 // Other notes: | 1512 // Other notes: |
1511 // - The output surfaces are only valid on the client-side so they are | 1513 // - The output surfaces are only valid on the client-side so they are |
1512 // therefore not serialized. | 1514 // therefore not serialized. |
1513 // - LayerTreeSettings are needed only during construction of the | 1515 // - LayerTreeSettings are needed only during construction of the |
1514 // LayerTreeHost, so they are serialized outside of the LayerTreeHost | 1516 // LayerTreeHost, so they are serialized outside of the LayerTreeHost |
1515 // serialization. | 1517 // serialization. |
1516 // - The |visible_| flag will be controlled from the client separately and | 1518 // - The |visible_| flag will be controlled from the client separately and |
1517 // will need special handling outside of the serialization of the | 1519 // will need special handling outside of the serialization of the |
1518 // LayerTreeHost. | 1520 // LayerTreeHost. |
1519 // TODO(nyquist): Figure out how to support animations. See crbug.com/570376. | 1521 // TODO(nyquist): Figure out how to support animations. See crbug.com/570376. |
1520 TRACE_EVENT0("cc.remote", "LayerTreeHost::ToProtobufForCommit"); | 1522 TRACE_EVENT0("cc.remote", "LayerTreeHost::ToProtobufForCommit"); |
| 1523 swap_promises->swap(swap_promise_list_); |
| 1524 DCHECK(swap_promise_list_.empty()); |
| 1525 |
1521 proto->set_needs_full_tree_sync(needs_full_tree_sync_); | 1526 proto->set_needs_full_tree_sync(needs_full_tree_sync_); |
1522 proto->set_needs_meta_info_recomputation(needs_meta_info_recomputation_); | 1527 proto->set_needs_meta_info_recomputation(needs_meta_info_recomputation_); |
1523 proto->set_source_frame_number(source_frame_number_); | 1528 proto->set_source_frame_number(source_frame_number_); |
1524 | 1529 |
1525 LayerProtoConverter::SerializeLayerHierarchy(root_layer_, | 1530 LayerProtoConverter::SerializeLayerHierarchy(root_layer_, |
1526 proto->mutable_root_layer()); | 1531 proto->mutable_root_layer()); |
1527 | 1532 |
1528 // layers_that_should_push_properties_ should be serialized before layer | 1533 // layers_that_should_push_properties_ should be serialized before layer |
1529 // properties because it is cleared during the properties serialization. | 1534 // properties because it is cleared during the properties serialization. |
1530 for (auto layer : layers_that_should_push_properties_) | 1535 for (auto layer : layers_that_should_push_properties_) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 int seq_num = property_trees_.sequence_number; | 1673 int seq_num = property_trees_.sequence_number; |
1669 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { | 1674 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { |
1670 layer->set_property_tree_sequence_number(seq_num); | 1675 layer->set_property_tree_sequence_number(seq_num); |
1671 }); | 1676 }); |
1672 | 1677 |
1673 surface_id_namespace_ = proto.surface_id_namespace(); | 1678 surface_id_namespace_ = proto.surface_id_namespace(); |
1674 next_surface_sequence_ = proto.next_surface_sequence(); | 1679 next_surface_sequence_ = proto.next_surface_sequence(); |
1675 } | 1680 } |
1676 | 1681 |
1677 } // namespace cc | 1682 } // namespace cc |
OLD | NEW |