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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return; | 50 return; |
51 } | 51 } |
52 | 52 |
53 callback.Run(gfx::GpuMemoryBufferHandle()); | 53 callback.Run(gfx::GpuMemoryBufferHandle()); |
54 } | 54 } |
55 | 55 |
56 // static | 56 // static |
57 void GpuMemoryBufferImpl::DeletedByChildProcess( | 57 void GpuMemoryBufferImpl::DeletedByChildProcess( |
58 gfx::GpuMemoryBufferType type, | 58 gfx::GpuMemoryBufferType type, |
59 const gfx::GpuMemoryBufferId& id, | 59 const gfx::GpuMemoryBufferId& id, |
60 base::ProcessHandle child_process) { | 60 base::ProcessHandle child_process, |
| 61 int child_client_id, |
| 62 uint32 sync_point) { |
| 63 switch (type) { |
| 64 case gfx::SHARED_MEMORY_BUFFER: |
| 65 break; |
| 66 case gfx::IO_SURFACE_BUFFER: |
| 67 if (id.secondary_id != child_client_id) { |
| 68 LOG(ERROR) |
| 69 << "Child attempting to delete GpuMemoryBuffer it does not own"; |
| 70 } else { |
| 71 GpuMemoryBufferImplIOSurface::DeletedByChildProcess(id, sync_point); |
| 72 } |
| 73 break; |
| 74 default: |
| 75 NOTREACHED(); |
| 76 } |
61 } | 77 } |
62 | 78 |
63 // static | 79 // static |
64 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( | 80 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
65 const gfx::GpuMemoryBufferHandle& handle, | 81 const gfx::GpuMemoryBufferHandle& handle, |
66 const gfx::Size& size, | 82 const gfx::Size& size, |
67 Format format, | 83 Format format, |
68 const DestructionCallback& callback) { | 84 const DestructionCallback& callback) { |
69 switch (handle.type) { | 85 switch (handle.type) { |
70 case gfx::SHARED_MEMORY_BUFFER: | 86 case gfx::SHARED_MEMORY_BUFFER: |
71 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( | 87 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( |
72 handle, size, format, callback); | 88 handle, size, format, callback); |
73 case gfx::IO_SURFACE_BUFFER: | 89 case gfx::IO_SURFACE_BUFFER: |
74 return GpuMemoryBufferImplIOSurface::CreateFromHandle( | 90 return GpuMemoryBufferImplIOSurface::CreateFromHandle( |
75 handle, size, format, callback); | 91 handle, size, format, callback); |
76 default: | 92 default: |
77 return scoped_ptr<GpuMemoryBufferImpl>(); | 93 return scoped_ptr<GpuMemoryBufferImpl>(); |
78 } | 94 } |
79 } | 95 } |
80 | 96 |
81 } // namespace content | 97 } // namespace content |
OLD | NEW |