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 CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ | 5 #ifndef CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ |
6 #define CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ | 6 #define CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ |
7 | 7 |
8 #include "cc/surfaces/display_client.h" | 8 #include <memory> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "cc/surfaces/display.h" | 13 #include "cc/surfaces/display.h" |
| 14 #include "cc/surfaces/display_client.h" |
15 #include "cc/surfaces/surfaces_export.h" | 15 #include "cc/surfaces/surfaces_export.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class SingleThreadTaskRunner; | 18 class SingleThreadTaskRunner; |
19 } | 19 } |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 class BeginFrameSource; | 22 class BeginFrameSource; |
23 class ContextProvider; | 23 class ContextProvider; |
24 class DisplayScheduler; | 24 class DisplayScheduler; |
25 class SurfaceManager; | 25 class SurfaceManager; |
26 class SurfaceDisplayOutputSurface; | 26 class SurfaceDisplayOutputSurface; |
27 | 27 |
28 // This class provides a DisplayClient implementation for drawing directly to an | 28 // This class provides a DisplayClient implementation for drawing directly to an |
29 // onscreen context. | 29 // onscreen context. |
30 class CC_SURFACES_EXPORT OnscreenDisplayClient | 30 class CC_SURFACES_EXPORT OnscreenDisplayClient |
31 : NON_EXPORTED_BASE(DisplayClient) { | 31 : NON_EXPORTED_BASE(DisplayClient) { |
32 public: | 32 public: |
33 OnscreenDisplayClient( | 33 OnscreenDisplayClient( |
34 scoped_ptr<OutputSurface> output_surface, | 34 std::unique_ptr<OutputSurface> output_surface, |
35 SurfaceManager* manager, | 35 SurfaceManager* manager, |
36 SharedBitmapManager* bitmap_manager, | 36 SharedBitmapManager* bitmap_manager, |
37 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 37 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
38 const RendererSettings& settings, | 38 const RendererSettings& settings, |
39 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 39 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
40 ~OnscreenDisplayClient() override; | 40 ~OnscreenDisplayClient() override; |
41 | 41 |
42 bool Initialize(); | 42 bool Initialize(); |
43 Display* display() { return display_.get(); } | 43 Display* display() { return display_.get(); } |
44 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) { | 44 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) { |
45 surface_display_output_surface_ = surface; | 45 surface_display_output_surface_ = surface; |
46 } | 46 } |
47 | 47 |
48 // DisplayClient implementation. | 48 // DisplayClient implementation. |
49 void CommitVSyncParameters(base::TimeTicks timebase, | 49 void CommitVSyncParameters(base::TimeTicks timebase, |
50 base::TimeDelta interval) override; | 50 base::TimeDelta interval) override; |
51 void OutputSurfaceLost() override; | 51 void OutputSurfaceLost() override; |
52 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; | 52 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; |
53 | 53 |
54 bool output_surface_lost() { return output_surface_lost_; } | 54 bool output_surface_lost() { return output_surface_lost_; } |
55 | 55 |
56 protected: | 56 protected: |
57 scoped_ptr<OutputSurface> output_surface_; | 57 std::unique_ptr<OutputSurface> output_surface_; |
58 // Be careful of destruction order: | 58 // Be careful of destruction order: |
59 // Display depends on DisplayScheduler depends on *BeginFrameSource | 59 // Display depends on DisplayScheduler depends on *BeginFrameSource |
60 // depends on TaskRunner. | 60 // depends on TaskRunner. |
61 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 61 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
62 scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source_; | 62 std::unique_ptr<SyntheticBeginFrameSource> synthetic_frame_source_; |
63 scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source_; | 63 std::unique_ptr<BackToBackBeginFrameSource> unthrottled_frame_source_; |
64 scoped_ptr<DisplayScheduler> scheduler_; | 64 std::unique_ptr<DisplayScheduler> scheduler_; |
65 scoped_ptr<Display> display_; | 65 std::unique_ptr<Display> display_; |
66 SurfaceDisplayOutputSurface* surface_display_output_surface_; | 66 SurfaceDisplayOutputSurface* surface_display_output_surface_; |
67 bool output_surface_lost_; | 67 bool output_surface_lost_; |
68 bool disable_display_vsync_; | 68 bool disable_display_vsync_; |
69 | 69 |
70 private: | 70 private: |
71 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); | 71 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); |
72 }; | 72 }; |
73 | 73 |
74 } // namespace cc | 74 } // namespace cc |
75 | 75 |
76 #endif // CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ | 76 #endif // CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ |
OLD | NEW |