Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: cc/test/test_gpu_memory_buffer_manager.cc

Issue 2572703004: exo: Directly create GpuMemoryBufferImpl when a handle is available. (Closed)
Patch Set: null callback Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/test_gpu_memory_buffer_manager.h ('k') | components/exo/display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/test/test_gpu_memory_buffer_manager.h" 5 #include "cc/test/test_gpu_memory_buffer_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 last_gpu_memory_buffer_id_ += 1; 166 last_gpu_memory_buffer_id_ += 1;
167 std::unique_ptr<gfx::GpuMemoryBuffer> result(new GpuMemoryBufferImpl( 167 std::unique_ptr<gfx::GpuMemoryBuffer> result(new GpuMemoryBufferImpl(
168 this, last_gpu_memory_buffer_id_, size, format, std::move(shared_memory), 168 this, last_gpu_memory_buffer_id_, size, format, std::move(shared_memory),
169 0, base::checked_cast<int>( 169 0, base::checked_cast<int>(
170 gfx::RowSizeForBufferFormat(size.width(), format, 0)))); 170 gfx::RowSizeForBufferFormat(size.width(), format, 0))));
171 buffers_[last_gpu_memory_buffer_id_] = result.get(); 171 buffers_[last_gpu_memory_buffer_id_] = result.get();
172 return result; 172 return result;
173 } 173 }
174 174
175 std::unique_ptr<gfx::GpuMemoryBuffer>
176 TestGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle(
177 const gfx::GpuMemoryBufferHandle& handle,
178 const gfx::Size& size,
179 gfx::BufferFormat format) {
180 if (handle.type != gfx::SHARED_MEMORY_BUFFER)
181 return nullptr;
182
183 last_gpu_memory_buffer_id_ += 1;
184 std::unique_ptr<gfx::GpuMemoryBuffer> result(new GpuMemoryBufferImpl(
185 this, last_gpu_memory_buffer_id_, size, format,
186 base::MakeUnique<base::SharedMemory>(handle.handle, false), handle.offset,
187 handle.stride));
188 buffers_[last_gpu_memory_buffer_id_] = result.get();
189 return result;
190 }
191
192 void TestGpuMemoryBufferManager::SetDestructionSyncToken( 175 void TestGpuMemoryBufferManager::SetDestructionSyncToken(
193 gfx::GpuMemoryBuffer* buffer, 176 gfx::GpuMemoryBuffer* buffer,
194 const gpu::SyncToken& sync_token) {} 177 const gpu::SyncToken& sync_token) {}
195 178
196 } // namespace cc 179 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_gpu_memory_buffer_manager.h ('k') | components/exo/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698