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_ONSCREEN_DISPLAY_CLIENT_H_ | 5 #ifndef CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
13 #include "cc/surfaces/display.h" | 14 #include "cc/surfaces/display.h" |
| 15 #include "cc/surfaces/surfaces_export.h" |
14 | 16 |
15 namespace cc { | 17 namespace cc { |
16 class ContextProvider; | 18 class ContextProvider; |
17 class SurfaceManager; | 19 class SurfaceManager; |
18 } | |
19 | |
20 namespace content { | |
21 class SurfaceDisplayOutputSurface; | 20 class SurfaceDisplayOutputSurface; |
22 | 21 |
23 // This class provides a DisplayClient implementation for drawing directly to an | 22 // This class provides a DisplayClient implementation for drawing directly to an |
24 // onscreen context. | 23 // onscreen context. |
25 class OnscreenDisplayClient : cc::DisplayClient { | 24 class CC_SURFACES_EXPORT OnscreenDisplayClient |
| 25 : NON_EXPORTED_BASE(DisplayClient) { |
26 public: | 26 public: |
27 OnscreenDisplayClient( | 27 OnscreenDisplayClient( |
28 scoped_ptr<cc::OutputSurface> output_surface, | 28 scoped_ptr<OutputSurface> output_surface, |
29 cc::SurfaceManager* manager, | 29 SurfaceManager* manager, |
30 const cc::RendererSettings& settings, | 30 SharedBitmapManager* bitmap_manager, |
| 31 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 32 const RendererSettings& settings, |
31 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 33 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
32 ~OnscreenDisplayClient() override; | 34 ~OnscreenDisplayClient() override; |
33 | 35 |
34 bool Initialize(); | 36 bool Initialize(); |
35 cc::Display* display() { return display_.get(); } | 37 Display* display() { return display_.get(); } |
36 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) { | 38 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) { |
37 surface_display_output_surface_ = surface; | 39 surface_display_output_surface_ = surface; |
38 } | 40 } |
39 | 41 |
40 // cc::DisplayClient implementation. | 42 // DisplayClient implementation. |
41 void DisplayDamaged() override; | 43 void DisplayDamaged() override; |
42 void DidSwapBuffers() override; | 44 void DidSwapBuffers() override; |
43 void DidSwapBuffersComplete() override; | 45 void DidSwapBuffersComplete() override; |
44 void CommitVSyncParameters(base::TimeTicks timebase, | 46 void CommitVSyncParameters(base::TimeTicks timebase, |
45 base::TimeDelta interval) override; | 47 base::TimeDelta interval) override; |
46 void OutputSurfaceLost() override; | 48 void OutputSurfaceLost() override; |
47 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | 49 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; |
48 | 50 |
49 bool output_surface_lost() { return output_surface_lost_; } | 51 bool output_surface_lost() { return output_surface_lost_; } |
50 | 52 |
51 private: | 53 private: |
52 void ScheduleDraw(); | 54 void ScheduleDraw(); |
53 void Draw(); | 55 void Draw(); |
54 | 56 |
55 scoped_ptr<cc::OutputSurface> output_surface_; | 57 scoped_ptr<OutputSurface> output_surface_; |
56 scoped_ptr<cc::Display> display_; | 58 scoped_ptr<Display> display_; |
57 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 59 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
58 SurfaceDisplayOutputSurface* surface_display_output_surface_; | 60 SurfaceDisplayOutputSurface* surface_display_output_surface_; |
59 bool scheduled_draw_; | 61 bool scheduled_draw_; |
60 bool output_surface_lost_; | 62 bool output_surface_lost_; |
61 // True if a draw should be scheduled, but it's hit the limit on max frames | 63 // True if a draw should be scheduled, but it's hit the limit on max frames |
62 // pending. | 64 // pending. |
63 bool deferred_draw_; | 65 bool deferred_draw_; |
64 int pending_frames_; | 66 int pending_frames_; |
65 | 67 |
66 base::WeakPtrFactory<OnscreenDisplayClient> weak_ptr_factory_; | 68 base::WeakPtrFactory<OnscreenDisplayClient> weak_ptr_factory_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); | 70 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace content | 73 } // namespace cc |
72 | 74 |
73 #endif // CONTENT_BROWSER_COMPOSITOR_ONSCREEN_DISPLAY_CLIENT_H_ | 75 #endif // CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ |
OLD | NEW |