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_shared_memory.h" | 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
8 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.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 int child_client_id, |
| 65 uint32 sync_point) { |
| 66 switch (type) { |
| 67 case gfx::SHARED_MEMORY_BUFFER: |
| 68 break; |
| 69 case gfx::SURFACE_TEXTURE_BUFFER: |
| 70 if (id.secondary_id != child_client_id) { |
| 71 LOG(ERROR) |
| 72 << "Child attempting to delete GpuMemoryBuffer it does not own"; |
| 73 } else { |
| 74 GpuMemoryBufferImplSurfaceTexture::DeletedByChildProcess(id, |
| 75 sync_point); |
| 76 } |
| 77 break; |
| 78 default: |
| 79 NOTREACHED(); |
| 80 } |
64 } | 81 } |
65 | 82 |
66 // static | 83 // static |
67 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( | 84 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
68 const gfx::GpuMemoryBufferHandle& handle, | 85 const gfx::GpuMemoryBufferHandle& handle, |
69 const gfx::Size& size, | 86 const gfx::Size& size, |
70 Format format, | 87 Format format, |
71 const DestructionCallback& callback) { | 88 const DestructionCallback& callback) { |
72 switch (handle.type) { | 89 switch (handle.type) { |
73 case gfx::SHARED_MEMORY_BUFFER: | 90 case gfx::SHARED_MEMORY_BUFFER: |
74 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( | 91 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( |
75 handle, size, format, callback); | 92 handle, size, format, callback); |
76 case gfx::SURFACE_TEXTURE_BUFFER: | 93 case gfx::SURFACE_TEXTURE_BUFFER: |
77 return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( | 94 return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( |
78 handle, size, format, callback); | 95 handle, size, format, callback); |
79 default: | 96 default: |
80 return scoped_ptr<GpuMemoryBufferImpl>(); | 97 return scoped_ptr<GpuMemoryBufferImpl>(); |
81 } | 98 } |
82 } | 99 } |
83 | 100 |
84 } // namespace content | 101 } // namespace content |
OLD | NEW |