| 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_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
| 6 #define CONTENT_RENDERER_ANDROID_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 "cc/input/layer_scroll_offset_delegate.h" |
| 12 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" |
| 12 #include "content/public/renderer/android/synchronous_compositor.h" | 14 #include "content/public/renderer/android/synchronous_compositor.h" |
| 13 #include "content/renderer/android/synchronous_compositor_output_surface.h" | |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 class OutputSurface; | 17 class OutputSurface; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 // The purpose of this class is to act as the intermediary between the various | 22 // The purpose of this class is to act as the intermediary between the various |
| 22 // components that make up the 'synchronous compositor mode' implementation and | 23 // components that make up the 'synchronous compositor mode' implementation and |
| 23 // expose their functionality via the SynchronousCompositor interface. | 24 // expose their functionality via the SynchronousCompositor interface. |
| 24 // This class is created on the main thread but most of the APIs are called | 25 // This class is created on the main thread but most of the APIs are called |
| 25 // from the Compositor thread. | 26 // from the Compositor thread. |
| 26 class SynchronousCompositorImpl | 27 class SynchronousCompositorImpl |
| 27 : public SynchronousCompositor, | 28 : public SynchronousCompositor, |
| 28 public SynchronousCompositorOutputSurfaceDelegate { | 29 public SynchronousCompositorOutputSurfaceDelegate, |
| 30 public WebContentsUserData<SynchronousCompositorImpl> { |
| 29 public: | 31 public: |
| 30 explicit SynchronousCompositorImpl(int32 routing_id); | 32 static void InitFactory(); |
| 33 |
| 31 virtual ~SynchronousCompositorImpl(); | 34 virtual ~SynchronousCompositorImpl(); |
| 32 | 35 |
| 33 scoped_ptr<cc::OutputSurface> CreateOutputSurface(); | |
| 34 | |
| 35 // SynchronousCompositor | 36 // SynchronousCompositor |
| 36 virtual bool IsHwReady() OVERRIDE; | 37 virtual bool IsHwReady() OVERRIDE; |
| 37 virtual void SetClient(SynchronousCompositorClient* compositor_client) | 38 virtual void SetClient(SynchronousCompositorClient* compositor_client) |
| 38 OVERRIDE; | 39 OVERRIDE; |
| 39 virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; | 40 virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; |
| 40 virtual bool DemandDrawHw( | 41 virtual bool DemandDrawHw( |
| 41 gfx::Size view_size, | 42 gfx::Size view_size, |
| 42 const gfx::Transform& transform, | 43 const gfx::Transform& transform, |
| 43 gfx::Rect clip) OVERRIDE; | 44 gfx::Rect clip) OVERRIDE; |
| 44 | 45 |
| 45 // SynchronousCompositorOutputSurfaceDelegate | 46 // SynchronousCompositorOutputSurfaceDelegate |
| 46 virtual void SetContinuousInvalidate(bool enable) OVERRIDE; | 47 virtual void SetContinuousInvalidate(bool enable) OVERRIDE; |
| 47 virtual void DidCreateSynchronousOutputSurface() OVERRIDE; | |
| 48 virtual void DidDestroySynchronousOutputSurface() OVERRIDE; | 48 virtual void DidDestroySynchronousOutputSurface() OVERRIDE; |
| 49 | 49 |
| 50 static void DidBindOutputSurface( |
| 51 int routing_id, SynchronousCompositorOutputSurface* output_surface); |
| 52 |
| 50 private: | 53 private: |
| 54 explicit SynchronousCompositorImpl(WebContents* contents); |
| 55 |
| 56 void DidCreateSynchronousOutputSurface( |
| 57 SynchronousCompositorOutputSurface* output_surface); |
| 51 bool CalledOnValidThread() const; | 58 bool CalledOnValidThread() const; |
| 52 | 59 |
| 53 int routing_id_; | 60 int routing_id_; |
| 54 SynchronousCompositorClient* compositor_client_; | 61 SynchronousCompositorClient* compositor_client_; |
| 55 SynchronousCompositorOutputSurface* output_surface_; | 62 SynchronousCompositorOutputSurface* output_surface_; |
| 63 WebContents* contents_; |
| 56 | 64 |
| 57 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); | 65 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); |
| 58 }; | 66 }; |
| 59 | 67 |
| 60 } // namespace content | 68 } // namespace content |
| 61 | 69 |
| 62 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_IMPL_H_ | 70 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
| OLD | NEW |