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

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

Issue 654223006: Cleanup GpuMemoryBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 virtual ~GpuChannelHostFactory() {} 68 virtual ~GpuChannelHostFactory() {}
69 69
70 virtual bool IsMainThread() = 0; 70 virtual bool IsMainThread() = 0;
71 virtual base::MessageLoop* GetMainLoop() = 0; 71 virtual base::MessageLoop* GetMainLoop() = 0;
72 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; 72 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0;
73 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; 73 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0;
74 virtual CreateCommandBufferResult CreateViewCommandBuffer( 74 virtual CreateCommandBufferResult CreateViewCommandBuffer(
75 int32 surface_id, 75 int32 surface_id,
76 const GPUCreateCommandBufferConfig& init_params, 76 const GPUCreateCommandBufferConfig& init_params,
77 int32 route_id) = 0; 77 int32 route_id) = 0;
78 virtual void WaitForPendingGpuMemoryBufferUsageToComplete(
79 const base::Closure& callback) = 0;
78 }; 80 };
79 81
80 // Encapsulates an IPC channel between the client and one GPU process. 82 // Encapsulates an IPC channel between the client and one GPU process.
81 // On the GPU process side there's a corresponding GpuChannel. 83 // On the GPU process side there's a corresponding GpuChannel.
82 // Every method can be called on any thread with a message loop, except for the 84 // Every method can be called on any thread with a message loop, except for the
83 // IO thread. 85 // IO thread.
84 class GpuChannelHost : public IPC::Sender, 86 class GpuChannelHost : public IPC::Sender,
85 public base::RefCountedThreadSafe<GpuChannelHost> { 87 public base::RefCountedThreadSafe<GpuChannelHost> {
86 public: 88 public:
87 // Must be called on the main thread (as defined by the factory). 89 // Must be called on the main thread (as defined by the factory).
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // closed. Returns an invalid handle on failure. 156 // closed. Returns an invalid handle on failure.
155 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess( 157 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess(
156 gfx::GpuMemoryBufferHandle source_handle); 158 gfx::GpuMemoryBufferHandle source_handle);
157 159
158 // Reserve one unused image ID. 160 // Reserve one unused image ID.
159 int32 ReserveImageId(); 161 int32 ReserveImageId();
160 162
161 // Generate a route ID guaranteed to be unique for this channel. 163 // Generate a route ID guaranteed to be unique for this channel.
162 int32 GenerateRouteID(); 164 int32 GenerateRouteID();
163 165
166 void WaitForPendingGpuMemoryBufferUsageToComplete(
167 const base::Closure& callback);
168
164 private: 169 private:
165 friend class base::RefCountedThreadSafe<GpuChannelHost>; 170 friend class base::RefCountedThreadSafe<GpuChannelHost>;
166 GpuChannelHost(GpuChannelHostFactory* factory, 171 GpuChannelHost(GpuChannelHostFactory* factory,
167 const gpu::GPUInfo& gpu_info, 172 const gpu::GPUInfo& gpu_info,
168 cc::GpuMemoryBufferManager* gpu_memory_buffer_manager); 173 cc::GpuMemoryBufferManager* gpu_memory_buffer_manager);
169 ~GpuChannelHost() override; 174 ~GpuChannelHost() override;
170 void Connect(const IPC::ChannelHandle& channel_handle, 175 void Connect(const IPC::ChannelHandle& channel_handle,
171 base::WaitableEvent* shutdown_event); 176 base::WaitableEvent* shutdown_event);
172 177
173 // A filter used internally to route incoming messages from the IO thread 178 // A filter used internally to route incoming messages from the IO thread
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 240
236 // Route IDs are allocated in sequence. 241 // Route IDs are allocated in sequence.
237 base::AtomicSequenceNumber next_route_id_; 242 base::AtomicSequenceNumber next_route_id_;
238 243
239 // Protects proxies_. 244 // Protects proxies_.
240 mutable base::Lock context_lock_; 245 mutable base::Lock context_lock_;
241 // Used to look up a proxy from its routing id. 246 // Used to look up a proxy from its routing id.
242 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; 247 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap;
243 ProxyMap proxies_; 248 ProxyMap proxies_;
244 249
250 void GpuMemoryBufferWaitCompleted(
251 uint32 id,
252 scoped_refptr<base::MessageLoopProxy> caller_message_loop);
253 void GpuMemoryBufferWaitCompletedOnCallerThread(uint32 id);
254
255 // Protects signal_tasks_.
256 mutable base::Lock signal_lock_;
257 typedef base::hash_map<uint32, base::Closure> SignalTaskMap;
reveman 2014/10/22 22:42:47 GpuMemoryBufferUsageCompletedTaskMap?
258 SignalTaskMap signal_tasks_;
259 uint32 next_signal_id_;
260
245 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); 261 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost);
246 }; 262 };
247 263
248 } // namespace content 264 } // namespace content
249 265
250 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 266 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698