OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
6 #define CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/observer_list.h" |
9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
10 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
11 #include "cc/output/output_surface.h" | 12 #include "cc/output/output_surface.h" |
12 | 13 |
13 namespace base { class MessageLoopProxy; } | 14 namespace base { class MessageLoopProxy; } |
14 | 15 |
15 namespace ui { class Compositor; } | 16 namespace ui { class Compositor; } |
16 | 17 |
17 namespace content { | 18 namespace content { |
| 19 class BrowserCompositorOutputSurfaceCapturer; |
18 class ReflectorImpl; | 20 class ReflectorImpl; |
| 21 class WebGraphicsContext3DCommandBufferImpl; |
19 | 22 |
20 // Adapts a WebGraphicsContext3DCommandBufferImpl into a | 23 // Adapts a WebGraphicsContext3DCommandBufferImpl into a |
21 // cc::OutputSurface that also handles vsync parameter updates | 24 // cc::OutputSurface that also handles vsync parameter updates |
22 // arriving from the GPU process. | 25 // arriving from the GPU process. |
23 class BrowserCompositorOutputSurface | 26 class BrowserCompositorOutputSurface |
24 : public cc::OutputSurface, | 27 : public cc::OutputSurface, |
25 public base::NonThreadSafe { | 28 public base::NonThreadSafe { |
26 public: | 29 public: |
27 BrowserCompositorOutputSurface( | 30 BrowserCompositorOutputSurface( |
28 scoped_ptr<WebKit::WebGraphicsContext3D> context, | 31 scoped_ptr<WebKit::WebGraphicsContext3D> context, |
29 int surface_id, | 32 int surface_id, |
30 IDMap<BrowserCompositorOutputSurface>* output_surface_map, | 33 IDMap<BrowserCompositorOutputSurface>* output_surface_map, |
31 base::MessageLoopProxy* compositor_message_loop, | 34 const scoped_refptr<base::MessageLoopProxy>& compositor_message_loop, |
32 base::WeakPtr<ui::Compositor> compositor); | 35 base::WeakPtr<ui::Compositor> compositor); |
33 | 36 |
34 virtual ~BrowserCompositorOutputSurface(); | 37 virtual ~BrowserCompositorOutputSurface(); |
35 | 38 |
36 // cc::OutputSurface implementation. | 39 // cc::OutputSurface implementation. |
37 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; | 40 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; |
38 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE; | 41 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE; |
39 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; | 42 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; |
40 | 43 |
41 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 44 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
42 base::TimeDelta interval); | 45 base::TimeDelta interval); |
43 | 46 |
44 void SetReflector(ReflectorImpl* reflector); | 47 void SetReflector(ReflectorImpl* reflector); |
45 | 48 |
| 49 void AddCapturer(BrowserCompositorOutputSurfaceCapturer* capturer); |
| 50 void RemoveCapturer(BrowserCompositorOutputSurfaceCapturer* capturer); |
| 51 |
| 52 WebGraphicsContext3DCommandBufferImpl* GetContext3DCommandBufferImpl(); |
| 53 |
46 private: | 54 private: |
47 int surface_id_; | 55 int surface_id_; |
48 IDMap<BrowserCompositorOutputSurface>* output_surface_map_; | 56 IDMap<BrowserCompositorOutputSurface>* output_surface_map_; |
49 | 57 |
50 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_; | 58 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_; |
51 base::WeakPtr<ui::Compositor> compositor_; | 59 base::WeakPtr<ui::Compositor> compositor_; |
52 scoped_refptr<ReflectorImpl> reflector_; | 60 scoped_refptr<ReflectorImpl> reflector_; |
| 61 ObserverList<BrowserCompositorOutputSurfaceCapturer> capturer_list_; |
53 }; | 62 }; |
54 | 63 |
55 } // namespace content | 64 } // namespace content |
56 | 65 |
57 #endif // CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 66 #endif // CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |