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