| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ | 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/input/layer_scroll_offset_delegate.h" |
| 11 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 12 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
| 12 #include "content/public/browser/android/synchronous_compositor.h" | 13 #include "content/public/browser/android/synchronous_compositor.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 17 class InputHandlerManager; |
| 16 | 18 |
| 17 // The purpose of this class is to act as the intermediary between the various | 19 // The purpose of this class is to act as the intermediary between the various |
| 18 // components that make up the 'synchronous compositor mode' implementation and | 20 // components that make up the 'synchronous compositor mode' implementation and |
| 19 // expose their functionality via the SynchronousCompositor interface. | 21 // expose their functionality via the SynchronousCompositor interface. |
| 20 // This class is created on the main thread but most of the APIs are called | 22 // This class is created on the main thread but most of the APIs are called |
| 21 // from the Compositor thread. | 23 // from the Compositor thread. |
| 22 class SynchronousCompositorImpl | 24 class SynchronousCompositorImpl |
| 23 : public SynchronousCompositor, | 25 : public cc::LayerScrollOffsetDelegate, |
| 26 public SynchronousCompositor, |
| 24 public SynchronousCompositorOutputSurfaceDelegate, | 27 public SynchronousCompositorOutputSurfaceDelegate, |
| 25 public WebContentsUserData<SynchronousCompositorImpl> { | 28 public WebContentsUserData<SynchronousCompositorImpl> { |
| 26 public: | 29 public: |
| 27 static SynchronousCompositorImpl* FromRoutingID(int routing_id); | 30 static SynchronousCompositorImpl* FromRoutingID(int routing_id); |
| 28 | 31 |
| 29 // SynchronousCompositor | 32 // SynchronousCompositor |
| 30 virtual bool IsHwReady() OVERRIDE; | 33 virtual bool IsHwReady() OVERRIDE; |
| 31 virtual void SetClient(SynchronousCompositorClient* compositor_client) | 34 virtual void SetClient(SynchronousCompositorClient* compositor_client) |
| 32 OVERRIDE; | 35 OVERRIDE; |
| 33 virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; | 36 virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; |
| 34 virtual bool DemandDrawHw( | 37 virtual bool DemandDrawHw( |
| 35 gfx::Size view_size, | 38 gfx::Size view_size, |
| 36 const gfx::Transform& transform, | 39 const gfx::Transform& transform, |
| 37 gfx::Rect clip) OVERRIDE; | 40 gfx::Rect clip) OVERRIDE; |
| 38 | 41 |
| 39 // SynchronousCompositorOutputSurfaceDelegate | 42 // SynchronousCompositorOutputSurfaceDelegate |
| 40 virtual void DidBindOutputSurface( | 43 virtual void DidBindOutputSurface( |
| 41 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; | 44 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; |
| 42 virtual void DidDestroySynchronousOutputSurface( | 45 virtual void DidDestroySynchronousOutputSurface( |
| 43 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; | 46 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; |
| 44 virtual void SetContinuousInvalidate(bool enable) OVERRIDE; | 47 virtual void SetContinuousInvalidate(bool enable) OVERRIDE; |
| 45 | 48 |
| 49 // LayerScrollOffsetDelegate |
| 50 virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE; |
| 51 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE; |
| 52 |
| 46 private: | 53 private: |
| 47 explicit SynchronousCompositorImpl(WebContents* contents); | 54 explicit SynchronousCompositorImpl(WebContents* contents); |
| 48 virtual ~SynchronousCompositorImpl(); | 55 virtual ~SynchronousCompositorImpl(); |
| 49 friend class WebContentsUserData<SynchronousCompositorImpl>; | 56 friend class WebContentsUserData<SynchronousCompositorImpl>; |
| 50 | 57 |
| 51 void DidCreateSynchronousOutputSurface( | 58 void DidCreateSynchronousOutputSurface( |
| 52 SynchronousCompositorOutputSurface* output_surface); | 59 SynchronousCompositorOutputSurface* output_surface); |
| 53 bool CalledOnValidThread() const; | 60 bool CalledOnValidThread() const; |
| 54 | 61 |
| 55 int routing_id_; | 62 int routing_id_; |
| 56 SynchronousCompositorClient* compositor_client_; | 63 SynchronousCompositorClient* compositor_client_; |
| 57 SynchronousCompositorOutputSurface* output_surface_; | 64 SynchronousCompositorOutputSurface* output_surface_; |
| 58 WebContents* contents_; | 65 WebContents* contents_; |
| 66 InputHandlerManager* input_handler_manager_; |
| 59 | 67 |
| 60 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); | 68 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); |
| 61 }; | 69 }; |
| 62 | 70 |
| 63 } // namespace content | 71 } // namespace content |
| 64 | 72 |
| 65 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ | 73 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
| OLD | NEW |