Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(981)

Unified Diff: cc/blimp/layer_tree_host_remote.cc

Issue 2375363002: cc/blimp: Set up the framework for state serialization. (Closed)
Patch Set: test update Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/blimp/layer_tree_host_remote.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/blimp/layer_tree_host_remote.cc
diff --git a/cc/blimp/layer_tree_host_remote.cc b/cc/blimp/layer_tree_host_remote.cc
index b0158c13682a8e95112f71efb8bf28994eab47e6..f7216e7bd5923975cac49d2acab9217c6493251c 100644
--- a/cc/blimp/layer_tree_host_remote.cc
+++ b/cc/blimp/layer_tree_host_remote.cc
@@ -11,6 +11,8 @@
#include "cc/blimp/remote_compositor_bridge.h"
#include "cc/output/begin_frame_args.h"
#include "cc/output/compositor_frame_sink.h"
+#include "cc/proto/compositor_message.pb.h"
+#include "cc/proto/layer_tree_host.pb.h"
#include "cc/trees/layer_tree.h"
#include "cc/trees/layer_tree_host_client.h"
#include "cc/trees/layer_tree_host_common.h"
@@ -349,8 +351,10 @@ void LayerTreeHostRemote::BeginMainFrame() {
// TODO(khushalsagar): Investigate the data impact from updating all the
// layers. See crbug.com/650885.
LayerTreeHostCommon::CallFunctionForEveryLayer(
- layer_tree_.get(),
- [&layer_list](Layer* layer) { layer_list.push_back(layer); });
+ layer_tree_.get(), [&layer_list](Layer* layer) {
+ layer->SavePaintProperties();
+ layer_list.push_back(layer);
+ });
bool content_is_suitable_for_gpu = false;
bool layers_updated =
@@ -375,10 +379,13 @@ void LayerTreeHostRemote::BeginMainFrame() {
return;
}
- // TODO(khushalsagar): Serialize current state/reset dirty state tracking and
- // return the result to the bridge instead.
std::unique_ptr<CompositorProtoState> compositor_state =
base::MakeUnique<CompositorProtoState>();
+ compositor_state->swap_promises = swap_promise_manager_.TakeSwapPromises();
+ compositor_state->compositor_message =
+ base::MakeUnique<proto::CompositorMessage>();
+ SerializeCurrentState(
+ compositor_state->compositor_message->mutable_layer_tree_host());
remote_compositor_bridge_->ProcessCompositorStateUpdate(
std::move(compositor_state));
@@ -412,4 +419,22 @@ void LayerTreeHostRemote::DispatchDrawAndSwapCallbacks() {
client_->DidCompleteSwapBuffers();
}
+void LayerTreeHostRemote::SerializeCurrentState(
+ proto::LayerTreeHost* layer_tree_host_proto) {
+ // We need to serialize only the inputs received from the embedder.
+ const bool inputs_only = true;
+
+ // Serialize the LayerTree.
+ layer_tree_->ToProtobuf(layer_tree_host_proto->mutable_layer_tree(),
+ inputs_only);
+
+ // Serialize the dirty layers.
+ for (auto* layer : layer_tree_->LayersThatShouldPushProperties())
+ layer->ToLayerPropertiesProto(
+ layer_tree_host_proto->mutable_layer_updates(), inputs_only);
+ layer_tree_->LayersThatShouldPushProperties().clear();
+
+ // TODO(khushalsagar): Deal with picture caching.
+}
+
} // namespace cc
« no previous file with comments | « cc/blimp/layer_tree_host_remote.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698