Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / renderer / gpu / render_widget_compositor.h
index 6c493ea..f80ce06 100644 (file)
@@ -9,11 +9,13 @@
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
 #include "base/values.h"
+#include "cc/base/swap_promise.h"
 #include "cc/base/swap_promise_monitor.h"
 #include "cc/input/top_controls_state.h"
 #include "cc/trees/layer_tree_host_client.h"
 #include "cc/trees/layer_tree_host_single_thread_client.h"
 #include "cc/trees/layer_tree_settings.h"
+#include "content/common/content_export.h"
 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "ui/gfx/rect.h"
@@ -31,9 +33,10 @@ class LayerTreeHost;
 namespace content {
 class RenderWidget;
 
-class RenderWidgetCompositor : public blink::WebLayerTreeView,
-                               public cc::LayerTreeHostClient,
-                               public cc::LayerTreeHostSingleThreadClient {
+class CONTENT_EXPORT RenderWidgetCompositor
+    : NON_EXPORTED_BASE(public blink::WebLayerTreeView),
+      NON_EXPORTED_BASE(public cc::LayerTreeHostClient),
+      NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) {
  public:
   // Attempt to construct and initialize a compositor instance for the widget
   // with the given settings. Returns NULL if initialization fails.
@@ -43,16 +46,13 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
   virtual ~RenderWidgetCompositor();
 
   const base::WeakPtr<cc::InputHandler>& GetInputHandler();
-  void SetSuppressScheduleComposite(bool suppress);
   bool BeginMainFrameRequested() const;
-  void UpdateAnimations(base::TimeTicks time);
-  void Composite(base::TimeTicks frame_begin_time);
   void SetNeedsDisplayOnAllLayers();
   void SetRasterizeOnlyVisibleContent();
   void UpdateTopControlsState(cc::TopControlsState constraints,
                               cc::TopControlsState current,
                               bool animate);
-  void SetOverdrawBottomHeight(float overdraw_bottom_height);
+  void SetTopControlsLayoutHeight(float height);
   void SetNeedsRedrawRect(gfx::Rect damage_rect);
   // Like setNeedsRedraw but forces the frame to be drawn, without early-outs.
   // Redraw will be forced after the next commit
@@ -64,13 +64,19 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
   // into a LatencyInfoSwapPromise.
   scoped_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
       ui::LatencyInfo* latency);
+  // Calling QueueSwapPromise() to directly queue a SwapPromise into
+  // LayerTreeHost.
+  void QueueSwapPromise(scoped_ptr<cc::SwapPromise> swap_promise);
   int GetLayerTreeId() const;
+  int GetSourceFrameNumber() const;
+  void SetNeedsCommit();
   void NotifyInputThrottledUntilCommit();
   const cc::Layer* GetRootLayer() const;
-  bool ScheduleMicroBenchmark(
+  int ScheduleMicroBenchmark(
       const std::string& name,
       scoped_ptr<base::Value> value,
       const base::Callback<void(scoped_ptr<base::Value>)>& callback);
+  bool SendMessageToMicroBenchmark(int id, scoped_ptr<base::Value> value);
 
   // WebLayerTreeView implementation.
   virtual void setSurfaceReady();
@@ -79,6 +85,7 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
   virtual void setViewportSize(
       const blink::WebSize& unused_deprecated,
       const blink::WebSize& device_viewport_size);
+  virtual void setViewportSize(const blink::WebSize& device_viewport_size);
   virtual blink::WebSize layoutViewportSize() const;
   virtual blink::WebSize deviceViewportSize() const;
   virtual blink::WebFloatPoint adjustEventPointForPinchZoom(
@@ -100,7 +107,6 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
   virtual void setNeedsAnimate();
   virtual bool commitRequested() const;
   virtual void didStopFlinging();
-  virtual bool compositeAndReadback(void *pixels, const blink::WebRect& rect);
   virtual void compositeAndReadbackAsync(
       blink::WebCompositeAndReadbackAsyncCallback* callback);
   virtual void finishAllRendering();
@@ -111,21 +117,25 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
       const blink::WebLayer* innerViewportScrollLayer,
       const blink::WebLayer* outerViewportScrollLayer) OVERRIDE;
   virtual void clearViewportLayers() OVERRIDE;
+  virtual void registerSelection(const blink::WebSelectionBound& start,
+                                 const blink::WebSelectionBound& end) OVERRIDE;
+  virtual void clearSelection() OVERRIDE;
   virtual void setShowFPSCounter(bool show);
   virtual void setShowPaintRects(bool show);
   virtual void setShowDebugBorders(bool show);
   virtual void setContinuousPaintingEnabled(bool enabled);
   virtual void setShowScrollBottleneckRects(bool show);
+  virtual void setTopControlsContentOffset(float);
 
   // cc::LayerTreeHostClient implementation.
   virtual void WillBeginMainFrame(int frame_id) OVERRIDE;
   virtual void DidBeginMainFrame() OVERRIDE;
-  virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE;
+  virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE;
   virtual void Layout() OVERRIDE;
-  virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
-                                   float page_scale) OVERRIDE;
-  virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback)
-      OVERRIDE;
+  virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta,
+                                   float page_scale,
+                                   float top_controls_delta) OVERRIDE;
+  virtual void RequestNewOutputSurface(bool fallback) OVERRIDE;
   virtual void DidInitializeOutputSurface() OVERRIDE;
   virtual void WillCommit() OVERRIDE;
   virtual void DidCommit() OVERRIDE;
@@ -134,7 +144,6 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
   virtual void RateLimitSharedMainThreadContext() OVERRIDE;
 
   // cc::LayerTreeHostSingleThreadClient implementation.
-  virtual void ScheduleComposite() OVERRIDE;
   virtual void ScheduleAnimation() OVERRIDE;
   virtual void DidPostSwapBuffers() OVERRIDE;
   virtual void DidAbortSwapBuffers() OVERRIDE;
@@ -145,9 +154,13 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
   void Initialize(cc::LayerTreeSettings settings);
 
   bool threaded_;
-  bool suppress_schedule_composite_;
   RenderWidget* widget_;
   scoped_ptr<cc::LayerTreeHost> layer_tree_host_;
+
+  bool send_v8_idle_notification_after_commit_;
+  base::TimeTicks begin_main_frame_time_;
+  // The time interval between BeginMainFrame calls, provided by the scheduler.
+  base::TimeDelta begin_main_frame_interval_;
 };
 
 }  // namespace content