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

Side by Side Diff: cc/test/layer_tree_host_remote_for_testing.cc

Issue 2416273002: Enable some remote LTH tests in layer_tree_host_unittests. (Closed)
Patch Set: Fixed the compiling.. 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 unified diff | Download patch
« no previous file with comments | « cc/test/layer_tree_host_remote_for_testing.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/test/layer_tree_host_remote_for_testing.h" 5 #include "cc/test/layer_tree_host_remote_for_testing.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.h"
9 #include "cc/blimp/compositor_proto_state.h" 9 #include "cc/blimp/compositor_proto_state.h"
10 #include "cc/blimp/compositor_state_deserializer.h" 10 #include "cc/blimp/compositor_state_deserializer.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 ~LayerTreeHostInProcessClient() override = default; 61 ~LayerTreeHostInProcessClient() override = default;
62 62
63 void WillBeginMainFrame() override {} 63 void WillBeginMainFrame() override {}
64 void BeginMainFrame(const BeginFrameArgs& args) override { 64 void BeginMainFrame(const BeginFrameArgs& args) override {
65 // Send any scroll/scale updates first. 65 // Send any scroll/scale updates first.
66 layer_tree_host_remote_->ApplyUpdatesFromInProcessHost(); 66 layer_tree_host_remote_->ApplyUpdatesFromInProcessHost();
67 layer_tree_host_remote_->BeginMainFrame(); 67 layer_tree_host_remote_->BeginMainFrame();
68 } 68 }
69 void BeginMainFrameNotExpectedSoon() override {} 69 void BeginMainFrameNotExpectedSoon() override {}
70 void DidBeginMainFrame() override {} 70 void DidBeginMainFrame() override {}
71 void UpdateLayerTreeHost() override { 71 void UpdateLayerTreeHost() override {}
72 layer_tree_host_remote_->UpdateStateOnInProcessHost();
73 }
74 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 72 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
75 const gfx::Vector2dF& outer_delta, 73 const gfx::Vector2dF& outer_delta,
76 const gfx::Vector2dF& elastic_overscroll_delta, 74 const gfx::Vector2dF& elastic_overscroll_delta,
77 float page_scale, 75 float page_scale,
78 float top_controls_delta) override {} 76 float top_controls_delta) override {}
79 void RequestNewCompositorFrameSink() override { 77 void RequestNewCompositorFrameSink() override {
80 layer_tree_host_remote_->client()->RequestNewCompositorFrameSink(); 78 layer_tree_host_remote_->client()->RequestNewCompositorFrameSink();
81 } 79 }
82 void DidInitializeCompositorFrameSink() override { 80 void DidInitializeCompositorFrameSink() override {
83 layer_tree_host_remote_->client()->DidInitializeCompositorFrameSink(); 81 layer_tree_host_remote_->client()->DidInitializeCompositorFrameSink();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 layer_tree_host_in_process_->GetLayerTree()->page_scale_factor()); 281 layer_tree_host_in_process_->GetLayerTree()->page_scale_factor());
284 layers_scrolled_.clear(); 282 layers_scrolled_.clear();
285 } 283 }
286 284
287 void LayerTreeHostRemoteForTesting::RemoteHostNeedsMainFrame() { 285 void LayerTreeHostRemoteForTesting::RemoteHostNeedsMainFrame() {
288 layer_tree_host_in_process_->SetNeedsAnimate(); 286 layer_tree_host_in_process_->SetNeedsAnimate();
289 } 287 }
290 288
291 void LayerTreeHostRemoteForTesting::ProcessRemoteCompositorUpdate( 289 void LayerTreeHostRemoteForTesting::ProcessRemoteCompositorUpdate(
292 std::unique_ptr<CompositorProtoState> compositor_proto_state) { 290 std::unique_ptr<CompositorProtoState> compositor_proto_state) {
293 pending_compositor_proto_state_ = std::move(compositor_proto_state); 291 DCHECK(layer_tree_host_in_process_->CommitRequested());
294 } 292 // Deserialize the update from the remote host into client side LTH in
293 // process. This bypasses the network layer.
294 const proto::LayerTreeHost& layer_tree_host_proto =
295 compositor_proto_state->compositor_message->layer_tree_host();
296 compositor_state_deserializer_->DeserializeCompositorUpdate(
297 layer_tree_host_proto);
295 298
296 void LayerTreeHostRemoteForTesting::UpdateStateOnInProcessHost() { 299 const proto::LayerUpdate& layer_updates =
297 // When the InProcess host asks us to update, we de-serialize the update from 300 compositor_proto_state->compositor_message->layer_tree_host()
298 // the remote host. 301 .layer_updates();
299 if (pending_compositor_proto_state_) { 302 for (int i = 0; i < layer_updates.layers_size(); ++i) {
300 const proto::LayerTreeHost& layer_tree_host_proto = 303 int engine_layer_id = layer_updates.layers(i).id();
301 pending_compositor_proto_state_->compositor_message->layer_tree_host(); 304 Layer* engine_layer = GetLayerTree()->LayerById(engine_layer_id);
302 compositor_state_deserializer_->DeserializeCompositorUpdate( 305 Layer* client_layer =
303 layer_tree_host_proto); 306 compositor_state_deserializer_->GetLayerForEngineId(engine_layer_id);
304 307
305 pending_compositor_proto_state_ = nullptr; 308 // 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.
309 // 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.
310 // states with LTH remote after the deserialization.
311 client_layer->SetForceRenderSurfaceForTesting(
312 engine_layer->force_render_surface_for_testing());
313 }
306 314
307 // The only case where the remote host would give a compositor update is if 315 // 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.
308 // they wanted the main frame to go till the commit pipeline stage. So 316 layer_tree_host_in_process_->SetNeedsCommit();
309 // request one to make sure that the in process main frame also goes till
310 // the commit step.
311 layer_tree_host_in_process_->SetNeedsCommit();
312 }
313 } 317 }
314 318
315 } // namespace cc 319 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_host_remote_for_testing.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698