Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: services/ui/surfaces/display_compositor.h

Issue 2525213002: Mus: Avoid deadlock during teardown (Closed)
Patch Set: Address Sadrul's comment Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/ui/gpu/gpu_service_internal.cc ('k') | services/ui/surfaces/display_compositor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/macros.h" 10 #include "base/macros.h"
11 #include "cc/ipc/display_compositor.mojom.h" 11 #include "cc/ipc/display_compositor.mojom.h"
12 #include "cc/surfaces/frame_sink_id.h" 12 #include "cc/surfaces/frame_sink_id.h"
13 #include "cc/surfaces/local_frame_id.h" 13 #include "cc/surfaces/local_frame_id.h"
14 #include "cc/surfaces/surface_id.h" 14 #include "cc/surfaces/surface_id.h"
15 #include "cc/surfaces/surface_manager.h" 15 #include "cc/surfaces/surface_manager.h"
16 #include "cc/surfaces/surface_observer.h" 16 #include "cc/surfaces/surface_observer.h"
17 #include "gpu/ipc/common/surface_handle.h" 17 #include "gpu/ipc/common/surface_handle.h"
18 #include "gpu/ipc/in_process_command_buffer.h" 18 #include "gpu/ipc/in_process_command_buffer.h"
19 #include "ipc/ipc_channel_handle.h" 19 #include "ipc/ipc_channel_handle.h"
20 #include "mojo/public/cpp/bindings/binding.h"
20 #include "services/ui/surfaces/mus_gpu_memory_buffer_manager.h" 21 #include "services/ui/surfaces/mus_gpu_memory_buffer_manager.h"
21 22
22 namespace gpu { 23 namespace gpu {
23 class ImageFactory; 24 class ImageFactory;
24 } 25 }
25 26
26 namespace cc { 27 namespace cc {
27 class SurfaceHittest; 28 class SurfaceHittest;
28 class SurfaceManager; 29 class SurfaceManager;
29 } // namespace cc 30 } // namespace cc
30 31
31 namespace ui { 32 namespace ui {
32 33
33 class DisplayCompositorClient; 34 class DisplayCompositorClient;
34 class GpuCompositorFrameSink; 35 class GpuCompositorFrameSink;
35 class MusGpuMemoryBufferManager; 36 class MusGpuMemoryBufferManager;
36 37
37 // The DisplayCompositor object is an object global to the Window Server app 38 // The DisplayCompositor object is an object global to the Window Server app
38 // that holds the SurfaceServer and allocates new Surfaces namespaces. 39 // that holds the SurfaceServer and allocates new Surfaces namespaces.
39 // This object lives on the main thread of the Window Server. 40 // This object lives on the main thread of the Window Server.
40 // TODO(rjkroege, fsamuel): This object will need to change to support multiple 41 // TODO(rjkroege, fsamuel): This object will need to change to support multiple
41 // displays. 42 // displays.
42 class DisplayCompositor : public cc::SurfaceObserver, 43 class DisplayCompositor : public cc::SurfaceObserver,
43 public cc::mojom::DisplayCompositor { 44 public cc::mojom::DisplayCompositor {
44 public: 45 public:
45 DisplayCompositor( 46 DisplayCompositor(
46 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service, 47 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service,
47 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager, 48 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager,
48 gpu::ImageFactory* image_factory, 49 gpu::ImageFactory* image_factory,
50 cc::mojom::DisplayCompositorRequest request,
49 cc::mojom::DisplayCompositorClientPtr client); 51 cc::mojom::DisplayCompositorClientPtr client);
50 ~DisplayCompositor() override; 52 ~DisplayCompositor() override;
51 53
52 // cc::mojom::DisplayCompositor implementation: 54 // cc::mojom::DisplayCompositor implementation:
53 void CreateCompositorFrameSink( 55 void CreateCompositorFrameSink(
54 const cc::FrameSinkId& frame_sink_id, 56 const cc::FrameSinkId& frame_sink_id,
55 gpu::SurfaceHandle surface_handle, 57 gpu::SurfaceHandle surface_handle,
56 cc::mojom::MojoCompositorFrameSinkRequest request, 58 cc::mojom::MojoCompositorFrameSinkRequest request,
57 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, 59 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request,
58 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; 60 cc::mojom::MojoCompositorFrameSinkClientPtr client) override;
(...skipping 22 matching lines...) Expand all
81 void OnSurfaceCreated(const cc::SurfaceId& surface_id, 83 void OnSurfaceCreated(const cc::SurfaceId& surface_id,
82 const gfx::Size& frame_size, 84 const gfx::Size& frame_size,
83 float device_scale_factor) override; 85 float device_scale_factor) override;
84 void OnSurfaceDamaged(const cc::SurfaceId& surface_id, 86 void OnSurfaceDamaged(const cc::SurfaceId& surface_id,
85 bool* changed) override; 87 bool* changed) override;
86 88
87 // SurfaceManager should be the first object constructed and the last object 89 // SurfaceManager should be the first object constructed and the last object
88 // destroyed in order to ensure that all other objects that depend on it have 90 // destroyed in order to ensure that all other objects that depend on it have
89 // access to a valid pointer for the entirety of their liftimes. 91 // access to a valid pointer for the entirety of their liftimes.
90 cc::SurfaceManager manager_; 92 cc::SurfaceManager manager_;
93 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service_;
91 std::unordered_map<cc::FrameSinkId, 94 std::unordered_map<cc::FrameSinkId,
92 std::unique_ptr<GpuCompositorFrameSink>, 95 std::unique_ptr<GpuCompositorFrameSink>,
93 cc::FrameSinkIdHash> 96 cc::FrameSinkIdHash>
94 compositor_frame_sinks_; 97 compositor_frame_sinks_;
95 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service_;
96 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_; 98 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_;
97 gpu::ImageFactory* image_factory_; 99 gpu::ImageFactory* image_factory_;
98 cc::mojom::DisplayCompositorClientPtr client_; 100 cc::mojom::DisplayCompositorClientPtr client_;
99 101
100 // SurfaceIds that have temporary references from top level root so they 102 // SurfaceIds that have temporary references from top level root so they
101 // aren't GC'd before DisplayCompositorClient can add a real reference. This 103 // aren't GC'd before DisplayCompositorClient can add a real reference. This
102 // is basically a collection of surface ids, for example: 104 // is basically a collection of surface ids, for example:
103 // cc::SurfaceId surface_id(key, value[index]); 105 // cc::SurfaceId surface_id(key, value[index]);
104 // The LocalFrameIds are stored in the order the surfaces are created in. 106 // The LocalFrameIds are stored in the order the surfaces are created in.
105 std::unordered_map<cc::FrameSinkId, 107 std::unordered_map<cc::FrameSinkId,
106 std::vector<cc::LocalFrameId>, 108 std::vector<cc::LocalFrameId>,
107 cc::FrameSinkIdHash> 109 cc::FrameSinkIdHash>
108 temp_references_; 110 temp_references_;
109 111
112 mojo::Binding<cc::mojom::DisplayCompositor> binding_;
113
110 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); 114 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
111 }; 115 };
112 116
113 } // namespace ui 117 } // namespace ui
114 118
115 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ 119 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_service_internal.cc ('k') | services/ui/surfaces/display_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698