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

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

Issue 2404953002: cc/blimp: Set up hooks for scroll/scale sync. (Closed)
Patch Set: braces 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/test/layer_tree_test.h » ('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"
11 #include "cc/blimp/remote_compositor_bridge.h" 11 #include "cc/blimp/remote_compositor_bridge.h"
12 #include "cc/layers/layer.h"
12 #include "cc/proto/compositor_message.pb.h" 13 #include "cc/proto/compositor_message.pb.h"
13 #include "cc/test/fake_image_serialization_processor.h" 14 #include "cc/test/fake_image_serialization_processor.h"
14 #include "cc/test/remote_client_layer_factory.h" 15 #include "cc/test/remote_client_layer_factory.h"
15 #include "cc/trees/layer_tree_host_client.h" 16 #include "cc/trees/layer_tree_host_client.h"
16 #include "cc/trees/layer_tree_host_in_process.h" 17 #include "cc/trees/layer_tree_host_in_process.h"
17 18
18 namespace cc { 19 namespace cc {
19 20
20 class LayerTreeHostRemoteForTesting::RemoteCompositorBridgeImpl 21 class LayerTreeHostRemoteForTesting::RemoteCompositorBridgeImpl
21 : public RemoteCompositorBridge { 22 : public RemoteCompositorBridge {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 : public LayerTreeHostClient { 55 : public LayerTreeHostClient {
55 public: 56 public:
56 LayerTreeHostInProcessClient( 57 LayerTreeHostInProcessClient(
57 LayerTreeHostRemoteForTesting* layer_tree_host_remote) 58 LayerTreeHostRemoteForTesting* layer_tree_host_remote)
58 : layer_tree_host_remote_(layer_tree_host_remote) {} 59 : layer_tree_host_remote_(layer_tree_host_remote) {}
59 60
60 ~LayerTreeHostInProcessClient() override = default; 61 ~LayerTreeHostInProcessClient() override = default;
61 62
62 void WillBeginMainFrame() override {} 63 void WillBeginMainFrame() override {}
63 void BeginMainFrame(const BeginFrameArgs& args) override { 64 void BeginMainFrame(const BeginFrameArgs& args) override {
65 // Send any scroll/scale updates first.
66 layer_tree_host_remote_->ApplyUpdatesFromInProcessHost();
64 layer_tree_host_remote_->BeginMainFrame(); 67 layer_tree_host_remote_->BeginMainFrame();
65 } 68 }
66 void BeginMainFrameNotExpectedSoon() override {} 69 void BeginMainFrameNotExpectedSoon() override {}
67 void DidBeginMainFrame() override {} 70 void DidBeginMainFrame() override {}
68 void UpdateLayerTreeHost() override { 71 void UpdateLayerTreeHost() override {
69 layer_tree_host_remote_->UpdateStateOnInProcessHost(); 72 layer_tree_host_remote_->UpdateStateOnInProcessHost();
70 } 73 }
71 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 74 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
72 const gfx::Vector2dF& outer_delta, 75 const gfx::Vector2dF& outer_delta,
73 const gfx::Vector2dF& elastic_overscroll_delta, 76 const gfx::Vector2dF& elastic_overscroll_delta,
74 float page_scale, 77 float page_scale,
75 float top_controls_delta) override { 78 float top_controls_delta) override {}
76 // TODO(khushalsagar): Hook up when scroll/scale sync is added.
77 }
78 void RequestNewCompositorFrameSink() override { 79 void RequestNewCompositorFrameSink() override {
79 layer_tree_host_remote_->client()->RequestNewCompositorFrameSink(); 80 layer_tree_host_remote_->client()->RequestNewCompositorFrameSink();
80 } 81 }
81 void DidInitializeCompositorFrameSink() override { 82 void DidInitializeCompositorFrameSink() override {
82 layer_tree_host_remote_->client()->DidInitializeCompositorFrameSink(); 83 layer_tree_host_remote_->client()->DidInitializeCompositorFrameSink();
83 } 84 }
84 void DidFailToInitializeCompositorFrameSink() override { 85 void DidFailToInitializeCompositorFrameSink() override {
85 layer_tree_host_remote_->client()->DidFailToInitializeCompositorFrameSink(); 86 layer_tree_host_remote_->client()->DidFailToInitializeCompositorFrameSink();
86 } 87 }
87 void WillCommit() override {} 88 void WillCommit() override {}
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 const gfx::ScrollOffset& new_offset) { 270 const gfx::ScrollOffset& new_offset) {
270 return false; 271 return false;
271 } 272 }
272 273
273 bool LayerTreeHostRemoteForTesting::ShouldRetainClientPageScale( 274 bool LayerTreeHostRemoteForTesting::ShouldRetainClientPageScale(
274 float new_page_scale) { 275 float new_page_scale) {
275 return false; 276 return false;
276 } 277 }
277 278
278 void LayerTreeHostRemoteForTesting::LayerDidScroll(int engine_layer_id) { 279 void LayerTreeHostRemoteForTesting::LayerDidScroll(int engine_layer_id) {
279 // TODO(khushalsagar): Hook up when scroll/scale sync is added. 280 layers_scrolled_[engine_layer_id] =
281 compositor_state_deserializer_->GetLayerForEngineId(engine_layer_id)
282 ->scroll_offset();
283 }
284
285 void LayerTreeHostRemoteForTesting::ApplyUpdatesFromInProcessHost() {
286 ApplyScrollAndScaleUpdateFromClient(
287 layers_scrolled_,
288 layer_tree_host_in_process_->GetLayerTree()->page_scale_factor());
289 layers_scrolled_.clear();
280 } 290 }
281 291
282 void LayerTreeHostRemoteForTesting::RemoteHostNeedsMainFrame() { 292 void LayerTreeHostRemoteForTesting::RemoteHostNeedsMainFrame() {
283 layer_tree_host_in_process_->SetNeedsAnimate(); 293 layer_tree_host_in_process_->SetNeedsAnimate();
284 } 294 }
285 295
286 void LayerTreeHostRemoteForTesting::ProcessRemoteCompositorUpdate( 296 void LayerTreeHostRemoteForTesting::ProcessRemoteCompositorUpdate(
287 std::unique_ptr<CompositorProtoState> compositor_proto_state) { 297 std::unique_ptr<CompositorProtoState> compositor_proto_state) {
288 pending_compositor_proto_state_ = std::move(compositor_proto_state); 298 pending_compositor_proto_state_ = std::move(compositor_proto_state);
289 } 299 }
(...skipping 11 matching lines...) Expand all
301 311
302 // The only case where the remote host would give a compositor update is if 312 // The only case where the remote host would give a compositor update is if
303 // they wanted the main frame to go till the commit pipeline stage. So 313 // they wanted the main frame to go till the commit pipeline stage. So
304 // request one to make sure that the in process main frame also goes till 314 // request one to make sure that the in process main frame also goes till
305 // the commit step. 315 // the commit step.
306 layer_tree_host_in_process_->SetNeedsCommit(); 316 layer_tree_host_in_process_->SetNeedsCommit();
307 } 317 }
308 } 318 }
309 319
310 } // namespace cc 320 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_host_remote_for_testing.h ('k') | cc/test/layer_tree_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698