Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace cc { | 33 namespace cc { |
| 34 class Display; | 34 class Display; |
| 35 class SurfaceManager; | 35 class SurfaceManager; |
| 36 class SyntheticBeginFrameSource; | 36 class SyntheticBeginFrameSource; |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace ui { | 39 namespace ui { |
| 40 | 40 |
| 41 namespace test { | 41 namespace test { |
|
kylechar
2017/01/17 16:15:35
Remove the forward def for the test.
Saman Sami
2017/01/17 18:29:05
Done.
| |
| 42 class DisplayCompositorTest; | 42 class DisplayCompositorTest; |
| 43 } | 43 } |
| 44 | 44 |
| 45 class DisplayCompositorClient; | |
| 46 class GpuCompositorFrameSink; | 45 class GpuCompositorFrameSink; |
| 47 | 46 |
| 48 // The DisplayCompositor object is an object global to the Window Server app | 47 // The DisplayCompositor object is an object global to the Window Server app |
| 49 // that holds the SurfaceServer and allocates new Surfaces namespaces. | 48 // that holds the SurfaceServer and allocates new Surfaces namespaces. |
| 50 // This object lives on the main thread of the Window Server. | 49 // This object lives on the main thread of the Window Server. |
| 51 // TODO(rjkroege, fsamuel): This object will need to change to support multiple | 50 // TODO(rjkroege, fsamuel): This object will need to change to support multiple |
| 52 // displays. | 51 // displays. |
| 53 class DisplayCompositor : public cc::SurfaceObserver, | 52 class DisplayCompositor : public cc::SurfaceObserver, |
| 54 public cc::mojom::DisplayCompositor { | 53 public cc::mojom::DisplayCompositor { |
| 55 public: | 54 public: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 cc::mojom::DisplayPrivateRequest display_request) override; | 91 cc::mojom::DisplayPrivateRequest display_request) override; |
| 93 void CreateOffscreenCompositorFrameSink( | 92 void CreateOffscreenCompositorFrameSink( |
| 94 const cc::FrameSinkId& frame_sink_id, | 93 const cc::FrameSinkId& frame_sink_id, |
| 95 cc::mojom::MojoCompositorFrameSinkRequest request, | 94 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 96 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 95 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
| 97 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; | 96 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; |
| 98 | 97 |
| 99 private: | 98 private: |
| 100 friend class test::DisplayCompositorTest; | 99 friend class test::DisplayCompositorTest; |
| 101 | 100 |
| 102 void AddSurfaceReference(const cc::SurfaceReference& ref); | |
| 103 void RemoveSurfaceReference(const cc::SurfaceReference& ref); | |
| 104 | |
| 105 std::unique_ptr<cc::Display> CreateDisplay( | 101 std::unique_ptr<cc::Display> CreateDisplay( |
| 106 const cc::FrameSinkId& frame_sink_id, | 102 const cc::FrameSinkId& frame_sink_id, |
| 107 gpu::SurfaceHandle surface_handle, | 103 gpu::SurfaceHandle surface_handle, |
| 108 cc::SyntheticBeginFrameSource* begin_frame_source); | 104 cc::SyntheticBeginFrameSource* begin_frame_source); |
| 109 | 105 |
| 110 void CreateCompositorFrameSinkInternal( | 106 void CreateCompositorFrameSinkInternal( |
| 111 const cc::FrameSinkId& frame_sink_id, | 107 const cc::FrameSinkId& frame_sink_id, |
| 112 gpu::SurfaceHandle surface_handle, | 108 gpu::SurfaceHandle surface_handle, |
| 113 std::unique_ptr<cc::Display> display, | 109 std::unique_ptr<cc::Display> display, |
| 114 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source, | 110 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 137 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_; | 133 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 138 gpu::ImageFactory* image_factory_; | 134 gpu::ImageFactory* image_factory_; |
| 139 | 135 |
| 140 std::unordered_map<cc::FrameSinkId, | 136 std::unordered_map<cc::FrameSinkId, |
| 141 std::unique_ptr<GpuCompositorFrameSink>, | 137 std::unique_ptr<GpuCompositorFrameSink>, |
| 142 cc::FrameSinkIdHash> | 138 cc::FrameSinkIdHash> |
| 143 compositor_frame_sinks_; | 139 compositor_frame_sinks_; |
| 144 | 140 |
| 145 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 141 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 146 | 142 |
| 147 // SurfaceIds that have temporary references from top level root so they | |
| 148 // aren't GC'd before DisplayCompositorClient can add a real reference. This | |
| 149 // is basically a collection of surface ids, for example: | |
| 150 // cc::SurfaceId surface_id(key, value[index]); | |
| 151 // The LocalFrameIds are stored in the order the surfaces are created in. | |
| 152 std::unordered_map<cc::FrameSinkId, | |
| 153 std::vector<cc::LocalFrameId>, | |
| 154 cc::FrameSinkIdHash> | |
| 155 temp_references_; | |
| 156 | |
| 157 base::ThreadChecker thread_checker_; | 143 base::ThreadChecker thread_checker_; |
| 158 | 144 |
| 159 cc::mojom::DisplayCompositorClientPtr client_; | 145 cc::mojom::DisplayCompositorClientPtr client_; |
| 160 mojo::Binding<cc::mojom::DisplayCompositor> binding_; | 146 mojo::Binding<cc::mojom::DisplayCompositor> binding_; |
| 161 | 147 |
| 162 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); | 148 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); |
| 163 }; | 149 }; |
| 164 | 150 |
| 165 } // namespace ui | 151 } // namespace ui |
| 166 | 152 |
| 167 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 153 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
| OLD | NEW |