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 { |
(...skipping 27 matching lines...) Expand all Loading... |
38 size, internalformat, usage)) { | 38 size, internalformat, usage)) { |
39 GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess( | 39 GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess( |
40 size, internalformat, child_process, callback); | 40 size, internalformat, child_process, callback); |
41 return; | 41 return; |
42 } | 42 } |
43 | 43 |
44 callback.Run(gfx::GpuMemoryBufferHandle()); | 44 callback.Run(gfx::GpuMemoryBufferHandle()); |
45 } | 45 } |
46 | 46 |
47 // static | 47 // static |
| 48 void GpuMemoryBufferImpl::DeletedByChildProcess( |
| 49 gfx::GpuMemoryBufferType type, |
| 50 const gfx::GpuMemoryBufferId& id, |
| 51 base::ProcessHandle child_process) { |
| 52 } |
| 53 |
| 54 // static |
48 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( | 55 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
49 gfx::GpuMemoryBufferHandle handle, | 56 const gfx::GpuMemoryBufferHandle& handle, |
50 const gfx::Size& size, | 57 const gfx::Size& size, |
51 unsigned internalformat) { | 58 unsigned internalformat) { |
52 switch (handle.type) { | 59 switch (handle.type) { |
53 case gfx::SHARED_MEMORY_BUFFER: { | 60 case gfx::SHARED_MEMORY_BUFFER: { |
54 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( | 61 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( |
55 new GpuMemoryBufferImplSharedMemory(size, internalformat)); | 62 new GpuMemoryBufferImplSharedMemory(size, internalformat)); |
56 if (!buffer->InitializeFromHandle(handle)) | 63 if (!buffer->InitializeFromHandle(handle)) |
57 return scoped_ptr<GpuMemoryBufferImpl>(); | 64 return scoped_ptr<GpuMemoryBufferImpl>(); |
58 | 65 |
59 return buffer.PassAs<GpuMemoryBufferImpl>(); | 66 return buffer.PassAs<GpuMemoryBufferImpl>(); |
60 } | 67 } |
61 case gfx::IO_SURFACE_BUFFER: { | 68 case gfx::IO_SURFACE_BUFFER: { |
62 scoped_ptr<GpuMemoryBufferImplIOSurface> buffer( | 69 scoped_ptr<GpuMemoryBufferImplIOSurface> buffer( |
63 new GpuMemoryBufferImplIOSurface(size, internalformat)); | 70 new GpuMemoryBufferImplIOSurface(size, internalformat)); |
64 if (!buffer->InitializeFromHandle(handle)) | 71 if (!buffer->InitializeFromHandle(handle)) |
65 return scoped_ptr<GpuMemoryBufferImpl>(); | 72 return scoped_ptr<GpuMemoryBufferImpl>(); |
66 | 73 |
67 return buffer.PassAs<GpuMemoryBufferImpl>(); | 74 return buffer.PassAs<GpuMemoryBufferImpl>(); |
68 } | 75 } |
69 default: | 76 default: |
70 return scoped_ptr<GpuMemoryBufferImpl>(); | 77 return scoped_ptr<GpuMemoryBufferImpl>(); |
71 } | 78 } |
72 } | 79 } |
73 | 80 |
74 } // namespace content | 81 } // namespace content |
OLD | NEW |