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