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

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

Issue 2654693003: Decouple GpuCompositorFrameSink from DisplayCompositor (Closed)
Patch Set: Fix vars Created 3 years, 11 months 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 <memory> 10 #include <memory>
11 #include <unordered_map> 11 #include <unordered_map>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "cc/ipc/display_compositor.mojom.h" 16 #include "cc/ipc/display_compositor.mojom.h"
17 #include "cc/surfaces/compositor_frame_sink_delegate.h"
17 #include "cc/surfaces/frame_sink_id.h" 18 #include "cc/surfaces/frame_sink_id.h"
18 #include "cc/surfaces/local_frame_id.h" 19 #include "cc/surfaces/local_frame_id.h"
19 #include "cc/surfaces/surface_id.h" 20 #include "cc/surfaces/surface_id.h"
20 #include "cc/surfaces/surface_manager.h" 21 #include "cc/surfaces/surface_manager.h"
21 #include "cc/surfaces/surface_observer.h" 22 #include "cc/surfaces/surface_observer.h"
22 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 23 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
23 #include "gpu/ipc/common/surface_handle.h" 24 #include "gpu/ipc/common/surface_handle.h"
24 #include "gpu/ipc/in_process_command_buffer.h" 25 #include "gpu/ipc/in_process_command_buffer.h"
25 #include "ipc/ipc_channel_handle.h" 26 #include "ipc/ipc_channel_handle.h"
26 #include "mojo/public/cpp/bindings/binding.h" 27 #include "mojo/public/cpp/bindings/binding.h"
(...skipping 12 matching lines...) Expand all
39 namespace ui { 40 namespace ui {
40 41
41 class GpuCompositorFrameSink; 42 class GpuCompositorFrameSink;
42 43
43 // The DisplayCompositor object is an object global to the Window Server app 44 // The DisplayCompositor object is an object global to the Window Server app
44 // that holds the SurfaceServer and allocates new Surfaces namespaces. 45 // that holds the SurfaceServer and allocates new Surfaces namespaces.
45 // This object lives on the main thread of the Window Server. 46 // This object lives on the main thread of the Window Server.
46 // TODO(rjkroege, fsamuel): This object will need to change to support multiple 47 // TODO(rjkroege, fsamuel): This object will need to change to support multiple
47 // displays. 48 // displays.
48 class DisplayCompositor : public cc::SurfaceObserver, 49 class DisplayCompositor : public cc::SurfaceObserver,
50 public cc::CompositorFrameSinkDelegate,
49 public cc::mojom::DisplayCompositor { 51 public cc::mojom::DisplayCompositor {
50 public: 52 public:
51 DisplayCompositor( 53 DisplayCompositor(
52 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service, 54 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service,
53 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager, 55 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager,
54 gpu::ImageFactory* image_factory, 56 gpu::ImageFactory* image_factory,
55 cc::mojom::DisplayCompositorRequest request, 57 cc::mojom::DisplayCompositorRequest request,
56 cc::mojom::DisplayCompositorClientPtr client); 58 cc::mojom::DisplayCompositorClientPtr client);
57 ~DisplayCompositor() override; 59 ~DisplayCompositor() override;
58 60
59 cc::SurfaceManager* manager() { return &manager_; } 61 cc::SurfaceManager* manager() { return &manager_; }
60 62
61 // Adds surface references. For each reference added, this will remove the
62 // temporary reference to the child surface if one exists.
63 void AddSurfaceReferences(
64 const std::vector<cc::SurfaceReference>& references);
65
66 // Removes surface references.
67 void RemoveSurfaceReferences(
68 const std::vector<cc::SurfaceReference>& references);
69
70 // We must avoid destroying a GpuCompositorFrameSink until both the display 63 // We must avoid destroying a GpuCompositorFrameSink until both the display
71 // compositor host and the client drop their connection to avoid getting into 64 // compositor host and the client drop their connection to avoid getting into
72 // a state where surfaces references are inconsistent. 65 // a state where surfaces references are inconsistent.
73 void OnCompositorFrameSinkClientConnectionLost( 66 void OnClientConnectionLost(const cc::FrameSinkId& frame_sink_id,
74 const cc::FrameSinkId& frame_sink_id, 67 bool destroy_compositor_frame_sink) override;
75 bool destroy_compositor_frame_sink); 68 void OnPrivateConnectionLost(const cc::FrameSinkId& frame_sink_id,
76 void OnCompositorFrameSinkPrivateConnectionLost( 69 bool destroy_compositor_frame_sink) override;
77 const cc::FrameSinkId& frame_sink_id,
78 bool destroy_compositor_frame_sink);
79 70
80 // cc::mojom::DisplayCompositor implementation: 71 // cc::mojom::DisplayCompositor implementation:
81 void CreateDisplayCompositorFrameSink( 72 void CreateDisplayCompositorFrameSink(
82 const cc::FrameSinkId& frame_sink_id, 73 const cc::FrameSinkId& frame_sink_id,
83 gpu::SurfaceHandle surface_handle, 74 gpu::SurfaceHandle surface_handle,
84 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request, 75 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request,
85 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, 76 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request,
86 cc::mojom::MojoCompositorFrameSinkClientPtr client, 77 cc::mojom::MojoCompositorFrameSinkClientPtr client,
87 cc::mojom::DisplayPrivateAssociatedRequest display_private_request) 78 cc::mojom::DisplayPrivateAssociatedRequest display_private_request)
88 override; 79 override;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 130
140 cc::mojom::DisplayCompositorClientPtr client_; 131 cc::mojom::DisplayCompositorClientPtr client_;
141 mojo::Binding<cc::mojom::DisplayCompositor> binding_; 132 mojo::Binding<cc::mojom::DisplayCompositor> binding_;
142 133
143 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); 134 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
144 }; 135 };
145 136
146 } // namespace ui 137 } // namespace ui
147 138
148 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ 139 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698