OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 5 #ifndef SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 : public cc::SurfaceObserver, | 51 : public cc::SurfaceObserver, |
52 public display_compositor::GpuCompositorFrameSinkDelegate, | 52 public display_compositor::GpuCompositorFrameSinkDelegate, |
53 public cc::mojom::DisplayCompositor { | 53 public cc::mojom::DisplayCompositor { |
54 public: | 54 public: |
55 DisplayCompositor( | 55 DisplayCompositor( |
56 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service, | 56 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service, |
57 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager, | 57 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager, |
58 gpu::ImageFactory* image_factory, | 58 gpu::ImageFactory* image_factory, |
59 cc::mojom::DisplayCompositorRequest request, | 59 cc::mojom::DisplayCompositorRequest request, |
60 cc::mojom::DisplayCompositorClientPtr client); | 60 cc::mojom::DisplayCompositorClientPtr client); |
| 61 DisplayCompositor(cc::mojom::DisplayCompositorRequest request, |
| 62 cc::SurfaceManager* surfacemanager); |
61 ~DisplayCompositor() override; | 63 ~DisplayCompositor() override; |
62 | 64 |
63 cc::SurfaceManager* manager() { return &manager_; } | 65 cc::SurfaceManager* manager() { return &manager_; } |
64 | 66 |
65 // display_compositor::GpuCompositorFrameSinkDelegate implementation. | 67 // display_compositor::GpuCompositorFrameSinkDelegate implementation. |
66 void OnClientConnectionLost(const cc::FrameSinkId& frame_sink_id, | 68 void OnClientConnectionLost(const cc::FrameSinkId& frame_sink_id, |
67 bool destroy_compositor_frame_sink) override; | 69 bool destroy_compositor_frame_sink) override; |
68 void OnPrivateConnectionLost(const cc::FrameSinkId& frame_sink_id, | 70 void OnPrivateConnectionLost(const cc::FrameSinkId& frame_sink_id, |
69 bool destroy_compositor_frame_sink) override; | 71 bool destroy_compositor_frame_sink) override; |
70 | 72 |
71 // cc::mojom::DisplayCompositor implementation: | 73 // cc::mojom::DisplayCompositor implementation: |
72 void CreateDisplayCompositorFrameSink( | 74 void CreateDisplayCompositorFrameSink( |
73 const cc::FrameSinkId& frame_sink_id, | 75 const cc::FrameSinkId& frame_sink_id, |
74 gpu::SurfaceHandle surface_handle, | 76 gpu::SurfaceHandle surface_handle, |
75 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request, | 77 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request, |
76 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 78 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
77 cc::mojom::MojoCompositorFrameSinkClientPtr client, | 79 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
78 cc::mojom::DisplayPrivateAssociatedRequest display_private_request) | 80 cc::mojom::DisplayPrivateAssociatedRequest display_private_request) |
79 override; | 81 override; |
80 void CreateOffscreenCompositorFrameSink( | 82 void CreateOffscreenCompositorFrameSink( |
81 const cc::FrameSinkId& frame_sink_id, | 83 const cc::FrameSinkId& frame_sink_id, |
82 cc::mojom::MojoCompositorFrameSinkRequest request, | 84 cc::mojom::MojoCompositorFrameSinkRequest request, |
83 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 85 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
84 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; | 86 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; |
85 | 87 |
| 88 void CreateOffscreenCanvasCompositorFrameSink( |
| 89 const cc::FrameSinkId& frame_sink_id, |
| 90 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 91 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; |
| 92 |
86 private: | 93 private: |
87 std::unique_ptr<cc::Display> CreateDisplay( | 94 std::unique_ptr<cc::Display> CreateDisplay( |
88 const cc::FrameSinkId& frame_sink_id, | 95 const cc::FrameSinkId& frame_sink_id, |
89 gpu::SurfaceHandle surface_handle, | 96 gpu::SurfaceHandle surface_handle, |
90 cc::SyntheticBeginFrameSource* begin_frame_source); | 97 cc::SyntheticBeginFrameSource* begin_frame_source); |
91 | 98 |
92 void CreateCompositorFrameSinkInternal( | 99 void CreateCompositorFrameSinkInternal( |
93 const cc::FrameSinkId& frame_sink_id, | 100 const cc::FrameSinkId& frame_sink_id, |
94 gpu::SurfaceHandle surface_handle, | 101 gpu::SurfaceHandle surface_handle, |
95 std::unique_ptr<cc::Display> display, | 102 std::unique_ptr<cc::Display> display, |
(...skipping 12 matching lines...) Expand all Loading... |
108 | 115 |
109 // cc::SurfaceObserver implementation. | 116 // cc::SurfaceObserver implementation. |
110 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; | 117 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; |
111 void OnSurfaceDamaged(const cc::SurfaceId& surface_id, | 118 void OnSurfaceDamaged(const cc::SurfaceId& surface_id, |
112 bool* changed) override; | 119 bool* changed) override; |
113 | 120 |
114 // SurfaceManager should be the first object constructed and the last object | 121 // SurfaceManager should be the first object constructed and the last object |
115 // destroyed in order to ensure that all other objects that depend on it have | 122 // destroyed in order to ensure that all other objects that depend on it have |
116 // access to a valid pointer for the entirety of their liftimes. | 123 // access to a valid pointer for the entirety of their liftimes. |
117 cc::SurfaceManager manager_; | 124 cc::SurfaceManager manager_; |
| 125 // TODO(xing.xu): when new display compositor is done, remove this. |
| 126 cc::SurfaceManager* manager_of_system_; |
118 | 127 |
119 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service_; | 128 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service_; |
120 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_; | 129 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_; |
121 gpu::ImageFactory* image_factory_; | 130 gpu::ImageFactory* image_factory_; |
122 | 131 |
123 std::unordered_map< | 132 std::unordered_map< |
124 cc::FrameSinkId, | 133 cc::FrameSinkId, |
125 std::unique_ptr<display_compositor::GpuCompositorFrameSink>, | 134 std::unique_ptr<display_compositor::GpuCompositorFrameSink>, |
126 cc::FrameSinkIdHash> | 135 cc::FrameSinkIdHash> |
127 compositor_frame_sinks_; | 136 compositor_frame_sinks_; |
128 | 137 |
129 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 138 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
130 | 139 |
131 base::ThreadChecker thread_checker_; | 140 base::ThreadChecker thread_checker_; |
132 | 141 |
133 cc::mojom::DisplayCompositorClientPtr client_; | 142 cc::mojom::DisplayCompositorClientPtr client_; |
134 mojo::Binding<cc::mojom::DisplayCompositor> binding_; | 143 mojo::Binding<cc::mojom::DisplayCompositor> binding_; |
135 | 144 |
136 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); | 145 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); |
137 }; | 146 }; |
138 | 147 |
139 } // namespace ui | 148 } // namespace ui |
140 | 149 |
141 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 150 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
OLD | NEW |