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/child/child_gpu_memory_buffer_manager.h" | 5 #include "content/child/child_gpu_memory_buffer_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/common/child_process_messages.h" | 9 #include "content/common/child_process_messages.h" |
10 #include "content/common/generic_shared_memory_id_generator.h" | 10 #include "content/common/generic_shared_memory_id_generator.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 gfx::GpuMemoryBufferHandle handle; | 45 gfx::GpuMemoryBufferHandle handle; |
46 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( | 46 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( |
47 content::GetNextGenericSharedMemoryId(), size.width(), size.height(), | 47 content::GetNextGenericSharedMemoryId(), size.width(), size.height(), |
48 format, usage, &handle); | 48 format, usage, &handle); |
49 bool success = sender_->Send(message); | 49 bool success = sender_->Send(message); |
50 if (!success || handle.is_null()) | 50 if (!success || handle.is_null()) |
51 return nullptr; | 51 return nullptr; |
52 | 52 |
53 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( | 53 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( |
54 handle, size, format, usage, | 54 handle, size, format, usage, |
55 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.id))); | 55 base::Bind(&DeletedGpuMemoryBuffer, base::RetainedRef(sender_), |
| 56 handle.id))); |
56 if (!buffer) { | 57 if (!buffer) { |
57 sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer( | 58 sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer( |
58 handle.id, gpu::SyncToken())); | 59 handle.id, gpu::SyncToken())); |
59 return nullptr; | 60 return nullptr; |
60 } | 61 } |
61 | 62 |
62 return std::move(buffer); | 63 return std::move(buffer); |
63 } | 64 } |
64 | 65 |
65 scoped_ptr<gfx::GpuMemoryBuffer> | 66 scoped_ptr<gfx::GpuMemoryBuffer> |
(...skipping 12 matching lines...) Expand all Loading... |
78 } | 79 } |
79 | 80 |
80 void ChildGpuMemoryBufferManager::SetDestructionSyncToken( | 81 void ChildGpuMemoryBufferManager::SetDestructionSyncToken( |
81 gfx::GpuMemoryBuffer* buffer, | 82 gfx::GpuMemoryBuffer* buffer, |
82 const gpu::SyncToken& sync_token) { | 83 const gpu::SyncToken& sync_token) { |
83 static_cast<GpuMemoryBufferImpl*>(buffer) | 84 static_cast<GpuMemoryBufferImpl*>(buffer) |
84 ->set_destruction_sync_token(sync_token); | 85 ->set_destruction_sync_token(sync_token); |
85 } | 86 } |
86 | 87 |
87 } // namespace content | 88 } // namespace content |
OLD | NEW |