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