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