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