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 "content/common/child_process_messages.h" | 7 #include "content/common/child_process_messages.h" |
8 #include "content/common/generic_shared_memory_id_generator.h" | 8 #include "content/common/generic_shared_memory_id_generator.h" |
9 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 9 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... | |
38 "width", | 38 "width", |
39 size.width(), | 39 size.width(), |
40 "height", | 40 "height", |
41 size.height()); | 41 size.height()); |
42 | 42 |
43 gfx::GpuMemoryBufferHandle handle; | 43 gfx::GpuMemoryBufferHandle handle; |
44 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( | 44 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( |
45 content::GetNextGenericSharedMemoryId(), size.width(), size.height(), | 45 content::GetNextGenericSharedMemoryId(), size.width(), size.height(), |
46 format, usage, &handle); | 46 format, usage, &handle); |
47 bool success = sender_->Send(message); | 47 bool success = sender_->Send(message); |
48 if (!success || handle.is_null()) | 48 CHECK(success); |
49 return nullptr; | 49 CHECK(!handle.is_null()); |
reveman
2015/12/01 20:49:04
It would be useful to know what arguments such as
| |
50 | 50 |
51 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( | 51 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( |
52 handle, size, format, usage, | 52 handle, size, format, usage, |
53 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.id))); | 53 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.id))); |
54 if (!buffer) { | 54 if (!buffer) { |
reveman
2015/12/01 20:49:04
This doesn't make sense if we have a CHECK below.
| |
55 sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer( | 55 sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer( |
56 handle.id, gpu::SyncToken())); | 56 handle.id, gpu::SyncToken())); |
57 return nullptr; | |
58 } | 57 } |
58 CHECK(buffer); | |
59 | 59 |
60 return buffer.Pass(); | 60 return buffer.Pass(); |
61 } | 61 } |
62 | 62 |
63 scoped_ptr<gfx::GpuMemoryBuffer> | 63 scoped_ptr<gfx::GpuMemoryBuffer> |
64 ChildGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle( | 64 ChildGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle( |
65 const gfx::GpuMemoryBufferHandle& handle, | 65 const gfx::GpuMemoryBufferHandle& handle, |
66 const gfx::Size& size, | 66 const gfx::Size& size, |
67 gfx::BufferFormat format) { | 67 gfx::BufferFormat format) { |
68 NOTIMPLEMENTED(); | 68 NOTIMPLEMENTED(); |
69 return nullptr; | 69 return nullptr; |
70 } | 70 } |
71 | 71 |
72 gfx::GpuMemoryBuffer* | 72 gfx::GpuMemoryBuffer* |
73 ChildGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer( | 73 ChildGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer( |
74 ClientBuffer buffer) { | 74 ClientBuffer buffer) { |
75 return GpuMemoryBufferImpl::FromClientBuffer(buffer); | 75 return GpuMemoryBufferImpl::FromClientBuffer(buffer); |
76 } | 76 } |
77 | 77 |
78 void ChildGpuMemoryBufferManager::SetDestructionSyncToken( | 78 void ChildGpuMemoryBufferManager::SetDestructionSyncToken( |
79 gfx::GpuMemoryBuffer* buffer, | 79 gfx::GpuMemoryBuffer* buffer, |
80 const gpu::SyncToken& sync_token) { | 80 const gpu::SyncToken& sync_token) { |
81 static_cast<GpuMemoryBufferImpl*>(buffer) | 81 static_cast<GpuMemoryBufferImpl*>(buffer) |
82 ->set_destruction_sync_token(sync_token); | 82 ->set_destruction_sync_token(sync_token); |
83 } | 83 } |
84 | 84 |
85 } // namespace content | 85 } // namespace content |
OLD | NEW |