Chromium Code Reviews| Index: cc/test/layer_tree_host_remote_for_testing.cc |
| diff --git a/cc/test/layer_tree_host_remote_for_testing.cc b/cc/test/layer_tree_host_remote_for_testing.cc |
| index edba23d190478c1b92e78a06063d72c7666125c7..cb9a428ff3591a1b02eea0e97467d081e7f9cd58 100644 |
| --- a/cc/test/layer_tree_host_remote_for_testing.cc |
| +++ b/cc/test/layer_tree_host_remote_for_testing.cc |
| @@ -68,9 +68,7 @@ class LayerTreeHostRemoteForTesting::LayerTreeHostInProcessClient |
| } |
| void BeginMainFrameNotExpectedSoon() override {} |
| void DidBeginMainFrame() override {} |
| - void UpdateLayerTreeHost() override { |
| - layer_tree_host_remote_->UpdateStateOnInProcessHost(); |
| - } |
| + void UpdateLayerTreeHost() override {} |
| void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, |
| const gfx::Vector2dF& outer_delta, |
| const gfx::Vector2dF& elastic_overscroll_delta, |
| @@ -290,26 +288,32 @@ void LayerTreeHostRemoteForTesting::RemoteHostNeedsMainFrame() { |
| void LayerTreeHostRemoteForTesting::ProcessRemoteCompositorUpdate( |
| std::unique_ptr<CompositorProtoState> compositor_proto_state) { |
| - pending_compositor_proto_state_ = std::move(compositor_proto_state); |
| -} |
| - |
| -void LayerTreeHostRemoteForTesting::UpdateStateOnInProcessHost() { |
| - // When the InProcess host asks us to update, we de-serialize the update from |
| - // the remote host. |
| - if (pending_compositor_proto_state_) { |
| - const proto::LayerTreeHost& layer_tree_host_proto = |
| - pending_compositor_proto_state_->compositor_message->layer_tree_host(); |
| - compositor_state_deserializer_->DeserializeCompositorUpdate( |
| - layer_tree_host_proto); |
| - |
| - pending_compositor_proto_state_ = nullptr; |
| - |
| - // The only case where the remote host would give a compositor update is if |
| - // they wanted the main frame to go till the commit pipeline stage. So |
| - // request one to make sure that the in process main frame also goes till |
| - // the commit step. |
| - layer_tree_host_in_process_->SetNeedsCommit(); |
| + DCHECK(layer_tree_host_in_process_->CommitRequested()); |
| + // Deserialize the update from the remote host into client side LTH in |
| + // process. This bypasses the network layer. |
| + const proto::LayerTreeHost& layer_tree_host_proto = |
| + compositor_proto_state->compositor_message->layer_tree_host(); |
| + compositor_state_deserializer_->DeserializeCompositorUpdate( |
| + layer_tree_host_proto); |
| + |
| + const proto::LayerUpdate& layer_updates = |
| + compositor_proto_state->compositor_message->layer_tree_host() |
| + .layer_updates(); |
| + for (int i = 0; i < layer_updates.layers_size(); ++i) { |
| + int engine_layer_id = layer_updates.layers(i).id(); |
| + Layer* engine_layer = GetLayerTree()->LayerById(engine_layer_id); |
| + Layer* client_layer = |
| + compositor_state_deserializer_->GetLayerForEngineId(engine_layer_id); |
| + |
| + // Patch test only layer data that are not serialized into network |
|
Khushal
2016/10/18 00:58:02
nit: "Copy test only ..."?
xingliu
2016/10/18 17:26:21
Done.
|
| + // messages. So in test cases, LTH in process will have the same test only |
|
Khushal
2016/10/18 00:58:02
nit: "So in test cases, Layers on the client have
xingliu
2016/10/18 17:26:21
Done.
|
| + // states with LTH remote after the deserialization. |
| + client_layer->SetForceRenderSurfaceForTesting( |
| + engine_layer->force_render_surface_for_testing()); |
| } |
| + |
| + // After deserialization, ask for a new commit. |
|
Khushal
2016/10/18 00:58:01
We should keep the old comment here. The thing is,
xingliu
2016/10/18 17:26:21
Done.
|
| + layer_tree_host_in_process_->SetNeedsCommit(); |
| } |
| } // namespace cc |