OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
10 #include "cc/output/output_surface.h" | 10 #include "cc/output/output_surface.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "ui/compositor/compositor_vsync_manager.h" | |
13 | 12 |
14 namespace cc { | 13 namespace cc { |
15 class SoftwareOutputDevice; | 14 class SoftwareOutputDevice; |
16 } | 15 } |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 class ContextProviderCommandBuffer; | 18 class ContextProviderCommandBuffer; |
20 class ReflectorImpl; | 19 class ReflectorImpl; |
21 class WebGraphicsContext3DCommandBufferImpl; | 20 class WebGraphicsContext3DCommandBufferImpl; |
22 | 21 |
23 class CONTENT_EXPORT BrowserCompositorOutputSurface | 22 class CONTENT_EXPORT BrowserCompositorOutputSurface |
24 : public cc::OutputSurface, | 23 : public cc::OutputSurface, |
25 public ui::CompositorVSyncManager::Observer, | |
26 public base::NonThreadSafe { | 24 public base::NonThreadSafe { |
27 public: | 25 public: |
28 virtual ~BrowserCompositorOutputSurface(); | 26 virtual ~BrowserCompositorOutputSurface(); |
29 | 27 |
30 // cc::OutputSurface implementation. | 28 // cc::OutputSurface implementation. |
31 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; | 29 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; |
32 virtual void OnSwapBuffersComplete() OVERRIDE; | 30 virtual void OnSwapBuffersComplete() OVERRIDE; |
33 | 31 |
34 // ui::CompositorOutputSurface::Observer implementation. | |
35 virtual void OnUpdateVSyncParameters(base::TimeTicks timebase, | |
36 base::TimeDelta interval) OVERRIDE; | |
37 | |
38 void OnUpdateVSyncParametersFromGpu(base::TimeTicks tiembase, | 32 void OnUpdateVSyncParametersFromGpu(base::TimeTicks tiembase, |
39 base::TimeDelta interval); | 33 base::TimeDelta interval); |
40 | 34 |
41 void SetReflector(ReflectorImpl* reflector); | 35 void SetReflector(ReflectorImpl* reflector); |
42 | 36 |
43 #if defined(OS_MACOSX) | 37 #if defined(OS_MACOSX) |
44 void OnSurfaceDisplayed(); | 38 void OnSurfaceDisplayed(); |
45 #endif | 39 #endif |
46 | 40 |
47 protected: | 41 protected: |
48 // Constructor used by the accelerated implementation. | 42 // Constructor used by the accelerated implementation. |
49 BrowserCompositorOutputSurface( | 43 BrowserCompositorOutputSurface( |
50 const scoped_refptr<ContextProviderCommandBuffer>& context, | 44 const scoped_refptr<ContextProviderCommandBuffer>& context, |
51 int surface_id, | 45 int surface_id, |
52 IDMap<BrowserCompositorOutputSurface>* output_surface_map, | 46 IDMap<BrowserCompositorOutputSurface>* output_surface_map); |
53 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager); | |
54 | 47 |
55 // Constructor used by the software implementation. | 48 // Constructor used by the software implementation. |
56 BrowserCompositorOutputSurface( | 49 BrowserCompositorOutputSurface( |
57 scoped_ptr<cc::SoftwareOutputDevice> software_device, | 50 scoped_ptr<cc::SoftwareOutputDevice> software_device, |
58 int surface_id, | 51 int surface_id, |
59 IDMap<BrowserCompositorOutputSurface>* output_surface_map, | 52 IDMap<BrowserCompositorOutputSurface>* output_surface_map); |
60 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager); | |
61 | 53 |
62 int surface_id_; | 54 int surface_id_; |
63 IDMap<BrowserCompositorOutputSurface>* output_surface_map_; | 55 IDMap<BrowserCompositorOutputSurface>* output_surface_map_; |
64 | 56 |
65 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; | |
66 scoped_refptr<ReflectorImpl> reflector_; | 57 scoped_refptr<ReflectorImpl> reflector_; |
67 | 58 |
68 private: | 59 private: |
69 void Initialize(); | 60 void Initialize(); |
70 | 61 |
71 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface); | 62 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface); |
72 }; | 63 }; |
73 | 64 |
74 } // namespace content | 65 } // namespace content |
75 | 66 |
76 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 67 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |