OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
| 12 #include "content/public/browser/web_contents_user_data.h" |
| 13 #include "content/public/renderer/android/synchronous_compositor.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 // 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 |
| 19 // expose their functionality via the SynchronousCompositor interface. |
| 20 // This class is created on the main thread but most of the APIs are called |
| 21 // from the Compositor thread. |
| 22 class SynchronousCompositorImpl |
| 23 : public SynchronousCompositor, |
| 24 public SynchronousCompositorOutputSurfaceDelegate, |
| 25 public WebContentsUserData<SynchronousCompositorImpl> { |
| 26 public: |
| 27 // Implementation detail: must be called once on startup in |
| 28 // configurations where the syncrhonous compositor feature is required. |
| 29 static void InitFactory(); |
| 30 static SynchronousCompositorImpl* FromRoutingID(int routing_id); |
| 31 |
| 32 virtual ~SynchronousCompositorImpl(); |
| 33 |
| 34 // SynchronousCompositor |
| 35 virtual bool IsHwReady() OVERRIDE; |
| 36 virtual void SetClient(SynchronousCompositorClient* compositor_client) |
| 37 OVERRIDE; |
| 38 virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; |
| 39 virtual bool DemandDrawHw( |
| 40 gfx::Size view_size, |
| 41 const gfx::Transform& transform, |
| 42 gfx::Rect clip) OVERRIDE; |
| 43 |
| 44 // SynchronousCompositorOutputSurfaceDelegate |
| 45 virtual void DidBindOutputSurface( |
| 46 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; |
| 47 virtual void DidDestroySynchronousOutputSurface( |
| 48 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; |
| 49 virtual void SetContinuousInvalidate(bool enable) OVERRIDE; |
| 50 |
| 51 private: |
| 52 explicit SynchronousCompositorImpl(WebContents* contents); |
| 53 friend class WebContentsUserData<SynchronousCompositorImpl>; |
| 54 |
| 55 void DidCreateSynchronousOutputSurface( |
| 56 SynchronousCompositorOutputSurface* output_surface); |
| 57 bool CalledOnValidThread() const; |
| 58 |
| 59 int routing_id_; |
| 60 SynchronousCompositorClient* compositor_client_; |
| 61 SynchronousCompositorOutputSurface* output_surface_; |
| 62 WebContents* contents_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); |
| 65 }; |
| 66 |
| 67 } // namespace content |
| 68 |
| 69 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
OLD | NEW |