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

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

Issue 2496783002: gpu: Reuse existing code for shared memory allocation. (Closed)
Patch Set: . Created 4 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 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 auto insert_result = buffers.insert(std::make_pair( 281 auto insert_result = buffers.insert(std::make_pair(
282 id, BufferInfo(size, gfx::SHARED_MEMORY_BUFFER, format, usage, 0))); 282 id, BufferInfo(size, gfx::SHARED_MEMORY_BUFFER, format, usage, 0)));
283 if (!insert_result.second) { 283 if (!insert_result.second) {
284 DLOG(ERROR) << "Child process attempted to allocate a GpuMemoryBuffer with " 284 DLOG(ERROR) << "Child process attempted to allocate a GpuMemoryBuffer with "
285 "an existing ID."; 285 "an existing ID.";
286 callback.Run(gfx::GpuMemoryBufferHandle()); 286 callback.Run(gfx::GpuMemoryBufferHandle());
287 return; 287 return;
288 } 288 }
289 289
290 callback.Run(gpu::GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( 290 callback.Run(gpu::GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
291 id, size, format, child_process_handle)); 291 id, size, format));
292 } 292 }
293 293
294 void BrowserGpuMemoryBufferManager::SetDestructionSyncToken( 294 void BrowserGpuMemoryBufferManager::SetDestructionSyncToken(
295 gfx::GpuMemoryBuffer* buffer, 295 gfx::GpuMemoryBuffer* buffer,
296 const gpu::SyncToken& sync_token) { 296 const gpu::SyncToken& sync_token) {
297 static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token( 297 static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token(
298 sync_token); 298 sync_token);
299 } 299 }
300 300
301 bool BrowserGpuMemoryBufferManager::OnMemoryDump( 301 bool BrowserGpuMemoryBufferManager::OnMemoryDump(
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 format(format), 679 format(format),
680 usage(usage), 680 usage(usage),
681 gpu_host_id(gpu_host_id) {} 681 gpu_host_id(gpu_host_id) {}
682 682
683 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) = 683 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) =
684 default; 684 default;
685 685
686 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} 686 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {}
687 687
688 } // namespace content 688 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698