Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(); | 72 layer_tree_host_remote_->UpdateStateOnInProcessHost(); |
|
Khushal
2016/10/14 20:12:31
We should just kill this method now. I'm not sure
xingliu
2016/10/17 16:26:49
Done.
| |
| 73 } | 73 } |
| 74 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, | 74 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, |
| 75 const gfx::Vector2dF& outer_delta, | 75 const gfx::Vector2dF& outer_delta, |
| 76 const gfx::Vector2dF& elastic_overscroll_delta, | 76 const gfx::Vector2dF& elastic_overscroll_delta, |
| 77 float page_scale, | 77 float page_scale, |
| 78 float top_controls_delta) override {} | 78 float top_controls_delta) override {} |
| 79 void RequestNewCompositorFrameSink() override { | 79 void RequestNewCompositorFrameSink() override { |
| 80 layer_tree_host_remote_->client()->RequestNewCompositorFrameSink(); | 80 layer_tree_host_remote_->client()->RequestNewCompositorFrameSink(); |
| 81 } | 81 } |
| 82 void DidInitializeCompositorFrameSink() override { | 82 void DidInitializeCompositorFrameSink() override { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 layers_scrolled_, | 287 layers_scrolled_, |
| 288 layer_tree_host_in_process_->GetLayerTree()->page_scale_factor()); | 288 layer_tree_host_in_process_->GetLayerTree()->page_scale_factor()); |
| 289 layers_scrolled_.clear(); | 289 layers_scrolled_.clear(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void LayerTreeHostRemoteForTesting::RemoteHostNeedsMainFrame() { | 292 void LayerTreeHostRemoteForTesting::RemoteHostNeedsMainFrame() { |
| 293 layer_tree_host_in_process_->SetNeedsAnimate(); | 293 layer_tree_host_in_process_->SetNeedsAnimate(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void LayerTreeHostRemoteForTesting::ProcessRemoteCompositorUpdate( | 296 void LayerTreeHostRemoteForTesting::ProcessRemoteCompositorUpdate( |
| 297 std::unique_ptr<CompositorProtoState> compositor_proto_state) { | 297 std::unique_ptr<CompositorProtoState> compositor_proto_state) { |
|
Khushal
2016/10/14 20:12:31
Can you add a DCHECK at the beginning of this meth
| |
| 298 pending_compositor_proto_state_ = std::move(compositor_proto_state); | 298 std::unique_ptr<CompositorProtoState> pending_compositor_proto_state = |
|
Khushal
2016/10/14 20:12:31
Don't really need this temp var.
| |
| 299 std::move(compositor_proto_state); | |
| 300 | |
| 301 // Deserialize the update from the remote host into client side LTH in | |
| 302 // process. This bypasses the network layer. | |
| 303 // We can patch test only layer data that are not serialized after the | |
|
Khushal
2016/10/14 20:12:31
I would say do it in this patch itself. This was a
xingliu
2016/10/17 16:26:49
Done. Please help to take a look if the patch logi
| |
| 304 // deserialization. | |
| 305 const proto::LayerTreeHost& layer_tree_host_proto = | |
| 306 pending_compositor_proto_state->compositor_message->layer_tree_host(); | |
| 307 compositor_state_deserializer_->DeserializeCompositorUpdate( | |
| 308 layer_tree_host_proto); | |
| 299 } | 309 } |
| 300 | 310 |
| 301 void LayerTreeHostRemoteForTesting::UpdateStateOnInProcessHost() { | 311 void LayerTreeHostRemoteForTesting::UpdateStateOnInProcessHost() { |
|
Khushal
2016/10/14 20:12:31
Remove this method.
xingliu
2016/10/17 16:26:49
Done.
| |
| 302 // When the InProcess host asks us to update, we de-serialize the update from | |
| 303 // the remote host. | |
| 304 if (pending_compositor_proto_state_) { | |
| 305 const proto::LayerTreeHost& layer_tree_host_proto = | |
| 306 pending_compositor_proto_state_->compositor_message->layer_tree_host(); | |
| 307 compositor_state_deserializer_->DeserializeCompositorUpdate( | |
| 308 layer_tree_host_proto); | |
| 309 | |
| 310 pending_compositor_proto_state_ = nullptr; | |
| 311 | |
| 312 // 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 |
| 313 // 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 |
| 314 // 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 |
| 315 // the commit step. | 315 // the commit step. |
| 316 layer_tree_host_in_process_->SetNeedsCommit(); | 316 layer_tree_host_in_process_->SetNeedsCommit(); |
|
Khushal
2016/10/14 20:12:31
Move this to ProcessRemoteCompositorUpdate. The ai
| |
| 317 } | |
| 318 } | 317 } |
| 319 | 318 |
| 320 } // namespace cc | 319 } // namespace cc |
| OLD | NEW |