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

Side by Side Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.h ('k') | gpu/command_buffer/tests/gl_readback_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/command_buffer/tests/gl_manager.h" 5 #include "gpu/command_buffer/tests/gl_manager.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/at_exit.h" 15 #include "base/at_exit.h"
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/memory/ptr_util.h"
18 #include "base/memory/ref_counted_memory.h" 19 #include "base/memory/ref_counted_memory.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 21 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
21 #include "gpu/command_buffer/client/gles2_implementation.h" 22 #include "gpu/command_buffer/client/gles2_implementation.h"
22 #include "gpu/command_buffer/client/gles2_lib.h" 23 #include "gpu/command_buffer/client/gles2_lib.h"
23 #include "gpu/command_buffer/client/transfer_buffer.h" 24 #include "gpu/command_buffer/client/transfer_buffer.h"
24 #include "gpu/command_buffer/common/constants.h" 25 #include "gpu/command_buffer/common/constants.h"
25 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 26 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
26 #include "gpu/command_buffer/common/sync_token.h" 27 #include "gpu/command_buffer/common/sync_token.h"
27 #include "gpu/command_buffer/common/value_state.h" 28 #include "gpu/command_buffer/common/value_state.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 delete base_surface_; 209 delete base_surface_;
209 base_surface_ = NULL; 210 base_surface_ = NULL;
210 } 211 }
211 if (base_context_) { 212 if (base_context_) {
212 delete base_context_; 213 delete base_context_;
213 base_context_ = NULL; 214 base_context_ = NULL;
214 } 215 }
215 } 216 }
216 } 217 }
217 218
218 scoped_ptr<gfx::GpuMemoryBuffer> GLManager::CreateGpuMemoryBuffer( 219 std::unique_ptr<gfx::GpuMemoryBuffer> GLManager::CreateGpuMemoryBuffer(
219 const gfx::Size& size, 220 const gfx::Size& size,
220 gfx::BufferFormat format) { 221 gfx::BufferFormat format) {
221 #if defined(OS_MACOSX) 222 #if defined(OS_MACOSX)
222 if (use_iosurface_memory_buffers_) { 223 if (use_iosurface_memory_buffers_) {
223 return make_scoped_ptr<gfx::GpuMemoryBuffer>( 224 return base::WrapUnique<gfx::GpuMemoryBuffer>(
224 new IOSurfaceGpuMemoryBuffer(size, format)); 225 new IOSurfaceGpuMemoryBuffer(size, format));
225 } 226 }
226 #endif // defined(OS_MACOSX) 227 #endif // defined(OS_MACOSX)
227 std::vector<uint8_t> data(gfx::BufferSizeForBufferFormat(size, format), 0); 228 std::vector<uint8_t> data(gfx::BufferSizeForBufferFormat(size, format), 0);
228 scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data)); 229 scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data));
229 return make_scoped_ptr<gfx::GpuMemoryBuffer>( 230 return base::WrapUnique<gfx::GpuMemoryBuffer>(
230 new GpuMemoryBufferImpl(bytes.get(), size, format)); 231 new GpuMemoryBufferImpl(bytes.get(), size, format));
231 } 232 }
232 233
233 void GLManager::Initialize(const GLManager::Options& options) { 234 void GLManager::Initialize(const GLManager::Options& options) {
234 InitializeWithCommandLine(options, *base::CommandLine::ForCurrentProcess()); 235 InitializeWithCommandLine(options, *base::CommandLine::ForCurrentProcess());
235 } 236 }
236 237
237 void GLManager::InitializeWithCommandLine( 238 void GLManager::InitializeWithCommandLine(
238 const GLManager::Options& options, 239 const GLManager::Options& options,
239 const base::CommandLine& command_line) { 240 const base::CommandLine& command_line) {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 DCHECK(image_manager); 561 DCHECK(image_manager);
561 image_manager->AddImage(gl_image.get(), new_id); 562 image_manager->AddImage(gl_image.get(), new_id);
562 return new_id; 563 return new_id;
563 } 564 }
564 565
565 int32_t GLManager::CreateGpuMemoryBufferImage(size_t width, 566 int32_t GLManager::CreateGpuMemoryBufferImage(size_t width,
566 size_t height, 567 size_t height,
567 unsigned internalformat, 568 unsigned internalformat,
568 unsigned usage) { 569 unsigned usage) {
569 DCHECK_EQ(usage, static_cast<unsigned>(GL_READ_WRITE_CHROMIUM)); 570 DCHECK_EQ(usage, static_cast<unsigned>(GL_READ_WRITE_CHROMIUM));
570 scoped_ptr<gfx::GpuMemoryBuffer> buffer = CreateGpuMemoryBuffer( 571 std::unique_ptr<gfx::GpuMemoryBuffer> buffer = CreateGpuMemoryBuffer(
571 gfx::Size(width, height), gfx::BufferFormat::RGBA_8888); 572 gfx::Size(width, height), gfx::BufferFormat::RGBA_8888);
572 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); 573 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat);
573 } 574 }
574 575
575 void GLManager::DestroyImage(int32_t id) { 576 void GLManager::DestroyImage(int32_t id) {
576 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); 577 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
577 DCHECK(image_manager); 578 DCHECK(image_manager);
578 image_manager->RemoveImage(id); 579 image_manager->RemoveImage(id);
579 } 580 }
580 581
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 640
640 // Something went wrong, just run the callback now. 641 // Something went wrong, just run the callback now.
641 callback.Run(); 642 callback.Run();
642 } 643 }
643 644
644 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { 645 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) {
645 return false; 646 return false;
646 } 647 }
647 648
648 } // namespace gpu 649 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.h ('k') | gpu/command_buffer/tests/gl_readback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698