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

Side by Side Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.cc

Issue 2915553002: Add BrowserGpuMemoryBufferManager::BufferInfo::shared_memory_guid (Closed)
Patch Set: impl Created 3 years, 6 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 | « content/browser/gpu/browser_gpu_memory_buffer_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 5 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 // Note: Unretained is safe as IO thread is stopped before manager is 287 // Note: Unretained is safe as IO thread is stopped before manager is
288 // destroyed. 288 // destroyed.
289 request->result = gpu::GpuMemoryBufferImplSharedMemory::Create( 289 request->result = gpu::GpuMemoryBufferImplSharedMemory::Create(
290 new_id, request->size, request->format, 290 new_id, request->size, request->format,
291 base::Bind( 291 base::Bind(
292 &GpuMemoryBufferDeleted, 292 &GpuMemoryBufferDeleted,
293 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 293 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
294 base::Bind(&BrowserGpuMemoryBufferManager::DestroyGpuMemoryBufferOnIO, 294 base::Bind(&BrowserGpuMemoryBufferManager::DestroyGpuMemoryBufferOnIO,
295 base::Unretained(this), new_id, request->client_id))); 295 base::Unretained(this), new_id, request->client_id)));
296 if (request->result) {
297 buffers.find(new_id)->second.shared_memory_guid =
298 request->result->GetHandle().handle.GetGUID();
299 }
296 request->event.Signal(); 300 request->event.Signal();
297 } 301 }
298 302
299 void BrowserGpuMemoryBufferManager::HandleGpuMemoryBufferCreatedOnIO( 303 void BrowserGpuMemoryBufferManager::HandleGpuMemoryBufferCreatedOnIO(
300 CreateGpuMemoryBufferRequest* request, 304 CreateGpuMemoryBufferRequest* request,
301 const gfx::GpuMemoryBufferHandle& handle) { 305 const gfx::GpuMemoryBufferHandle& handle) {
302 DCHECK_CURRENTLY_ON(BrowserThread::IO); 306 DCHECK_CURRENTLY_ON(BrowserThread::IO);
303 307
304 // Early out if factory failed to create the buffer. 308 // Early out if factory failed to create the buffer.
305 if (handle.is_null()) { 309 if (handle.is_null()) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 buffers.erase(buffer_it); 408 buffers.erase(buffer_it);
405 callback.Run(gfx::GpuMemoryBufferHandle()); 409 callback.Run(gfx::GpuMemoryBufferHandle());
406 } 410 }
407 return; 411 return;
408 } 412 }
409 413
410 // Store the type and host id of this buffer so it can be cleaned up if the 414 // Store the type and host id of this buffer so it can be cleaned up if the
411 // client is removed. 415 // client is removed.
412 buffer_it->second.type = handle.type; 416 buffer_it->second.type = handle.type;
413 buffer_it->second.gpu_host_id = gpu_host_id; 417 buffer_it->second.gpu_host_id = gpu_host_id;
418 buffer_it->second.shared_memory_guid = handle.handle.GetGUID();
414 419
415 callback.Run(handle); 420 callback.Run(handle);
416 } 421 }
417 422
418 void BrowserGpuMemoryBufferManager::DestroyGpuMemoryBufferOnIO( 423 void BrowserGpuMemoryBufferManager::DestroyGpuMemoryBufferOnIO(
419 gfx::GpuMemoryBufferId id, 424 gfx::GpuMemoryBufferId id,
420 int client_id, 425 int client_id,
421 const gpu::SyncToken& sync_token) { 426 const gpu::SyncToken& sync_token) {
422 DCHECK_CURRENTLY_ON(BrowserThread::IO); 427 DCHECK_CURRENTLY_ON(BrowserThread::IO);
423 DCHECK(clients_.find(client_id) != clients_.end()); 428 DCHECK(clients_.find(client_id) != clients_.end());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 format(format), 473 format(format),
469 usage(usage), 474 usage(usage),
470 gpu_host_id(gpu_host_id) {} 475 gpu_host_id(gpu_host_id) {}
471 476
472 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) = 477 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) =
473 default; 478 default;
474 479
475 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} 480 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {}
476 481
477 } // namespace content 482 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_memory_buffer_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698