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

Side by Side Diff: gpu/command_buffer/client/gl_in_process_context.cc

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: convert newly added scoped_ptr's 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 (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/client/gl_in_process_context.h" 5 #include "gpu/command_buffer/client/gl_in_process_context.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
10 #include <set> 11 #include <set>
11 #include <utility> 12 #include <utility>
12 #include <vector> 13 #include <vector>
13 14
14 #include <GLES2/gl2.h> 15 #include <GLES2/gl2.h>
15 #ifndef GL_GLEXT_PROTOTYPES 16 #ifndef GL_GLEXT_PROTOTYPES
16 #define GL_GLEXT_PROTOTYPES 1 17 #define GL_GLEXT_PROTOTYPES 1
17 #endif 18 #endif
18 #include <GLES2/gl2ext.h> 19 #include <GLES2/gl2ext.h>
19 #include <GLES2/gl2extchromium.h> 20 #include <GLES2/gl2extchromium.h>
20 21
21 #include "base/bind.h" 22 #include "base/bind.h"
22 #include "base/bind_helpers.h" 23 #include "base/bind_helpers.h"
23 #include "base/lazy_instance.h" 24 #include "base/lazy_instance.h"
24 #include "base/logging.h" 25 #include "base/logging.h"
25 #include "base/macros.h" 26 #include "base/macros.h"
26 #include "base/memory/scoped_ptr.h"
27 #include "base/memory/weak_ptr.h" 27 #include "base/memory/weak_ptr.h"
28 #include "base/message_loop/message_loop.h" 28 #include "base/message_loop/message_loop.h"
29 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 29 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
30 #include "gpu/command_buffer/client/gles2_implementation.h" 30 #include "gpu/command_buffer/client/gles2_implementation.h"
31 #include "gpu/command_buffer/client/transfer_buffer.h" 31 #include "gpu/command_buffer/client/transfer_buffer.h"
32 #include "gpu/command_buffer/common/command_buffer.h" 32 #include "gpu/command_buffer/common/command_buffer.h"
33 #include "gpu/command_buffer/common/constants.h" 33 #include "gpu/command_buffer/common/constants.h"
34 #include "ui/gfx/geometry/size.h" 34 #include "ui/gfx/geometry/size.h"
35 #include "ui/gl/gl_image.h" 35 #include "ui/gl/gl_image.h"
36 36
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #if defined(OS_ANDROID) 74 #if defined(OS_ANDROID)
75 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( 75 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(
76 uint32_t stream_id) override; 76 uint32_t stream_id) override;
77 uint32_t CreateStreamTexture(uint32_t texture_id) override; 77 uint32_t CreateStreamTexture(uint32_t texture_id) override;
78 #endif 78 #endif
79 79
80 private: 80 private:
81 void Destroy(); 81 void Destroy();
82 void OnSignalSyncPoint(const base::Closure& callback); 82 void OnSignalSyncPoint(const base::Closure& callback);
83 83
84 scoped_ptr<gles2::GLES2CmdHelper> gles2_helper_; 84 std::unique_ptr<gles2::GLES2CmdHelper> gles2_helper_;
85 scoped_ptr<TransferBuffer> transfer_buffer_; 85 std::unique_ptr<TransferBuffer> transfer_buffer_;
86 scoped_ptr<gles2::GLES2Implementation> gles2_implementation_; 86 std::unique_ptr<gles2::GLES2Implementation> gles2_implementation_;
87 scoped_ptr<InProcessCommandBuffer> command_buffer_; 87 std::unique_ptr<InProcessCommandBuffer> command_buffer_;
88 88
89 const GLInProcessContextSharedMemoryLimits mem_limits_; 89 const GLInProcessContextSharedMemoryLimits mem_limits_;
90 90
91 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl); 91 DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl);
92 }; 92 };
93 93
94 GLInProcessContextImpl::GLInProcessContextImpl( 94 GLInProcessContextImpl::GLInProcessContextImpl(
95 const GLInProcessContextSharedMemoryLimits& mem_limits) 95 const GLInProcessContextSharedMemoryLimits& mem_limits)
96 : mem_limits_(mem_limits) {} 96 : mem_limits_(mem_limits) {}
97 97
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 gfx::GpuPreference gpu_preference, 240 gfx::GpuPreference gpu_preference,
241 const GLInProcessContextSharedMemoryLimits& memory_limits, 241 const GLInProcessContextSharedMemoryLimits& memory_limits,
242 GpuMemoryBufferManager* gpu_memory_buffer_manager, 242 GpuMemoryBufferManager* gpu_memory_buffer_manager,
243 ImageFactory* image_factory) { 243 ImageFactory* image_factory) {
244 if (surface.get()) { 244 if (surface.get()) {
245 DCHECK_EQ(surface->IsOffscreen(), is_offscreen); 245 DCHECK_EQ(surface->IsOffscreen(), is_offscreen);
246 DCHECK(surface->GetSize() == size); 246 DCHECK(surface->GetSize() == size);
247 DCHECK_EQ(gfx::kNullAcceleratedWidget, window); 247 DCHECK_EQ(gfx::kNullAcceleratedWidget, window);
248 } 248 }
249 249
250 scoped_ptr<GLInProcessContextImpl> context( 250 std::unique_ptr<GLInProcessContextImpl> context(
251 new GLInProcessContextImpl(memory_limits)); 251 new GLInProcessContextImpl(memory_limits));
252 if (!context->Initialize(surface, 252 if (!context->Initialize(surface,
253 is_offscreen, 253 is_offscreen,
254 share_context, 254 share_context,
255 window, 255 window,
256 size, 256 size,
257 attribs, 257 attribs,
258 gpu_preference, 258 gpu_preference,
259 service, 259 service,
260 gpu_memory_buffer_manager, 260 gpu_memory_buffer_manager,
261 image_factory)) 261 image_factory))
262 return NULL; 262 return NULL;
263 263
264 return context.release(); 264 return context.release();
265 } 265 }
266 266
267 } // namespace gpu 267 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698