Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / render_widget_host_view_mac.h
index 630f76e..fa84570 100644 (file)
@@ -19,7 +19,7 @@
 #include "base/time/time.h"
 #include "content/browser/compositor/browser_compositor_view_mac.h"
 #include "content/browser/compositor/delegated_frame_host.h"
-#include "content/browser/renderer_host/compositing_iosurface_layer_mac.h"
+#include "content/browser/compositor/io_surface_layer_mac.h"
 #include "content/browser/renderer_host/display_link_mac.h"
 #include "content/browser/renderer_host/render_widget_host_view_base.h"
 #include "content/browser/renderer_host/software_frame_manager.h"
@@ -37,8 +37,6 @@ struct ViewHostMsg_TextInputState_Params;
 
 namespace content {
 class BrowserCompositorviewMac;
-class CompositingIOSurfaceMac;
-class CompositingIOSurfaceContext;
 class RenderWidgetHostViewMac;
 class RenderWidgetHostViewMacEditCommandHelper;
 class WebContents;
@@ -49,10 +47,8 @@ class Compositor;
 class Layer;
 }
 
-@class CompositingIOSurfaceLayer;
 @class FullscreenWindowManager;
 @protocol RenderWidgetHostViewMacDelegate;
-@class SoftwareLayer;
 @class ToolTip;
 
 @protocol RenderWidgetHostViewMacOwner
@@ -155,14 +151,6 @@ class Layer;
   // Event monitor for scroll wheel end event.
   id endWheelMonitor_;
 
-  // OpenGL Support:
-
-  // recursive globalFrameDidChange protection:
-  BOOL handlingGlobalFrameDidChange_;
-
-  // The scale factor of the display this view is in.
-  float deviceScaleFactor_;
-
   // If true then escape key down events are suppressed until the first escape
   // key up event. (The up event is suppressed as well). This is used by the
   // flash fullscreen code to avoid sending a key up event without a matching
@@ -219,8 +207,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
       public DelegatedFrameHostClient,
       public BrowserCompositorViewMacClient,
       public IPC::Sender,
-      public SoftwareFrameManagerClient,
-      public CompositingIOSurfaceLayerClient,
       public gfx::DisplayObserver {
  public:
   // The view will associate itself with the given widget. The native view must
@@ -236,7 +222,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
   // |delegate| should be set at most once.
   CONTENT_EXPORT void SetDelegate(
     NSObject<RenderWidgetHostViewMacDelegate>* delegate);
-  void SetAllowOverlappingViews(bool overlapping);
   void SetAllowPauseForResizeOrRepaint(bool allow);
 
   // RenderWidgetHostView implementation.
@@ -245,6 +230,7 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
   virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
   virtual void SetSize(const gfx::Size& size) OVERRIDE;
   virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
+  virtual gfx::Vector2dF GetLastScrollOffset() const OVERRIDE;
   virtual gfx::NativeView GetNativeView() const OVERRIDE;
   virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
   virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
@@ -295,7 +281,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
                                 const gfx::Range& range) OVERRIDE;
   virtual void SelectionBoundsChanged(
       const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE;
-  virtual void ScrollOffsetChanged() OVERRIDE;
   virtual void CopyFromCompositingSurface(
       const gfx::Rect& src_subrect,
       const gfx::Size& dst_size,
@@ -343,18 +328,8 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
   // IPC::Sender implementation.
   virtual bool Send(IPC::Message* message) OVERRIDE;
 
-  // SoftwareFrameManagerClient implementation:
-  virtual void SoftwareFrameWasFreed(
-      uint32 output_surface_id, unsigned frame_id) OVERRIDE;
-  virtual void ReleaseReferencesToSoftwareFrame() OVERRIDE;
-
   virtual SkColorType PreferredReadbackFormat() OVERRIDE;
 
-  // CompositingIOSurfaceLayerClient implementation.
-  virtual bool AcceleratedLayerShouldAckImmediately() const OVERRIDE;
-  virtual void AcceleratedLayerDidDrawFrame() OVERRIDE;
-  virtual void AcceleratedLayerHitError() OVERRIDE;
-
   // gfx::DisplayObserver implementation.
   virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
   virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
@@ -373,18 +348,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
 
   const std::string& selected_text() const { return selected_text_; }
 
-  // Update the IOSurface to be drawn and call setNeedsDisplay on
-  // |cocoa_view_|.
-  void CompositorSwapBuffers(IOSurfaceID surface_handle,
-                             const gfx::Rect& damage_rect,
-                             const gfx::Size& surface_size,
-                             float scale_factor,
-                             const std::vector<ui::LatencyInfo>& latency_info);
-
-  // Called when a GPU error is detected. Posts a task to destroy all
-  // compositing state.
-  void GotAcceleratedCompositingError();
-
   // Returns true and stores first rectangle for character range if the
   // requested |range| is already cached, otherwise returns false.
   // Exposed for testing.
@@ -425,27 +388,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
   // The background CoreAnimation layer which is hosted by |cocoa_view_|.
   base::scoped_nsobject<CALayer> background_layer_;
 
-  // A flipped layer, which acts as the parent of the compositing and software
-  // layers. This layer is flipped so that the we don't need to recompute the
-  // origin for sub-layers when their position changes (this is impossible when
-  // using remote layers, as their size change cannot be synchronized with the
-  // window). This indirection is needed because flipping hosted layers (like
-  // |background_layer_|) leads to unpredictable behavior.
-  base::scoped_nsobject<CALayer> flipped_layer_;
-
-  // The CoreAnimation layer hosted by the GPU process.
-  base::scoped_nsobject<CALayerHost> remote_layer_host_;
-
-  // The CoreAnimation layer for software compositing. This should be NULL
-  // when software compositing is not in use.
-  base::scoped_nsobject<SoftwareLayer> software_layer_;
-
-  // Accelerated compositing structures. These may be dynamically created and
-  // destroyed together in Create/DestroyCompositedIOSurfaceAndLayer.
-  base::scoped_nsobject<CompositingIOSurfaceLayer> compositing_iosurface_layer_;
-  scoped_refptr<CompositingIOSurfaceMac> compositing_iosurface_;
-  scoped_refptr<CompositingIOSurfaceContext> compositing_iosurface_context_;
-
   // Delegated frame management and compositior.
   scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
   scoped_ptr<ui::Layer> root_layer_;
@@ -459,13 +401,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
   scoped_ptr<BrowserCompositorViewPlaceholderMac>
       browser_compositor_view_placeholder_;
 
-  // This holds the current software compositing framebuffer, if any.
-  scoped_ptr<SoftwareFrameManager> software_frame_manager_;
-
-  // Latency info to send back when the next frame appears on the
-  // screen.
-  std::vector<ui::LatencyInfo> pending_latency_info_;
-
   NSWindow* pepper_fullscreen_window() const {
     return pepper_fullscreen_window_;
   }
@@ -476,10 +411,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
     return fullscreen_parent_host_view_;
   }
 
-  RenderWidgetHostViewFrameSubscriber* frame_subscriber() const {
-    return frame_subscriber_.get();
-  }
-
   int window_number() const;
 
   // The scale factor for the screen that the view is currently on.
@@ -491,30 +422,12 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
   // Ensure that the display link is associated with the correct display.
   void UpdateDisplayLink();
 
-  // The scale factor of the backing store. Note that this is updated based on
-  // ViewScaleFactor with some delay.
-  float backing_store_scale_factor_;
-
-  void AddPendingLatencyInfo(
-      const std::vector<ui::LatencyInfo>& latency_info);
-  void SendPendingLatencyInfoToHost();
-
-  void SendPendingSwapAck();
-
   void PauseForPendingResizeOrRepaintsAndDraw();
 
-  // The geometric arrangement of the layers depends on cocoa_view's size, the
-  // compositing IOSurface's rounded size, and the software frame size. Update
-  // all of them using this function when any of those parameters changes. Also
-  // update the scale factor of the layers.
-  void LayoutLayers();
-
   // DelegatedFrameHostClient implementation.
   virtual ui::Compositor* GetCompositor() const OVERRIDE;
   virtual ui::Layer* GetLayer() OVERRIDE;
   virtual RenderWidgetHostImpl* GetHost() OVERRIDE;
-  virtual void SchedulePaintInRect(
-      const gfx::Rect& damage_rect_in_dip) OVERRIDE;
   virtual bool IsVisible() OVERRIDE;
   virtual scoped_ptr<ResizeLock> CreateResizeLock(
       bool defer_compositor_lock) OVERRIDE;
@@ -533,18 +446,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
  private:
   friend class RenderWidgetHostViewMacTest;
 
-  struct PendingSwapAck {
-    PendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id)
-        : route_id(route_id),
-          gpu_host_id(gpu_host_id),
-          renderer_id(renderer_id) {}
-    int32 route_id;
-    int gpu_host_id;
-    int32 renderer_id;
-  };
-  scoped_ptr<PendingSwapAck> pending_swap_ack_;
-  void AddPendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id);
-
   // Returns whether this render view is a popup (autocomplete window).
   bool IsPopup() const;
 
