| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() override; | 61 ~DisplayCompositor() override; |
| 62 | 62 |
| 63 // cc::mojom::DisplayCompositor implementation: | 63 cc::SurfaceManager* manager() { return &manager_; } |
| 64 void CreateCompositorFrameSink( | |
| 65 const cc::FrameSinkId& frame_sink_id, | |
| 66 gpu::SurfaceHandle surface_handle, | |
| 67 cc::mojom::MojoCompositorFrameSinkRequest request, | |
| 68 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | |
| 69 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; | |
| 70 void AddRootSurfaceReference(const cc::SurfaceId& child_id) override; | |
| 71 void AddSurfaceReference(const cc::SurfaceId& parent_id, | |
| 72 const cc::SurfaceId& child_id) override; | |
| 73 void RemoveRootSurfaceReference(const cc::SurfaceId& child_id) override; | |
| 74 void RemoveSurfaceReference(const cc::SurfaceId& parent_id, | |
| 75 const cc::SurfaceId& child_id) override; | |
| 76 | 64 |
| 77 cc::SurfaceManager* manager() { return &manager_; } | 65 // Adds surface references. For each reference added, this will remove the |
| 66 // temporary reference to the child surface if one exists. |
| 67 void AddSurfaceReferences( |
| 68 const std::vector<cc::SurfaceReference>& references); |
| 69 |
| 70 // Removes surface references. |
| 71 void RemoveSurfaceReferences( |
| 72 const std::vector<cc::SurfaceReference>& references); |
| 78 | 73 |
| 79 // We must avoid destroying a GpuCompositorFrameSink until both the display | 74 // We must avoid destroying a GpuCompositorFrameSink until both the display |
| 80 // compositor host and the client drop their connection to avoid getting into | 75 // compositor host and the client drop their connection to avoid getting into |
| 81 // a state where surfaces references are inconsistent. | 76 // a state where surfaces references are inconsistent. |
| 82 void OnCompositorFrameSinkClientConnectionLost( | 77 void OnCompositorFrameSinkClientConnectionLost( |
| 83 const cc::FrameSinkId& frame_sink_id, | 78 const cc::FrameSinkId& frame_sink_id, |
| 84 bool destroy_compositor_frame_sink); | 79 bool destroy_compositor_frame_sink); |
| 85 void OnCompositorFrameSinkPrivateConnectionLost( | 80 void OnCompositorFrameSinkPrivateConnectionLost( |
| 86 const cc::FrameSinkId& frame_sink_id, | 81 const cc::FrameSinkId& frame_sink_id, |
| 87 bool destroy_compositor_frame_sink); | 82 bool destroy_compositor_frame_sink); |
| 88 | 83 |
| 84 // cc::mojom::DisplayCompositor implementation: |
| 85 void CreateCompositorFrameSink( |
| 86 const cc::FrameSinkId& frame_sink_id, |
| 87 gpu::SurfaceHandle surface_handle, |
| 88 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 89 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
| 90 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; |
| 91 |
| 89 private: | 92 private: |
| 90 friend class test::DisplayCompositorTest; | 93 friend class test::DisplayCompositorTest; |
| 91 | 94 |
| 95 void AddSurfaceReference(const cc::SurfaceReference& ref); |
| 96 void RemoveSurfaceReference(const cc::SurfaceReference& ref); |
| 97 |
| 92 std::unique_ptr<cc::Display> CreateDisplay( | 98 std::unique_ptr<cc::Display> CreateDisplay( |
| 93 const cc::FrameSinkId& frame_sink_id, | 99 const cc::FrameSinkId& frame_sink_id, |
| 94 gpu::SurfaceHandle surface_handle); | 100 gpu::SurfaceHandle surface_handle); |
| 95 | 101 |
| 96 const cc::SurfaceId& GetRootSurfaceId() const; | 102 const cc::SurfaceId& GetRootSurfaceId() const; |
| 97 | 103 |
| 98 // cc::SurfaceObserver implementation. | 104 // cc::SurfaceObserver implementation. |
| 99 void OnSurfaceCreated(const cc::SurfaceId& surface_id, | 105 void OnSurfaceCreated(const cc::SurfaceId& surface_id, |
| 100 const gfx::Size& frame_size, | 106 const gfx::Size& frame_size, |
| 101 float device_scale_factor) override; | 107 float device_scale_factor) override; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 142 |
| 137 cc::mojom::DisplayCompositorClientPtr client_; | 143 cc::mojom::DisplayCompositorClientPtr client_; |
| 138 mojo::Binding<cc::mojom::DisplayCompositor> binding_; | 144 mojo::Binding<cc::mojom::DisplayCompositor> binding_; |
| 139 | 145 |
| 140 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); | 146 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); |
| 141 }; | 147 }; |
| 142 | 148 |
| 143 } // namespace ui | 149 } // namespace ui |
| 144 | 150 |
| 145 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 151 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
| OLD | NEW |