Surface synchronization: De-special-case auto-resize

Most resize/synchronization related operations going from browser=>
renderer happen through ViewMsg_Resize except auto-resize. In auto-resize
mode three additional IPCs are used:

ViewMsg_EnableAutoResize
ViewMsg_DisableAutoResize
ViewMsg_SetLocalSurfaceIdForAutoResize

This introduces a lot of auto-resize specific complexity that should
not exist. In this CL, all three auto-resize IPCs are removed and their
operations are coalesced into ViewMsg_Resize.

In the future, we'd like to allocate LocalSurfaceIds in both the parent
and child. By de-special-casing auto-resize, this allows us to simplify
the surface synchronization protocol.

Change-Id: I6d0142353830e0740e67dc7b6075f5588a8e1230
Bug: 672962
Reviewed-on: https://chromium-review.googlesource.com/981394
Reviewed-by: Antoine Labour <[email protected]>
Reviewed-by: Tom Sepez <[email protected]>
Commit-Queue: Fady Samuel <[email protected]>
Cr-Commit-Position: refs/heads/master@{#546723}
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index 748152b..b97c5fb 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -415,6 +415,19 @@
   uint32_t GetContentSourceId();
   void DidNavigate();
 
+  bool auto_resize_mode() const { return auto_resize_mode_; }
+
+  uint64_t auto_resize_sequence_number() const {
+    return auto_resize_sequence_number_;
+  }
+
+  const gfx::Size& min_size_for_auto_resize() const {
+    return min_size_for_auto_resize_;
+  }
+
+  const gfx::Size& max_size_for_auto_resize() const {
+    return max_size_for_auto_resize_;
+  }
   // MainThreadEventQueueClient overrides.
 
   // Requests a BeginMainFrame callback from the compositor.
@@ -537,12 +550,6 @@
       RenderWidgetScreenMetricsEmulator* emulator);
 #endif
 
-  void SetLocalSurfaceIdForAutoResize(
-      uint64_t sequence_number,
-      const content::ScreenInfo& screen_info,
-      uint32_t content_source_id,
-      const viz::LocalSurfaceId& local_surface_id);
-
   // RenderWidget IPC message handlers
   void OnHandleInputEvent(
       const blink::WebInputEvent* event,
@@ -552,13 +559,6 @@
   void OnClose();
   void OnCreatingNewAck();
   virtual void OnResize(const ResizeParams& params);
-  void OnSetLocalSurfaceIdForAutoResize(
-      uint64_t sequence_number,
-      const gfx::Size& min_size,
-      const gfx::Size& max_size,
-      const content::ScreenInfo& screen_info,
-      uint32_t content_source_id,
-      const viz::LocalSurfaceId& local_surface_id);
   void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
   void OnDisableDeviceEmulation();
   virtual void OnWasHidden();
@@ -736,6 +736,12 @@
   // The sequence number used for the auto-resize request.
   uint64_t auto_resize_sequence_number_ = 0;
 
+  // The minimum size to use for auto-resize.
+  gfx::Size min_size_for_auto_resize_;
+
+  // The maximum size to use for auto-resize.
+  gfx::Size max_size_for_auto_resize_;
+
   // A pending ResizeOrRepaintAck callback in response to an auto-resize
   // initiated by Blink. If auto-resize mode is canceled with an in-flight
   // Ack, then the Ack will be canceled.