@@ -559,36 +460,11 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
   void EnsureBrowserCompositorView();
   void DestroyBrowserCompositorView();
 
-  void EnsureSoftwareLayer();
-  void DestroySoftwareLayer();
-
-  bool EnsureCompositedIOSurface() WARN_UNUSED_RESULT;
-  void EnsureCompositedIOSurfaceLayer();
-  enum DestroyCompositedIOSurfaceLayerBehavior {
-    kLeaveLayerInHierarchy,
-    kRemoveLayerFromHierarchy,
-  };
-  void DestroyCompositedIOSurfaceLayer(
-      DestroyCompositedIOSurfaceLayerBehavior destroy_layer_behavior);
-  void DestroyCompositedIOSurfaceAndLayer();
-
-  void DestroyCompositingStateOnError();
-
-  // Called when a GPU SwapBuffers is received.
-  void GotAcceleratedFrame();
-
-  // Called when a software DIB is received.
-  void GotSoftwareFrame();
-
   // IPC message handlers.
   void OnPluginFocusChanged(bool focused, int plugin_id);
   void OnStartPluginIme();
   void OnGetRenderedTextCompleted(const std::string& text);
 
-  // Convert |rect| from the views coordinate (upper-left origin) into
-  // the OpenGL coordinate (lower-left origin) and scale for HiDPI displays.
-  gfx::Rect GetScaledOpenGLPixelRect(const gfx::Rect& rect);
-
   // Send updated vsync parameters to the renderer.
   void SendVSyncParametersToRenderer();
 
@@ -606,6 +482,9 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
   // Whether it's allowed to pause waiting for a new frame.
   bool allow_pause_for_resize_or_repaint_;
 
+  // The last scroll offset of the view.
+  gfx::Vector2dF last_scroll_offset_;
+
   // The text to be shown in the tooltip, supplied by the renderer.
   base::string16 tooltip_text_;
 
@@ -639,11 +518,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
   // The current caret bounds.
   gfx::Rect caret_rect_;
 
-  // Subscriber that listens to frame presentation events.
-  scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_;
-
-  base::WeakPtrFactory<RenderWidgetHostViewMac>
-      software_frame_weak_ptr_factory_;
   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac);
 };