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