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

Side by Side Diff: content/common/gpu/client/gpu_channel_host.h

Issue 656263003: cc: Move GpuMemoryBufferManager interface to gpu namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn build fix Created 6 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 29 matching lines...) Expand all
40 40
41 namespace IPC { 41 namespace IPC {
42 class SyncMessageFilter; 42 class SyncMessageFilter;
43 } 43 }
44 44
45 namespace media { 45 namespace media {
46 class VideoDecodeAccelerator; 46 class VideoDecodeAccelerator;
47 class VideoEncodeAccelerator; 47 class VideoEncodeAccelerator;
48 } 48 }
49 49
50 namespace cc { 50 namespace gpu {
51 class GpuMemoryBufferManager; 51 class GpuMemoryBufferManager;
52 } 52 }
53 53
54 namespace content { 54 namespace content {
55 class CommandBufferProxyImpl; 55 class CommandBufferProxyImpl;
56 class GpuChannelHost; 56 class GpuChannelHost;
57 57
58 struct GpuListenerInfo { 58 struct GpuListenerInfo {
59 GpuListenerInfo(); 59 GpuListenerInfo();
60 ~GpuListenerInfo(); 60 ~GpuListenerInfo();
(...skipping 22 matching lines...) Expand all
83 // IO thread. 83 // IO thread.
84 class GpuChannelHost : public IPC::Sender, 84 class GpuChannelHost : public IPC::Sender,
85 public base::RefCountedThreadSafe<GpuChannelHost> { 85 public base::RefCountedThreadSafe<GpuChannelHost> {
86 public: 86 public:
87 // Must be called on the main thread (as defined by the factory). 87 // Must be called on the main thread (as defined by the factory).
88 static scoped_refptr<GpuChannelHost> Create( 88 static scoped_refptr<GpuChannelHost> Create(
89 GpuChannelHostFactory* factory, 89 GpuChannelHostFactory* factory,
90 const gpu::GPUInfo& gpu_info, 90 const gpu::GPUInfo& gpu_info,
91 const IPC::ChannelHandle& channel_handle, 91 const IPC::ChannelHandle& channel_handle,
92 base::WaitableEvent* shutdown_event, 92 base::WaitableEvent* shutdown_event,
93 cc::GpuMemoryBufferManager* gpu_memory_buffer_manager); 93 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
94 94
95 bool IsLost() const { 95 bool IsLost() const {
96 DCHECK(channel_filter_.get()); 96 DCHECK(channel_filter_.get());
97 return channel_filter_->IsLost(); 97 return channel_filter_->IsLost();
98 } 98 }
99 99
100 // The GPU stats reported by the GPU process. 100 // The GPU stats reported by the GPU process.
101 const gpu::GPUInfo& gpu_info() const { return gpu_info_; } 101 const gpu::GPUInfo& gpu_info() const { return gpu_info_; }
102 102
103 // IPC::Sender implementation: 103 // IPC::Sender implementation:
(...skipping 25 matching lines...) Expand all
129 129
130 // Destroy a command buffer created by this channel. 130 // Destroy a command buffer created by this channel.
131 void DestroyCommandBuffer(CommandBufferProxyImpl* command_buffer); 131 void DestroyCommandBuffer(CommandBufferProxyImpl* command_buffer);
132 132
133 // Add a route for the current message loop. 133 // Add a route for the current message loop.
134 void AddRoute(int route_id, base::WeakPtr<IPC::Listener> listener); 134 void AddRoute(int route_id, base::WeakPtr<IPC::Listener> listener);
135 void RemoveRoute(int route_id); 135 void RemoveRoute(int route_id);
136 136
137 GpuChannelHostFactory* factory() const { return factory_; } 137 GpuChannelHostFactory* factory() const { return factory_; }
138 138
139 cc::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { 139 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const {
140 return gpu_memory_buffer_manager_; 140 return gpu_memory_buffer_manager_;
141 } 141 }
142 142
143 // Returns a handle to the shared memory that can be sent via IPC to the 143 // Returns a handle to the shared memory that can be sent via IPC to the
144 // GPU process. The caller is responsible for ensuring it is closed. Returns 144 // GPU process. The caller is responsible for ensuring it is closed. Returns
145 // an invalid handle on failure. 145 // an invalid handle on failure.
146 base::SharedMemoryHandle ShareToGpuProcess( 146 base::SharedMemoryHandle ShareToGpuProcess(
147 base::SharedMemoryHandle source_handle); 147 base::SharedMemoryHandle source_handle);
148 148
149 // Reserve one unused transfer buffer ID. 149 // Reserve one unused transfer buffer ID.
150 int32 ReserveTransferBufferId(); 150 int32 ReserveTransferBufferId();
151 151
152 // Returns a GPU memory buffer handle to the buffer that can be sent via 152 // Returns a GPU memory buffer handle to the buffer that can be sent via
153 // IPC to the GPU process. The caller is responsible for ensuring it is 153 // IPC to the GPU process. The caller is responsible for ensuring it is
154 // closed. Returns an invalid handle on failure. 154 // closed. Returns an invalid handle on failure.
155 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess( 155 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess(
156 gfx::GpuMemoryBufferHandle source_handle); 156 gfx::GpuMemoryBufferHandle source_handle);
157 157
158 // Reserve one unused image ID. 158 // Reserve one unused image ID.
159 int32 ReserveImageId(); 159 int32 ReserveImageId();
160 160
161 // Generate a route ID guaranteed to be unique for this channel. 161 // Generate a route ID guaranteed to be unique for this channel.
162 int32 GenerateRouteID(); 162 int32 GenerateRouteID();
163 163
164 private: 164 private:
165 friend class base::RefCountedThreadSafe<GpuChannelHost>; 165 friend class base::RefCountedThreadSafe<GpuChannelHost>;
166 GpuChannelHost(GpuChannelHostFactory* factory, 166 GpuChannelHost(GpuChannelHostFactory* factory,
167 const gpu::GPUInfo& gpu_info, 167 const gpu::GPUInfo& gpu_info,
168 cc::GpuMemoryBufferManager* gpu_memory_buffer_manager); 168 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
169 ~GpuChannelHost() override; 169 ~GpuChannelHost() override;
170 void Connect(const IPC::ChannelHandle& channel_handle, 170 void Connect(const IPC::ChannelHandle& channel_handle,
171 base::WaitableEvent* shutdown_event); 171 base::WaitableEvent* shutdown_event);
172 172
173 // A filter used internally to route incoming messages from the IO thread 173 // A filter used internally to route incoming messages from the IO thread
174 // to the correct message loop. It also maintains some shared state between 174 // to the correct message loop. It also maintains some shared state between
175 // all the contexts. 175 // all the contexts.
176 class MessageFilter : public IPC::MessageFilter { 176 class MessageFilter : public IPC::MessageFilter {
177 public: 177 public:
178 MessageFilter(); 178 MessageFilter();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // - |next_image_id_|, atomic type 215 // - |next_image_id_|, atomic type
216 // - |next_route_id_|, atomic type 216 // - |next_route_id_|, atomic type
217 // - |proxies_|, protected by |context_lock_| 217 // - |proxies_|, protected by |context_lock_|
218 GpuChannelHostFactory* const factory_; 218 GpuChannelHostFactory* const factory_;
219 219
220 const gpu::GPUInfo gpu_info_; 220 const gpu::GPUInfo gpu_info_;
221 221
222 scoped_ptr<IPC::SyncChannel> channel_; 222 scoped_ptr<IPC::SyncChannel> channel_;
223 scoped_refptr<MessageFilter> channel_filter_; 223 scoped_refptr<MessageFilter> channel_filter_;
224 224
225 cc::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 225 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
226 226
227 // A filter for sending messages from thread other than the main thread. 227 // A filter for sending messages from thread other than the main thread.
228 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; 228 scoped_refptr<IPC::SyncMessageFilter> sync_filter_;
229 229
230 // Transfer buffer IDs are allocated in sequence. 230 // Transfer buffer IDs are allocated in sequence.
231 base::AtomicSequenceNumber next_transfer_buffer_id_; 231 base::AtomicSequenceNumber next_transfer_buffer_id_;
232 232
233 // Image IDs are allocated in sequence. 233 // Image IDs are allocated in sequence.
234 base::AtomicSequenceNumber next_image_id_; 234 base::AtomicSequenceNumber next_image_id_;
235 235
236 // Route IDs are allocated in sequence. 236 // Route IDs are allocated in sequence.
237 base::AtomicSequenceNumber next_route_id_; 237 base::AtomicSequenceNumber next_route_id_;
238 238
239 // Protects proxies_. 239 // Protects proxies_.
240 mutable base::Lock context_lock_; 240 mutable base::Lock context_lock_;
241 // Used to look up a proxy from its routing id. 241 // Used to look up a proxy from its routing id.
242 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; 242 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap;
243 ProxyMap proxies_; 243 ProxyMap proxies_;
244 244
245 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); 245 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost);
246 }; 246 };
247 247
248 } // namespace content 248 } // namespace content
249 249
250 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 250 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.cc ('k') | content/common/gpu/client/gpu_channel_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698