#ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_
#define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "cc/input/layer_scroll_offset_delegate.h"
#include "content/browser/android/in_process/synchronous_compositor_output_surface.h"
#include "content/port/common/input_event_ack_state.h"
#include "content/public/browser/android/synchronous_compositor.h"
#include "content/public/browser/web_contents_user_data.h"
namespace cc {
class InputHandler;
}
namespace blink {
class WebInputEvent;
}
namespace content {
class InputHandlerManager;
struct DidOverscrollParams;
class SynchronousCompositorImpl
: public cc::LayerScrollOffsetDelegate,
public SynchronousCompositor,
public SynchronousCompositorOutputSurfaceDelegate,
public WebContentsUserData<SynchronousCompositorImpl> {
public:
static SynchronousCompositorImpl* FromID(int process_id, int routing_id);
static SynchronousCompositorImpl* FromRoutingID(int routing_id);
InputEventAckState HandleInputEvent(const blink::WebInputEvent& input_event);
virtual void SetClient(SynchronousCompositorClient* compositor_client)
OVERRIDE;
virtual bool InitializeHwDraw(
scoped_refptr<gfx::GLSurface> surface) OVERRIDE;
virtual void ReleaseHwDraw() OVERRIDE;
virtual bool DemandDrawHw(
gfx::Size surface_size,
const gfx::Transform& transform,
gfx::Rect viewport,
gfx::Rect clip,
bool stencil_enabled) OVERRIDE;
virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE;
virtual void SetMemoryPolicy(
const SynchronousCompositorMemoryPolicy& policy) OVERRIDE;
virtual void DidChangeRootLayerScrollOffset() OVERRIDE;
virtual void DidBindOutputSurface(
SynchronousCompositorOutputSurface* output_surface) OVERRIDE;
virtual void DidDestroySynchronousOutputSurface(
SynchronousCompositorOutputSurface* output_surface) OVERRIDE;
virtual void SetContinuousInvalidate(bool enable) OVERRIDE;
virtual void UpdateFrameMetaData(
const cc::CompositorFrameMetadata& frame_info) OVERRIDE;
virtual void DidActivatePendingTree() OVERRIDE;
virtual void SetMaxScrollOffset(
const gfx::Vector2dF& max_scroll_offset) OVERRIDE;
virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) OVERRIDE;
virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE;
virtual bool IsExternalFlingActive() const OVERRIDE;
virtual void SetTotalPageScaleFactorAndLimits(
float page_scale_factor,
float min_page_scale_factor,
float max_page_scale_factor) OVERRIDE;
virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) OVERRIDE;
void SetInputHandler(cc::InputHandler* input_handler);
void DidOverscroll(const DidOverscrollParams& params);
void DidStopFlinging();
private:
explicit SynchronousCompositorImpl(WebContents* contents);
virtual ~SynchronousCompositorImpl();
friend class WebContentsUserData<SynchronousCompositorImpl>;
void DidCreateSynchronousOutputSurface(
SynchronousCompositorOutputSurface* output_surface);
bool CalledOnValidThread() const;
SynchronousCompositorClient* compositor_client_;
SynchronousCompositorOutputSurface* output_surface_;
WebContents* contents_;
cc::InputHandler* input_handler_;
DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl);
};
}
#endif