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 "base/memory/weak_ptr.h" |
| 12 #include "cc/input/layer_scroll_offset_delegate.h" |
11 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 13 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
12 #include "content/port/common/input_event_ack_state.h" | 14 #include "content/port/common/input_event_ack_state.h" |
13 #include "content/public/browser/android/synchronous_compositor.h" | 15 #include "content/public/browser/android/synchronous_compositor.h" |
14 #include "content/public/browser/web_contents_user_data.h" | 16 #include "content/public/browser/web_contents_user_data.h" |
15 | 17 |
| 18 namespace cc { |
| 19 class InputHandler; |
| 20 } |
| 21 |
16 namespace WebKit { | 22 namespace WebKit { |
17 class WebInputEvent; | 23 class WebInputEvent; |
18 } | 24 } |
19 | 25 |
20 namespace content { | 26 namespace content { |
| 27 class InputHandlerManager; |
21 | 28 |
22 // The purpose of this class is to act as the intermediary between the various | 29 // The purpose of this class is to act as the intermediary between the various |
23 // components that make up the 'synchronous compositor mode' implementation and | 30 // components that make up the 'synchronous compositor mode' implementation and |
24 // expose their functionality via the SynchronousCompositor interface. | 31 // expose their functionality via the SynchronousCompositor interface. |
25 // This class is created on the main thread but most of the APIs are called | 32 // This class is created on the main thread but most of the APIs are called |
26 // from the Compositor thread. | 33 // from the Compositor thread. |
27 class SynchronousCompositorImpl | 34 class SynchronousCompositorImpl |
28 : public SynchronousCompositor, | 35 : public cc::LayerScrollOffsetDelegate, |
| 36 public SynchronousCompositor, |
29 public SynchronousCompositorOutputSurfaceDelegate, | 37 public SynchronousCompositorOutputSurfaceDelegate, |
30 public WebContentsUserData<SynchronousCompositorImpl> { | 38 public WebContentsUserData<SynchronousCompositorImpl> { |
31 public: | 39 public: |
32 static SynchronousCompositorImpl* FromRoutingID(int routing_id); | 40 static SynchronousCompositorImpl* FromRoutingID(int routing_id); |
33 | 41 |
34 InputEventAckState HandleInputEvent(const WebKit::WebInputEvent& input_event); | 42 InputEventAckState HandleInputEvent(const WebKit::WebInputEvent& input_event); |
35 | 43 |
36 // SynchronousCompositor | 44 // SynchronousCompositor |
37 virtual bool IsHwReady() OVERRIDE; | 45 virtual bool IsHwReady() OVERRIDE; |
38 virtual void SetClient(SynchronousCompositorClient* compositor_client) | 46 virtual void SetClient(SynchronousCompositorClient* compositor_client) |
39 OVERRIDE; | 47 OVERRIDE; |
40 virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; | 48 virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; |
41 virtual bool DemandDrawHw( | 49 virtual bool DemandDrawHw( |
42 gfx::Size view_size, | 50 gfx::Size view_size, |
43 const gfx::Transform& transform, | 51 const gfx::Transform& transform, |
44 gfx::Rect clip) OVERRIDE; | 52 gfx::Rect clip) OVERRIDE; |
| 53 virtual void DidChangeRootLayerScrollOffset() OVERRIDE; |
45 | 54 |
46 // SynchronousCompositorOutputSurfaceDelegate | 55 // SynchronousCompositorOutputSurfaceDelegate |
47 virtual void DidBindOutputSurface( | 56 virtual void DidBindOutputSurface( |
48 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; | 57 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; |
49 virtual void DidDestroySynchronousOutputSurface( | 58 virtual void DidDestroySynchronousOutputSurface( |
50 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; | 59 SynchronousCompositorOutputSurface* output_surface) OVERRIDE; |
51 virtual void SetContinuousInvalidate(bool enable) OVERRIDE; | 60 virtual void SetContinuousInvalidate(bool enable) OVERRIDE; |
52 | 61 |
| 62 // LayerScrollOffsetDelegate |
| 63 virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE; |
| 64 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE; |
| 65 |
| 66 void SetInputHandler(base::WeakPtr<cc::InputHandler> input_handler); |
| 67 |
53 private: | 68 private: |
54 explicit SynchronousCompositorImpl(WebContents* contents); | 69 explicit SynchronousCompositorImpl(WebContents* contents); |
55 virtual ~SynchronousCompositorImpl(); | 70 virtual ~SynchronousCompositorImpl(); |
56 friend class WebContentsUserData<SynchronousCompositorImpl>; | 71 friend class WebContentsUserData<SynchronousCompositorImpl>; |
57 | 72 |
58 void DidCreateSynchronousOutputSurface( | 73 void DidCreateSynchronousOutputSurface( |
59 SynchronousCompositorOutputSurface* output_surface); | 74 SynchronousCompositorOutputSurface* output_surface); |
60 bool CalledOnValidThread() const; | 75 bool CalledOnValidThread() const; |
61 | 76 |
62 int routing_id_; | 77 int routing_id_; |
63 SynchronousCompositorClient* compositor_client_; | 78 SynchronousCompositorClient* compositor_client_; |
64 SynchronousCompositorOutputSurface* output_surface_; | 79 SynchronousCompositorOutputSurface* output_surface_; |
65 WebContents* contents_; | 80 WebContents* contents_; |
| 81 base::WeakPtr<cc::InputHandler> input_handler_; |
66 | 82 |
67 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); | 83 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); |
68 }; | 84 }; |
69 | 85 |
70 } // namespace content | 86 } // namespace content |
71 | 87 |
72 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ | 88 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
OLD | NEW |