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