OLD | NEW |
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_io_surface.h" | 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" |
8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 // static | 12 // static |
13 void GpuMemoryBufferImpl::Create(const gfx::Size& size, | 13 void GpuMemoryBufferImpl::Create(const gfx::Size& size, |
14 unsigned internalformat, | 14 unsigned internalformat, |
15 unsigned usage, | 15 unsigned usage, |
| 16 int client_id, |
16 const CreationCallback& callback) { | 17 const CreationCallback& callback) { |
17 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( | 18 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( |
18 size, internalformat, usage)) { | 19 size, internalformat, usage)) { |
19 GpuMemoryBufferImplSharedMemory::Create( | 20 GpuMemoryBufferImplSharedMemory::Create( |
20 size, internalformat, usage, callback); | 21 size, internalformat, usage, callback); |
21 return; | 22 return; |
22 } | 23 } |
23 | 24 |
24 callback.Run(scoped_ptr<GpuMemoryBufferImpl>()); | 25 callback.Run(scoped_ptr<GpuMemoryBufferImpl>()); |
25 } | 26 } |
26 | 27 |
27 // static | 28 // static |
28 void GpuMemoryBufferImpl::AllocateForChildProcess( | 29 void GpuMemoryBufferImpl::AllocateForChildProcess( |
29 const gfx::Size& size, | 30 const gfx::Size& size, |
30 unsigned internalformat, | 31 unsigned internalformat, |
31 unsigned usage, | 32 unsigned usage, |
32 base::ProcessHandle child_process, | 33 base::ProcessHandle child_process, |
33 int child_id, | 34 int child_client_id, |
34 const AllocationCallback& callback) { | 35 const AllocationCallback& callback) { |
35 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( | 36 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( |
36 size, internalformat, usage)) { | 37 size, internalformat, usage)) { |
37 GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess( | 38 GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess( |
38 size, internalformat, child_process, callback); | 39 size, internalformat, child_process, callback); |
39 return; | 40 return; |
40 } | 41 } |
41 | 42 |
42 callback.Run(gfx::GpuMemoryBufferHandle()); | 43 callback.Run(gfx::GpuMemoryBufferHandle()); |
43 } | 44 } |
(...skipping 26 matching lines...) Expand all Loading... |
70 return scoped_ptr<GpuMemoryBufferImpl>(); | 71 return scoped_ptr<GpuMemoryBufferImpl>(); |
71 | 72 |
72 return buffer.PassAs<GpuMemoryBufferImpl>(); | 73 return buffer.PassAs<GpuMemoryBufferImpl>(); |
73 } | 74 } |
74 default: | 75 default: |
75 return scoped_ptr<GpuMemoryBufferImpl>(); | 76 return scoped_ptr<GpuMemoryBufferImpl>(); |
76 } | 77 } |
77 } | 78 } |
78 | 79 |
79 } // namespace content | 80 } // namespace content |
OLD | NEW |