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

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

Issue 2539893002: Mus: Implement GpuMain mojo interface (Closed)
Patch Set: Addressed Sadrul's comments 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
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 "base/threading/thread_checker.h"
11 #include "cc/ipc/display_compositor.mojom.h" 12 #include "cc/ipc/display_compositor.mojom.h"
12 #include "cc/surfaces/frame_sink_id.h" 13 #include "cc/surfaces/frame_sink_id.h"
13 #include "cc/surfaces/local_frame_id.h" 14 #include "cc/surfaces/local_frame_id.h"
14 #include "cc/surfaces/surface_id.h" 15 #include "cc/surfaces/surface_id.h"
15 #include "cc/surfaces/surface_manager.h" 16 #include "cc/surfaces/surface_manager.h"
16 #include "cc/surfaces/surface_observer.h" 17 #include "cc/surfaces/surface_observer.h"
18 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
17 #include "gpu/ipc/common/surface_handle.h" 19 #include "gpu/ipc/common/surface_handle.h"
18 #include "gpu/ipc/in_process_command_buffer.h" 20 #include "gpu/ipc/in_process_command_buffer.h"
19 #include "ipc/ipc_channel_handle.h" 21 #include "ipc/ipc_channel_handle.h"
20 #include "mojo/public/cpp/bindings/binding.h" 22 #include "mojo/public/cpp/bindings/binding.h"
21 #include "services/ui/common/mus_gpu_memory_buffer_manager.h" 23 #include "services/ui/common/mus_gpu_memory_buffer_manager.h"
22 24
23 namespace gpu { 25 namespace gpu {
26 class GpuMemoryBufferManager;
24 class ImageFactory; 27 class ImageFactory;
25 } 28 }
26 29
27 namespace cc { 30 namespace cc {
28 class SurfaceHittest; 31 class SurfaceHittest;
29 class SurfaceManager; 32 class SurfaceManager;
30 } // namespace cc 33 } // namespace cc
31 34
32 namespace ui { 35 namespace ui {
33 36
34 class DisplayCompositorClient; 37 class DisplayCompositorClient;
35 class GpuCompositorFrameSink; 38 class GpuCompositorFrameSink;
36 class MusGpuMemoryBufferManager;
37 39
38 // The DisplayCompositor object is an object global to the Window Server app 40 // The DisplayCompositor object is an object global to the Window Server app
39 // that holds the SurfaceServer and allocates new Surfaces namespaces. 41 // that holds the SurfaceServer and allocates new Surfaces namespaces.
40 // This object lives on the main thread of the Window Server. 42 // This object lives on the main thread of the Window Server.
41 // TODO(rjkroege, fsamuel): This object will need to change to support multiple 43 // TODO(rjkroege, fsamuel): This object will need to change to support multiple
42 // displays. 44 // displays.
43 class DisplayCompositor : public cc::SurfaceObserver, 45 class DisplayCompositor : public cc::SurfaceObserver,
44 public cc::mojom::DisplayCompositor { 46 public cc::mojom::DisplayCompositor {
45 public: 47 public:
46 DisplayCompositor( 48 DisplayCompositor(
47 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service, 49 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service,
48 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager, 50 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager,
49 gpu::ImageFactory* image_factory, 51 gpu::ImageFactory* image_factory,
50 cc::mojom::DisplayCompositorRequest request, 52 cc::mojom::DisplayCompositorRequest request,
51 cc::mojom::DisplayCompositorClientPtr client); 53 cc::mojom::DisplayCompositorClientPtr client);
52 ~DisplayCompositor() override; 54 ~DisplayCompositor() override;
53 55
54 // cc::mojom::DisplayCompositor implementation: 56 // cc::mojom::DisplayCompositor implementation:
55 void CreateCompositorFrameSink( 57 void CreateCompositorFrameSink(
56 const cc::FrameSinkId& frame_sink_id, 58 const cc::FrameSinkId& frame_sink_id,
57 gpu::SurfaceHandle surface_handle, 59 gpu::SurfaceHandle surface_handle,
58 cc::mojom::MojoCompositorFrameSinkRequest request, 60 cc::mojom::MojoCompositorFrameSinkRequest request,
(...skipping 29 matching lines...) Expand all
88 90
89 // SurfaceManager should be the first object constructed and the last object 91 // SurfaceManager should be the first object constructed and the last object
90 // destroyed in order to ensure that all other objects that depend on it have 92 // destroyed in order to ensure that all other objects that depend on it have
91 // access to a valid pointer for the entirety of their liftimes. 93 // access to a valid pointer for the entirety of their liftimes.
92 cc::SurfaceManager manager_; 94 cc::SurfaceManager manager_;
93 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service_; 95 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service_;
94 std::unordered_map<cc::FrameSinkId, 96 std::unordered_map<cc::FrameSinkId,
95 std::unique_ptr<GpuCompositorFrameSink>, 97 std::unique_ptr<GpuCompositorFrameSink>,
96 cc::FrameSinkIdHash> 98 cc::FrameSinkIdHash>
97 compositor_frame_sinks_; 99 compositor_frame_sinks_;
98 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_; 100 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_;
99 gpu::ImageFactory* image_factory_; 101 gpu::ImageFactory* image_factory_;
100 cc::mojom::DisplayCompositorClientPtr client_; 102 cc::mojom::DisplayCompositorClientPtr client_;
101 103
102 // SurfaceIds that have temporary references from top level root so they 104 // SurfaceIds that have temporary references from top level root so they
103 // aren't GC'd before DisplayCompositorClient can add a real reference. This 105 // aren't GC'd before DisplayCompositorClient can add a real reference. This
104 // is basically a collection of surface ids, for example: 106 // is basically a collection of surface ids, for example:
105 // cc::SurfaceId surface_id(key, value[index]); 107 // cc::SurfaceId surface_id(key, value[index]);
106 // The LocalFrameIds are stored in the order the surfaces are created in. 108 // The LocalFrameIds are stored in the order the surfaces are created in.
107 std::unordered_map<cc::FrameSinkId, 109 std::unordered_map<cc::FrameSinkId,
108 std::vector<cc::LocalFrameId>, 110 std::vector<cc::LocalFrameId>,
109 cc::FrameSinkIdHash> 111 cc::FrameSinkIdHash>
110 temp_references_; 112 temp_references_;
111 113
114 base::ThreadChecker thread_checker_;
115
112 mojo::Binding<cc::mojom::DisplayCompositor> binding_; 116 mojo::Binding<cc::mojom::DisplayCompositor> binding_;
113 117
114 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); 118 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
115 }; 119 };
116 120
117 } // namespace ui 121 } // namespace ui
118 122
119 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ 123 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « services/ui/gpu/interfaces/gpu_service_internal.mojom ('k') | services/ui/surfaces/display_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698