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

Unified Diff: blimp/engine/renderer/blimp_remote_compositor_bridge.cc

Issue 2445093002: cc/blimp: Add synchronization for scroll/scale state. (Closed)
Patch Set: Addressed comments 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: blimp/engine/renderer/blimp_remote_compositor_bridge.cc
diff --git a/blimp/engine/renderer/blimp_remote_compositor_bridge.cc b/blimp/engine/renderer/blimp_remote_compositor_bridge.cc
index 1ebbde0707ef8d5f04ee15a2c638d37b98a6d384..bd2b8c50712d2b10870f7dd4582daee2e7c24ed3 100644
--- a/blimp/engine/renderer/blimp_remote_compositor_bridge.cc
+++ b/blimp/engine/renderer/blimp_remote_compositor_bridge.cc
@@ -35,6 +35,10 @@ void BlimpRemoteCompositorBridge::ScheduleMainFrame() {
void BlimpRemoteCompositorBridge::ProcessCompositorStateUpdate(
std::unique_ptr<cc::CompositorProtoState> compositor_proto_state) {
+ compositor_proto_state->compositor_message->set_client_state_update_ack(
+ client_state_update_ack_pending_);
+ client_state_update_ack_pending_ = false;
+
remote_proto_channel_->SendCompositorProto(
*compositor_proto_state->compositor_message);
scheduler_.DidSendFrameUpdateToClient();
@@ -46,12 +50,39 @@ void BlimpRemoteCompositorBridge::ProcessCompositorStateUpdate(
void BlimpRemoteCompositorBridge::OnProtoReceived(
std::unique_ptr<cc::proto::CompositorMessage> proto) {
- DCHECK(proto->frame_ack());
- scheduler_.DidReceiveFrameUpdateAck();
+ if (proto->frame_ack())
+ scheduler_.DidReceiveFrameUpdateAck();
+
+ if (proto->has_client_state_update()) {
+ DCHECK(!client_state_update_ack_pending_);
+
+ client_->ApplyStateUpdateFromClient(proto->client_state_update());
+
+ // If applying the delta resulted in a frame request, run the main frame
+ // first so the ack sent to the client includes the frame with the deltas
+ // applied.
+ if (scheduler_.needs_frame_update()) {
+ client_state_update_ack_pending_ = true;
+ } else {
+ cc::proto::CompositorMessage message;
+ message.set_client_state_update_ack(true);
+ remote_proto_channel_->SendCompositorProto(message);
+ }
+ }
}
void BlimpRemoteCompositorBridge::StartFrameUpdate() {
client_->BeginMainFrame();
+
+ // If the frame resulted in an update to the client, the ack should have gone
+ // with it. If it is still pending, this means the main frame was aborted so
+ // send the ack now.
+ if (client_state_update_ack_pending_) {
+ client_state_update_ack_pending_ = false;
+ cc::proto::CompositorMessage message;
+ message.set_client_state_update_ack(true);
+ remote_proto_channel_->SendCompositorProto(message);
+ }
}
} // namespace engine

Powered by Google App Engine
This is Rietveld 408576698