Mac: Add partial swap support to NSOpenGLContext path

Add a damage rect parameter to the structure
GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params.
Because that structure and its IPC are Mac-only, wrap them
in ifdefs.

Add code in the IOSurface draw function to clear out the
difference between the IOSurface and its viewport.

BUG=496484

Review URL: https://codereview.chromium.org/1161853006

Cr-Commit-Position: refs/heads/master@{#333231}
diff --git a/ui/accelerated_widget_mac/io_surface_texture.h b/ui/accelerated_widget_mac/io_surface_texture.h
index 473e69cb..2cdd235 100644
--- a/ui/accelerated_widget_mac/io_surface_texture.h
+++ b/ui/accelerated_widget_mac/io_surface_texture.h
@@ -40,7 +40,6 @@
 class IOSurfaceTexture
     : public base::RefCounted<IOSurfaceTexture> {
  public:
-  // Returns NULL if IOSurfaceTexture or GL API calls fail.
   static scoped_refptr<IOSurfaceTexture> Create(
       bool needs_gl_finish_workaround);
 
@@ -54,6 +53,7 @@
   // larger than the IOSurface, the remaining right and bottom edges will be
   // white. |window_scale_factor| is 1 in normal views, 2 in HiDPI views.
   bool DrawIOSurface() WARN_UNUSED_RESULT;
+  bool DrawIOSurfaceWithDamageRect(gfx::Rect damage_rect) WARN_UNUSED_RESULT;
 
   // Returns true if the offscreen context used by this surface has been
   // poisoned.
@@ -67,6 +67,10 @@
       bool needs_gl_finish_workaround);
   ~IOSurfaceTexture();
 
+  // Draw the sepecified rect of the IOSurface. If |draw_boundary| is true,
+  // clear any overflow regions with white.
+  bool DrawIOSurfaceInternal(gfx::Rect damage_rect, bool draw_boundary);
+
   // Unref the IOSurfaceTexture and delete the associated GL texture. If the GPU
   // process is no longer referencing it, this will delete the IOSurface.
   void ReleaseIOSurfaceAndTexture();