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

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

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

Powered by Google App Engine
This is Rietveld 408576698