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

Side by Side Diff: components/mus/gles2/command_buffer_local.cc

Issue 1906623003: Convert //components/mus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/gles2/command_buffer_local.h" 5 #include "components/mus/gles2/command_buffer_local.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return nullptr; 198 return nullptr;
199 } 199 }
200 200
201 *id = ++next_transfer_buffer_id_; 201 *id = ++next_transfer_buffer_id_;
202 202
203 gpu_state_->command_buffer_task_runner()->PostTask( 203 gpu_state_->command_buffer_task_runner()->PostTask(
204 driver_.get(), 204 driver_.get(),
205 base::Bind(&CommandBufferLocal::RegisterTransferBufferOnGpuThread, 205 base::Bind(&CommandBufferLocal::RegisterTransferBufferOnGpuThread,
206 base::Unretained(this), *id, base::Passed(&duped), 206 base::Unretained(this), *id, base::Passed(&duped),
207 static_cast<uint32_t>(size))); 207 static_cast<uint32_t>(size)));
208 scoped_ptr<gpu::BufferBacking> backing( 208 std::unique_ptr<gpu::BufferBacking> backing(
209 new mus::MojoBufferBacking(std::move(handle), memory, size)); 209 new mus::MojoBufferBacking(std::move(handle), memory, size));
210 scoped_refptr<gpu::Buffer> buffer(new gpu::Buffer(std::move(backing))); 210 scoped_refptr<gpu::Buffer> buffer(new gpu::Buffer(std::move(backing)));
211 return buffer; 211 return buffer;
212 } 212 }
213 213
214 void CommandBufferLocal::DestroyTransferBuffer(int32_t id) { 214 void CommandBufferLocal::DestroyTransferBuffer(int32_t id) {
215 DCHECK(CalledOnValidThread()); 215 DCHECK(CalledOnValidThread());
216 gpu_state_->command_buffer_task_runner()->PostTask( 216 gpu_state_->command_buffer_task_runner()->PostTask(
217 driver_.get(), 217 driver_.get(),
218 base::Bind(&CommandBufferLocal::DestroyTransferBufferOnGpuThread, 218 base::Bind(&CommandBufferLocal::DestroyTransferBufferOnGpuThread,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 driver_.get(), base::Bind(&CommandBufferLocal::DestroyImageOnGpuThread, 305 driver_.get(), base::Bind(&CommandBufferLocal::DestroyImageOnGpuThread,
306 base::Unretained(this), id)); 306 base::Unretained(this), id));
307 } 307 }
308 308
309 int32_t CommandBufferLocal::CreateGpuMemoryBufferImage(size_t width, 309 int32_t CommandBufferLocal::CreateGpuMemoryBufferImage(size_t width,
310 size_t height, 310 size_t height,
311 unsigned internal_format, 311 unsigned internal_format,
312 unsigned usage) { 312 unsigned usage) {
313 DCHECK(CalledOnValidThread()); 313 DCHECK(CalledOnValidThread());
314 DCHECK_EQ(usage, static_cast<unsigned>(GL_READ_WRITE_CHROMIUM)); 314 DCHECK_EQ(usage, static_cast<unsigned>(GL_READ_WRITE_CHROMIUM));
315 scoped_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create( 315 std::unique_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create(
316 gfx::Size(static_cast<int>(width), static_cast<int>(height)), 316 gfx::Size(static_cast<int>(width), static_cast<int>(height)),
317 gpu::DefaultBufferFormatForImageFormat(internal_format), 317 gpu::DefaultBufferFormatForImageFormat(internal_format),
318 gfx::BufferUsage::SCANOUT)); 318 gfx::BufferUsage::SCANOUT));
319 if (!buffer) 319 if (!buffer)
320 return -1; 320 return -1;
321 return CreateImage(buffer->AsClientBuffer(), width, height, internal_format); 321 return CreateImage(buffer->AsClientBuffer(), width, height, internal_format);
322 } 322 }
323 323
324 void CommandBufferLocal::SignalQuery(uint32_t query_id, 324 void CommandBufferLocal::SignalQuery(uint32_t query_id,
325 const base::Closure& callback) { 325 const base::Closure& callback) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 client_->UpdateVSyncParameters(timebase, interval); 585 client_->UpdateVSyncParameters(timebase, interval);
586 } 586 }
587 587
588 void CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread( 588 void CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread(
589 gfx::SwapResult result) { 589 gfx::SwapResult result) {
590 if (client_) 590 if (client_)
591 client_->GpuCompletedSwapBuffers(result); 591 client_->GpuCompletedSwapBuffers(result);
592 } 592 }
593 593
594 } // namespace mus 594 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_local.h ('k') | components/mus/gles2/command_buffer_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698