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/threading/non_thread_safe.h" | 8 #include "base/threading/non_thread_safe.h" |
9 #include "cc/output/output_surface.h" | 9 #include "cc/output/output_surface.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "ui/compositor/compositor_vsync_manager.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 class SoftwareOutputDevice; | 14 class SoftwareOutputDevice; |
14 } | 15 } |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class ContextProviderCommandBuffer; | 18 class ContextProviderCommandBuffer; |
18 class ReflectorImpl; | 19 class ReflectorImpl; |
19 class WebGraphicsContext3DCommandBufferImpl; | 20 class WebGraphicsContext3DCommandBufferImpl; |
20 | 21 |
21 class CONTENT_EXPORT BrowserCompositorOutputSurface | 22 class CONTENT_EXPORT BrowserCompositorOutputSurface |
22 : public cc::OutputSurface { | 23 : public cc::OutputSurface, |
| 24 public ui::CompositorVSyncManager::Observer { |
23 public: | 25 public: |
24 ~BrowserCompositorOutputSurface() override; | 26 ~BrowserCompositorOutputSurface() override; |
25 | 27 |
| 28 // cc::OutputSurface implementation. |
| 29 bool BindToClient(cc::OutputSurfaceClient* client) override; |
| 30 |
| 31 // ui::CompositorOutputSurface::Observer implementation. |
| 32 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 33 base::TimeDelta interval) override; |
| 34 |
26 void OnUpdateVSyncParametersFromGpu(base::TimeTicks tiembase, | 35 void OnUpdateVSyncParametersFromGpu(base::TimeTicks tiembase, |
27 base::TimeDelta interval); | 36 base::TimeDelta interval); |
28 | 37 |
29 void SetReflector(ReflectorImpl* reflector); | 38 void SetReflector(ReflectorImpl* reflector); |
30 | 39 |
31 #if defined(OS_MACOSX) | 40 #if defined(OS_MACOSX) |
32 virtual void OnSurfaceDisplayed() = 0; | 41 virtual void OnSurfaceDisplayed() = 0; |
33 virtual void OnSurfaceRecycled() = 0; | 42 virtual void OnSurfaceRecycled() = 0; |
34 virtual bool ShouldNotShowFramesAfterRecycle() const = 0; | 43 virtual bool ShouldNotShowFramesAfterRecycle() const = 0; |
35 #endif | 44 #endif |
36 | 45 |
37 protected: | 46 protected: |
38 // Constructor used by the accelerated implementation. | 47 // Constructor used by the accelerated implementation. |
39 explicit BrowserCompositorOutputSurface( | 48 BrowserCompositorOutputSurface( |
40 const scoped_refptr<cc::ContextProvider>& context); | 49 const scoped_refptr<cc::ContextProvider>& context, |
| 50 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager); |
41 | 51 |
42 // Constructor used by the software implementation. | 52 // Constructor used by the software implementation. |
43 explicit BrowserCompositorOutputSurface( | 53 BrowserCompositorOutputSurface( |
44 scoped_ptr<cc::SoftwareOutputDevice> software_device); | 54 scoped_ptr<cc::SoftwareOutputDevice> software_device, |
| 55 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager); |
45 | 56 |
| 57 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; |
46 ReflectorImpl* reflector_; | 58 ReflectorImpl* reflector_; |
47 | 59 |
48 private: | 60 private: |
49 void Initialize(); | 61 void Initialize(); |
50 | 62 |
51 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface); | 63 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface); |
52 }; | 64 }; |
53 | 65 |
54 } // namespace content | 66 } // namespace content |
55 | 67 |
56 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 68 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |