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

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

Issue 2638833002: Moving temporary reference logic to SurfaceManager (Closed)
Patch Set: c 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
« no previous file with comments | « cc/surfaces/surface_manager_ref_unittest.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 <memory> 10 #include <memory>
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 namespace cc { 33 namespace cc {
34 class Display; 34 class Display;
35 class SurfaceManager; 35 class SurfaceManager;
36 class SyntheticBeginFrameSource; 36 class SyntheticBeginFrameSource;
37 } 37 }
38 38
39 namespace ui { 39 namespace ui {
40 40
41 namespace test {
42 class DisplayCompositorTest;
43 }
44
45 class DisplayCompositorClient;
46 class GpuCompositorFrameSink; 41 class GpuCompositorFrameSink;
47 42
48 // The DisplayCompositor object is an object global to the Window Server app 43 // The DisplayCompositor object is an object global to the Window Server app
49 // that holds the SurfaceServer and allocates new Surfaces namespaces. 44 // that holds the SurfaceServer and allocates new Surfaces namespaces.
50 // This object lives on the main thread of the Window Server. 45 // This object lives on the main thread of the Window Server.
51 // TODO(rjkroege, fsamuel): This object will need to change to support multiple 46 // TODO(rjkroege, fsamuel): This object will need to change to support multiple
52 // displays. 47 // displays.
53 class DisplayCompositor : public cc::SurfaceObserver, 48 class DisplayCompositor : public cc::SurfaceObserver,
54 public cc::mojom::DisplayCompositor { 49 public cc::mojom::DisplayCompositor {
55 public: 50 public:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, 85 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request,
91 cc::mojom::MojoCompositorFrameSinkClientPtr client, 86 cc::mojom::MojoCompositorFrameSinkClientPtr client,
92 cc::mojom::DisplayPrivateRequest display_request) override; 87 cc::mojom::DisplayPrivateRequest display_request) override;
93 void CreateOffscreenCompositorFrameSink( 88 void CreateOffscreenCompositorFrameSink(
94 const cc::FrameSinkId& frame_sink_id, 89 const cc::FrameSinkId& frame_sink_id,
95 cc::mojom::MojoCompositorFrameSinkRequest request, 90 cc::mojom::MojoCompositorFrameSinkRequest request,
96 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, 91 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request,
97 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; 92 cc::mojom::MojoCompositorFrameSinkClientPtr client) override;
98 93
99 private: 94 private:
100 friend class test::DisplayCompositorTest;
101
102 void AddSurfaceReference(const cc::SurfaceReference& ref);
103 void RemoveSurfaceReference(const cc::SurfaceReference& ref);
104
105 std::unique_ptr<cc::Display> CreateDisplay( 95 std::unique_ptr<cc::Display> CreateDisplay(
106 const cc::FrameSinkId& frame_sink_id, 96 const cc::FrameSinkId& frame_sink_id,
107 gpu::SurfaceHandle surface_handle, 97 gpu::SurfaceHandle surface_handle,
108 cc::SyntheticBeginFrameSource* begin_frame_source); 98 cc::SyntheticBeginFrameSource* begin_frame_source);
109 99
110 void CreateCompositorFrameSinkInternal( 100 void CreateCompositorFrameSinkInternal(
111 const cc::FrameSinkId& frame_sink_id, 101 const cc::FrameSinkId& frame_sink_id,
112 gpu::SurfaceHandle surface_handle, 102 gpu::SurfaceHandle surface_handle,
113 std::unique_ptr<cc::Display> display, 103 std::unique_ptr<cc::Display> display,
114 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source, 104 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source,
(...skipping 22 matching lines...) Expand all
137 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_; 127 std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_;
138 gpu::ImageFactory* image_factory_; 128 gpu::ImageFactory* image_factory_;
139 129
140 std::unordered_map<cc::FrameSinkId, 130 std::unordered_map<cc::FrameSinkId,
141 std::unique_ptr<GpuCompositorFrameSink>, 131 std::unique_ptr<GpuCompositorFrameSink>,
142 cc::FrameSinkIdHash> 132 cc::FrameSinkIdHash>
143 compositor_frame_sinks_; 133 compositor_frame_sinks_;
144 134
145 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 135 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
146 136
147 // SurfaceIds that have temporary references from top level root so they
148 // aren't GC'd before DisplayCompositorClient can add a real reference. This
149 // is basically a collection of surface ids, for example:
150 // cc::SurfaceId surface_id(key, value[index]);
151 // The LocalFrameIds are stored in the order the surfaces are created in.
152 std::unordered_map<cc::FrameSinkId,
153 std::vector<cc::LocalFrameId>,
154 cc::FrameSinkIdHash>
155 temp_references_;
156
157 base::ThreadChecker thread_checker_; 137 base::ThreadChecker thread_checker_;
158 138
159 cc::mojom::DisplayCompositorClientPtr client_; 139 cc::mojom::DisplayCompositorClientPtr client_;
160 mojo::Binding<cc::mojom::DisplayCompositor> binding_; 140 mojo::Binding<cc::mojom::DisplayCompositor> binding_;
161 141
162 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); 142 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
163 }; 143 };
164 144
165 } // namespace ui 145 } // namespace ui
166 146
167 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ 147 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_manager_ref_unittest.cc ('k') | services/ui/surfaces/display_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698