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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl_win.cc

Issue 685983005: gpu: Associate all GpuMemoryBuffers with unique IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/gpu/client/gpu_memory_buffer_impl.h" 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
6 6
7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 // static 11 // static
12 void GpuMemoryBufferImpl::Create(const gfx::Size& size, 12 void GpuMemoryBufferImpl::Create(gfx::GpuMemoryBufferId id,
13 const gfx::Size& size,
13 Format format, 14 Format format,
14 Usage usage, 15 Usage usage,
15 int client_id, 16 int client_id,
16 const CreationCallback& callback) { 17 const CreationCallback& callback) {
17 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( 18 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
18 size, format, usage)) { 19 size, format, usage)) {
19 GpuMemoryBufferImplSharedMemory::Create(size, format, callback); 20 GpuMemoryBufferImplSharedMemory::Create(id, size, format, callback);
20 return; 21 return;
21 } 22 }
22 23
23 callback.Run(scoped_ptr<GpuMemoryBufferImpl>()); 24 callback.Run(scoped_ptr<GpuMemoryBufferImpl>());
24 } 25 }
25 26
26 // static 27 // static
27 void GpuMemoryBufferImpl::AllocateForChildProcess( 28 void GpuMemoryBufferImpl::AllocateForChildProcess(
29 gfx::GpuMemoryBufferId id,
28 const gfx::Size& size, 30 const gfx::Size& size,
29 Format format, 31 Format format,
30 Usage usage, 32 Usage usage,
31 base::ProcessHandle child_process, 33 base::ProcessHandle child_process,
32 int child_client_id, 34 int child_client_id,
33 const AllocationCallback& callback) { 35 const AllocationCallback& callback) {
34 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( 36 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
35 size, format, usage)) { 37 size, format, usage)) {
36 GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( 38 GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
37 size, format, child_process, callback); 39 id, size, format, child_process, callback);
38 return; 40 return;
39 } 41 }
40 42
41 callback.Run(gfx::GpuMemoryBufferHandle()); 43 callback.Run(gfx::GpuMemoryBufferHandle());
42 } 44 }
43 45
44 // static 46 // static
45 void GpuMemoryBufferImpl::DeletedByChildProcess( 47 void GpuMemoryBufferImpl::DeletedByChildProcess(
46 gfx::GpuMemoryBufferType type, 48 gfx::GpuMemoryBufferType type,
47 const gfx::GpuMemoryBufferId& id, 49 gfx::GpuMemoryBufferId id,
48 base::ProcessHandle child_process) { 50 base::ProcessHandle child_process,
51 int child_client_id) {
49 } 52 }
50 53
51 // static 54 // static
52 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( 55 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
53 const gfx::GpuMemoryBufferHandle& handle, 56 const gfx::GpuMemoryBufferHandle& handle,
54 const gfx::Size& size, 57 const gfx::Size& size,
55 Format format, 58 Format format,
56 const DestructionCallback& callback) { 59 const DestructionCallback& callback) {
57 switch (handle.type) { 60 switch (handle.type) {
58 case gfx::SHARED_MEMORY_BUFFER: 61 case gfx::SHARED_MEMORY_BUFFER:
59 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( 62 return GpuMemoryBufferImplSharedMemory::CreateFromHandle(
60 handle, size, format, callback); 63 handle, size, format, callback);
61 default: 64 default:
62 return scoped_ptr<GpuMemoryBufferImpl>(); 65 return scoped_ptr<GpuMemoryBufferImpl>();
63 } 66 }
64 } 67 }
65 68
66 } // namespace content 69 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698