Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / cc / trees / layer_tree_host_impl.h
index 2b85e32..565e85b 100644 (file)
@@ -30,6 +30,7 @@
 #include "cc/quads/render_pass.h"
 #include "cc/resources/resource_provider.h"
 #include "cc/resources/tile_manager.h"
+#include "cc/scheduler/draw_swap_readback_result.h"
 #include "skia/ext/refptr.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "ui/gfx/rect.h"
@@ -58,6 +59,7 @@ struct RendererCapabilitiesImpl;
 // LayerTreeHost->Proxy callback interface.
 class LayerTreeHostImplClient {
  public:
+  virtual void UpdateRendererCapabilitiesOnImplThread() = 0;
   virtual void DidLoseOutputSurfaceOnImplThread() = 0;
   virtual void DidSwapBuffersOnImplThread() = 0;
   virtual void OnSwapBuffersCompleteOnImplThread() = 0;
@@ -129,7 +131,7 @@ class CC_EXPORT LayerTreeHostImpl
   virtual void PinchGestureUpdate(float magnify_delta,
                                   gfx::Point anchor) OVERRIDE;
   virtual void PinchGestureEnd() OVERRIDE;
-  virtual void StartPageScaleAnimation(gfx::Vector2d target_offset,
+  virtual void StartPageScaleAnimation(const gfx::Vector2d& target_offset,
                                        bool anchor_point,
                                        float page_scale,
                                        base::TimeDelta duration) OVERRIDE;
@@ -179,8 +181,9 @@ class CC_EXPORT LayerTreeHostImpl
   // to avoid displaying the frame. If PrepareToDraw is called, DidDrawAllLayers
   // must also be called, regardless of whether DrawLayers is called between the
   // two.
-  virtual bool PrepareToDraw(FrameData* frame,
-                             const gfx::Rect& damage_rect);
+  virtual DrawSwapReadbackResult::DrawResult PrepareToDraw(
+      FrameData* frame,
+      const gfx::Rect& damage_rect);
   virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time);
   // Must be called if and only if PrepareToDraw was called.
   void DidDrawAllLayers(const FrameData& frame);
@@ -210,6 +213,7 @@ class CC_EXPORT LayerTreeHostImpl
   // excludes the URL bar and non-overlay scrollbars and is in DIP (and
   // invariant relative to page scale).
   gfx::SizeF UnscaledScrollableViewportSize() const;
+  float VerticalAdjust() const;
 
   // RendererClient implementation.
   virtual void SetFullRootLayerDamage() OVERRIDE;
@@ -277,7 +281,8 @@ class CC_EXPORT LayerTreeHostImpl
 
   // Shortcuts to layers on the active tree.
   LayerImpl* RootLayer() const;
-  LayerImpl* RootScrollLayer() const;
+  LayerImpl* InnerViewportScrollLayer() const;
+  LayerImpl* OuterViewportScrollLayer() const;
   LayerImpl* CurrentlyScrollingLayer() const;
 
   int scroll_layer_id_when_mouse_over_scrollbar() {
@@ -297,13 +302,13 @@ class CC_EXPORT LayerTreeHostImpl
   size_t memory_allocation_limit_bytes() const;
   int memory_allocation_priority_cutoff() const;
 
-  void SetViewportSize(gfx::Size device_viewport_size);
+  void SetViewportSize(const gfx::Size& device_viewport_size);
 
   void SetOverdrawBottomHeight(float overdraw_bottom_height);
   float overdraw_bottom_height() const { return overdraw_bottom_height_; }
 
   void SetOverhangUIResource(UIResourceId overhang_ui_resource_id,
-                             gfx::Size overhang_ui_resource_size);
+                             const gfx::Size& overhang_ui_resource_size);
 
   void SetDeviceScaleFactor(float device_scale_factor);
   float device_scale_factor() const { return device_scale_factor_; }
@@ -436,6 +441,9 @@ class CC_EXPORT LayerTreeHostImpl
       SharedBitmapManager* manager,
       int id);
 
+  gfx::SizeF ComputeInnerViewportContainerSize() const;
+  void UpdateInnerViewportContainerSize();
+
   // Virtual for testing.
   virtual void AnimateLayers(base::TimeTicks monotonic_time,
                              base::Time wall_clock_time);
@@ -460,10 +468,12 @@ class CC_EXPORT LayerTreeHostImpl
       bool skip_gl_renderer);
   void CreateAndSetTileManager(ResourceProvider* resource_provider,
                                ContextProvider* context_provider,
-                               bool using_map_image);
+                               bool using_map_image,
+                               bool allow_rasterize_on_demand);
   void ReleaseTreeResources();
   void EnforceZeroBudget(bool zero_budget);
 
+  void ScrollViewportBy(gfx::Vector2dF scroll_delta);
   void AnimatePageScale(base::TimeTicks monotonic_time);
   void AnimateScrollbars(base::TimeTicks monotonic_time);
   void AnimateTopControls(base::TimeTicks monotonic_time);
@@ -474,17 +484,16 @@ class CC_EXPORT LayerTreeHostImpl
       const gfx::PointF& viewport_point,
       const gfx::Vector2dF& viewport_delta);
 
-  void UpdateMaxScrollOffset();
   void TrackDamageForAllSurfaces(
       LayerImpl* root_draw_layer,
       const LayerImplList& render_surface_layer_list);
 
   void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy);
 
-  // Returns false if the frame should not be displayed. This function should
-  // only be called from PrepareToDraw, as DidDrawAllLayers must be called
-  // if this helper function is called.
-  bool CalculateRenderPasses(FrameData* frame);
+  // This function should only be called from PrepareToDraw, as DidDrawAllLayers
+  // must be called if this helper function is called.  Returns DRAW_SUCCESS if
+  // the frame should be drawn.
+  DrawSwapReadbackResult::DrawResult CalculateRenderPasses(FrameData* frame);
 
   void SendReleaseResourcesRecursive(LayerImpl* current);
   bool EnsureRenderSurfaceLayerList();