OLD | NEW |
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/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_ozone_native_buffer.h
" | 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 void GpuMemoryBufferImpl::DeletedByChildProcess( | 61 void GpuMemoryBufferImpl::DeletedByChildProcess( |
62 gfx::GpuMemoryBufferType type, | 62 gfx::GpuMemoryBufferType type, |
63 const gfx::GpuMemoryBufferId& id, | 63 const gfx::GpuMemoryBufferId& id, |
64 base::ProcessHandle child_process) { | 64 base::ProcessHandle child_process) { |
65 } | 65 } |
66 | 66 |
67 // static | 67 // static |
68 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( | 68 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
69 const gfx::GpuMemoryBufferHandle& handle, | 69 const gfx::GpuMemoryBufferHandle& handle, |
70 const gfx::Size& size, | 70 const gfx::Size& size, |
71 unsigned internalformat) { | 71 unsigned internalformat, |
| 72 const DestructionCallback& callback) { |
72 switch (handle.type) { | 73 switch (handle.type) { |
73 case gfx::SHARED_MEMORY_BUFFER: { | 74 case gfx::SHARED_MEMORY_BUFFER: { |
74 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( | 75 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( |
75 new GpuMemoryBufferImplSharedMemory(size, internalformat)); | 76 new GpuMemoryBufferImplSharedMemory(size, internalformat, callback)); |
76 if (!buffer->InitializeFromHandle(handle)) | 77 if (!buffer->InitializeFromHandle(handle)) |
77 return scoped_ptr<GpuMemoryBufferImpl>(); | 78 return scoped_ptr<GpuMemoryBufferImpl>(); |
78 | 79 |
79 return buffer.PassAs<GpuMemoryBufferImpl>(); | 80 return buffer.PassAs<GpuMemoryBufferImpl>(); |
80 } | 81 } |
81 case gfx::OZONE_NATIVE_BUFFER: { | 82 case gfx::OZONE_NATIVE_BUFFER: { |
82 scoped_ptr<GpuMemoryBufferImplOzoneNativeBuffer> buffer( | 83 scoped_ptr<GpuMemoryBufferImplOzoneNativeBuffer> buffer( |
83 new GpuMemoryBufferImplOzoneNativeBuffer(size, internalformat)); | 84 new GpuMemoryBufferImplOzoneNativeBuffer( |
| 85 size, internalformat, callback)); |
84 if (!buffer->InitializeFromHandle(handle)) | 86 if (!buffer->InitializeFromHandle(handle)) |
85 return scoped_ptr<GpuMemoryBufferImpl>(); | 87 return scoped_ptr<GpuMemoryBufferImpl>(); |
86 | 88 |
87 return buffer.PassAs<GpuMemoryBufferImpl>(); | 89 return buffer.PassAs<GpuMemoryBufferImpl>(); |
88 } | 90 } |
89 default: | 91 default: |
90 return scoped_ptr<GpuMemoryBufferImpl>(); | 92 return scoped_ptr<GpuMemoryBufferImpl>(); |
91 } | 93 } |
92 } | 94 } |
93 | 95 |
94 } // namespace content | 96 } // namespace content |
OLD | NEW |