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