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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 // The LayerTreeHost on the server does not have an impl task runner. | 1455 // The LayerTreeHost on the server does not have an impl task runner. |
1456 return compositor_mode_ == CompositorMode::REMOTE && | 1456 return compositor_mode_ == CompositorMode::REMOTE && |
1457 !task_runner_provider_->HasImplThread(); | 1457 !task_runner_provider_->HasImplThread(); |
1458 } | 1458 } |
1459 | 1459 |
1460 bool LayerTreeHost::IsRemoteClient() const { | 1460 bool LayerTreeHost::IsRemoteClient() const { |
1461 return compositor_mode_ == CompositorMode::REMOTE && | 1461 return compositor_mode_ == CompositorMode::REMOTE && |
1462 task_runner_provider_->HasImplThread(); | 1462 task_runner_provider_->HasImplThread(); |
1463 } | 1463 } |
1464 | 1464 |
1465 void LayerTreeHost::ToProtobufForCommit(proto::LayerTreeHost* proto) { | 1465 void LayerTreeHost::ToProtobufForCommit( |
| 1466 proto::LayerTreeHost* proto, |
| 1467 std::vector<std::unique_ptr<SwapPromise>>* swap_promises) { |
1466 // Not all fields are serialized, as they are either not needed for a commit, | 1468 // Not all fields are serialized, as they are either not needed for a commit, |
1467 // or implementation isn't ready yet. | 1469 // or implementation isn't ready yet. |
1468 // Unsupported items: | 1470 // Unsupported items: |
1469 // - animations | 1471 // - animations |
1470 // - UI resources | 1472 // - UI resources |
1471 // - instrumentation of stats | 1473 // - instrumentation of stats |
1472 // - histograms | 1474 // - histograms |
1473 // Skipped items: | 1475 // Skipped items: |
1474 // - SwapPromise as they are mostly used for perf measurements. | 1476 // - SwapPromise as they are mostly used for perf measurements. |
1475 // - The bitmap and GPU memory related items. | 1477 // - The bitmap and GPU memory related items. |
1476 // Other notes: | 1478 // Other notes: |
1477 // - The output surfaces are only valid on the client-side so they are | 1479 // - The output surfaces are only valid on the client-side so they are |
1478 // therefore not serialized. | 1480 // therefore not serialized. |
1479 // - LayerTreeSettings are needed only during construction of the | 1481 // - LayerTreeSettings are needed only during construction of the |
1480 // LayerTreeHost, so they are serialized outside of the LayerTreeHost | 1482 // LayerTreeHost, so they are serialized outside of the LayerTreeHost |
1481 // serialization. | 1483 // serialization. |
1482 // - The |visible_| flag will be controlled from the client separately and | 1484 // - The |visible_| flag will be controlled from the client separately and |
1483 // will need special handling outside of the serialization of the | 1485 // will need special handling outside of the serialization of the |
1484 // LayerTreeHost. | 1486 // LayerTreeHost. |
1485 // TODO(nyquist): Figure out how to support animations. See crbug.com/570376. | 1487 // TODO(nyquist): Figure out how to support animations. See crbug.com/570376. |
1486 TRACE_EVENT0("cc.remote", "LayerTreeHost::ToProtobufForCommit"); | 1488 TRACE_EVENT0("cc.remote", "LayerTreeHost::ToProtobufForCommit"); |
| 1489 swap_promises->swap(swap_promise_list_); |
| 1490 DCHECK(swap_promise_list_.empty()); |
| 1491 |
1487 proto->set_needs_full_tree_sync(needs_full_tree_sync_); | 1492 proto->set_needs_full_tree_sync(needs_full_tree_sync_); |
1488 proto->set_needs_meta_info_recomputation(needs_meta_info_recomputation_); | 1493 proto->set_needs_meta_info_recomputation(needs_meta_info_recomputation_); |
1489 proto->set_source_frame_number(source_frame_number_); | 1494 proto->set_source_frame_number(source_frame_number_); |
1490 | 1495 |
1491 LayerProtoConverter::SerializeLayerHierarchy(root_layer_, | 1496 LayerProtoConverter::SerializeLayerHierarchy(root_layer_, |
1492 proto->mutable_root_layer()); | 1497 proto->mutable_root_layer()); |
1493 | 1498 |
1494 // layers_that_should_push_properties_ should be serialized before layer | 1499 // layers_that_should_push_properties_ should be serialized before layer |
1495 // properties because it is cleared during the properties serialization. | 1500 // properties because it is cleared during the properties serialization. |
1496 for (auto layer : layers_that_should_push_properties_) | 1501 for (auto layer : layers_that_should_push_properties_) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 int seq_num = property_trees_.sequence_number; | 1639 int seq_num = property_trees_.sequence_number; |
1635 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { | 1640 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { |
1636 layer->set_property_tree_sequence_number(seq_num); | 1641 layer->set_property_tree_sequence_number(seq_num); |
1637 }); | 1642 }); |
1638 | 1643 |
1639 surface_id_namespace_ = proto.surface_id_namespace(); | 1644 surface_id_namespace_ = proto.surface_id_namespace(); |
1640 next_surface_sequence_ = proto.next_surface_sequence(); | 1645 next_surface_sequence_ = proto.next_surface_sequence(); |
1641 } | 1646 } |
1642 | 1647 |
1643 } // namespace cc | 1648 } // namespace cc |
OLD | NEW |