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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 return; | 53 return; |
54 } | 54 } |
55 | 55 |
56 callback.Run(gfx::GpuMemoryBufferHandle()); | 56 callback.Run(gfx::GpuMemoryBufferHandle()); |
57 } | 57 } |
58 | 58 |
59 // static | 59 // static |
60 void GpuMemoryBufferImpl::DeletedByChildProcess( | 60 void GpuMemoryBufferImpl::DeletedByChildProcess( |
61 gfx::GpuMemoryBufferType type, | 61 gfx::GpuMemoryBufferType type, |
62 const gfx::GpuMemoryBufferId& id, | 62 const gfx::GpuMemoryBufferId& id, |
63 base::ProcessHandle child_process) { | 63 base::ProcessHandle child_process, |
64 uint32_t sync_point) { | |
65 switch (type) { | |
66 case gfx::SHARED_MEMORY_BUFFER: | |
67 break; | |
68 case gfx::OZONE_NATIVE_BUFFER: | |
69 GpuMemoryBufferImplOzoneNativeBuffer::DeletedByChildProcess(id, | |
70 sync_point); | |
piman
2014/11/03 19:36:34
What prevents an arbitrary renderer from destroyin
alexst (slow to review)
2014/11/03 20:29:17
Good point, AllocateForChildProcess takes both Pro
| |
71 break; | |
72 default: | |
73 LOG(ERROR) << "Unexpected GpuMemoryBufferType"; | |
74 } | |
64 } | 75 } |
65 | 76 |
66 // static | 77 // static |
67 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( | 78 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
68 const gfx::GpuMemoryBufferHandle& handle, | 79 const gfx::GpuMemoryBufferHandle& handle, |
69 const gfx::Size& size, | 80 const gfx::Size& size, |
70 Format format, | 81 Format format, |
71 const DestructionCallback& callback) { | 82 const DestructionCallback& callback) { |
72 switch (handle.type) { | 83 switch (handle.type) { |
73 case gfx::SHARED_MEMORY_BUFFER: | 84 case gfx::SHARED_MEMORY_BUFFER: |
74 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( | 85 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( |
75 handle, size, format, callback); | 86 handle, size, format, callback); |
76 case gfx::OZONE_NATIVE_BUFFER: | 87 case gfx::OZONE_NATIVE_BUFFER: |
77 return GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle( | 88 return GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle( |
78 handle, size, format, callback); | 89 handle, size, format, callback); |
79 default: | 90 default: |
80 return scoped_ptr<GpuMemoryBufferImpl>(); | 91 return scoped_ptr<GpuMemoryBufferImpl>(); |
81 } | 92 } |
82 } | 93 } |
83 | 94 |
84 } // namespace content | 95 } // namespace content |
OLD | NEW |