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

Unified Diff: cc/test/layer_tree_host_remote_for_testing.cc

Issue 2445093002: cc/blimp: Add synchronization for scroll/scale state. (Closed)
Patch Set: move application of deltas to push time. 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
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 9c48b89ec6ab1f5cb191a9ea0ce9d08f3a05a5a6..b3410d910f30cb279848cc941d7f14efc5fefa56 100644
--- a/cc/test/layer_tree_host_remote_for_testing.cc
+++ b/cc/test/layer_tree_host_remote_for_testing.cc
@@ -62,9 +62,7 @@ class LayerTreeHostRemoteForTesting::LayerTreeHostInProcessClient
void WillBeginMainFrame() override {}
void BeginMainFrame(const BeginFrameArgs& args) override {
- // Send any scroll/scale updates first.
- layer_tree_host_remote_->ApplyUpdatesFromInProcessHost();
- layer_tree_host_remote_->BeginMainFrame();
+ layer_tree_host_remote_->BeginRemoteMainFrame();
}
void BeginMainFrameNotExpectedSoon() override {}
void DidBeginMainFrame() override {}
@@ -214,10 +212,7 @@ void LayerTreeHostRemoteForTesting::Initialize(
compositor_state_deserializer_ =
base::MakeUnique<CompositorStateDeserializer>(
layer_tree_host_in_process_.get(),
- image_serialization_processor_->CreateClientPictureCache(),
- base::Bind(&LayerTreeHostRemoteForTesting::LayerDidScroll,
- base::Unretained(this)),
- this);
+ image_serialization_processor_->CreateClientPictureCache(), this);
// Override the LayerFactory since a lot of tests rely on the fact that Layers
// and LayerImpls have matching ids.
@@ -252,43 +247,36 @@ LayerTreeHostRemoteForTesting::CreateLayerTreeHostInProcess(
return LayerTreeHostInProcess::CreateThreaded(impl_task_runner, &params);
}
+void LayerTreeHostRemoteForTesting::DidUpdateLocalState() {
+ client_state_dirty_ = true;
+}
+
void LayerTreeHostRemoteForTesting::DispatchDrawAndSubmitCallbacks() {
// Don't dispatch callbacks right after the commit on the remote host. Since
// tests rely on CompositorFrames being swapped on the CompositorFrameSink,
// we wait for these callbacks from the LayerTreeHostInProcess.
}
-bool LayerTreeHostRemoteForTesting::ShouldRetainClientScroll(
- int engine_layer_id,
- const gfx::ScrollOffset& new_offset) {
- return false;
-}
-
-bool LayerTreeHostRemoteForTesting::ShouldRetainClientPageScale(
- float new_page_scale) {
- return false;
-}
-
-void LayerTreeHostRemoteForTesting::LayerDidScroll(int engine_layer_id) {
- layers_scrolled_[engine_layer_id] =
- compositor_state_deserializer_->GetLayerForEngineId(engine_layer_id)
- ->scroll_offset();
+void LayerTreeHostRemoteForTesting::RemoteHostNeedsMainFrame() {
+ layer_tree_host_in_process_->SetNeedsAnimate();
}
-void LayerTreeHostRemoteForTesting::ApplyUpdatesFromInProcessHost() {
- ApplyScrollAndScaleUpdateFromClient(
- layers_scrolled_,
- layer_tree_host_in_process_->GetLayerTree()->page_scale_factor());
- layers_scrolled_.clear();
-}
+void LayerTreeHostRemoteForTesting::BeginRemoteMainFrame() {
+ // Send scroll/scale updates first if modified on the impl thread.
+ if (client_state_dirty_) {
+ proto::ClientStateUpdate client_state_update;
+ compositor_state_deserializer_->PullClientStateUpdate(&client_state_update);
+ ApplyStateUpdateFromClient(client_state_update);
+ client_state_dirty_ = false;
+ }
-void LayerTreeHostRemoteForTesting::RemoteHostNeedsMainFrame() {
- layer_tree_host_in_process_->SetNeedsAnimate();
+ BeginMainFrame();
}
void LayerTreeHostRemoteForTesting::ProcessRemoteCompositorUpdate(
std::unique_ptr<CompositorProtoState> compositor_proto_state) {
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 =

Powered by Google App Engine
This is Rietveld 408576698