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

Side by Side Diff: gpu/command_buffer/service/buffer_manager.h

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
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 #ifndef GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/containers/hash_tables.h" 15 #include "base/containers/hash_tables.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
18 #include "base/memory/scoped_ptr.h"
19 #include "gpu/command_buffer/common/buffer.h" 19 #include "gpu/command_buffer/common/buffer.h"
20 #include "gpu/command_buffer/service/gl_utils.h" 20 #include "gpu/command_buffer/service/gl_utils.h"
21 #include "gpu/command_buffer/service/memory_tracking.h" 21 #include "gpu/command_buffer/service/memory_tracking.h"
22 #include "gpu/gpu_export.h" 22 #include "gpu/gpu_export.h"
23 23
24 namespace gpu { 24 namespace gpu {
25 namespace gles2 { 25 namespace gles2 {
26 26
27 class BufferManager; 27 class BufferManager;
28 struct ContextState; 28 struct ContextState;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 GLuint service_id_; 198 GLuint service_id_;
199 199
200 // The first target of buffer. 0 = unset. 200 // The first target of buffer. 0 = unset.
201 // It is set the first time bindBuffer() is called and cannot be changed. 201 // It is set the first time bindBuffer() is called and cannot be changed.
202 GLenum initial_target_; 202 GLenum initial_target_;
203 203
204 // Usage of buffer. 204 // Usage of buffer.
205 GLenum usage_; 205 GLenum usage_;
206 206
207 // Data cached from last glMapBufferRange call. 207 // Data cached from last glMapBufferRange call.
208 scoped_ptr<MappedRange> mapped_range_; 208 std::unique_ptr<MappedRange> mapped_range_;
209 209
210 // A map of ranges to the highest value in that range of a certain type. 210 // A map of ranges to the highest value in that range of a certain type.
211 typedef std::map<Range, GLuint, Range::Less> RangeToMaxValueMap; 211 typedef std::map<Range, GLuint, Range::Less> RangeToMaxValueMap;
212 RangeToMaxValueMap range_set_; 212 RangeToMaxValueMap range_set_;
213 }; 213 };
214 214
215 // This class keeps track of the buffers and their sizes so we can do 215 // This class keeps track of the buffers and their sizes so we can do
216 // bounds checking. 216 // bounds checking.
217 // 217 //
218 // NOTE: To support shared resources an instance of this class will need to be 218 // NOTE: To support shared resources an instance of this class will need to be
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 bool UseShadowBuffer(GLenum target, GLenum usage); 321 bool UseShadowBuffer(GLenum target, GLenum usage);
322 322
323 // Sets the size, usage and initial data of a buffer. 323 // Sets the size, usage and initial data of a buffer.
324 // If data is NULL buffer will be initialized to 0 if shadowed. 324 // If data is NULL buffer will be initialized to 0 if shadowed.
325 void SetInfo(Buffer* buffer, 325 void SetInfo(Buffer* buffer,
326 GLenum target, 326 GLenum target,
327 GLsizeiptr size, 327 GLsizeiptr size,
328 GLenum usage, 328 GLenum usage,
329 bool use_shadow); 329 bool use_shadow);
330 330
331 scoped_ptr<MemoryTypeTracker> memory_type_tracker_; 331 std::unique_ptr<MemoryTypeTracker> memory_type_tracker_;
332 MemoryTracker* memory_tracker_; 332 MemoryTracker* memory_tracker_;
333 scoped_refptr<FeatureInfo> feature_info_; 333 scoped_refptr<FeatureInfo> feature_info_;
334 334
335 // Info for each buffer in the system. 335 // Info for each buffer in the system.
336 typedef base::hash_map<GLuint, scoped_refptr<Buffer> > BufferMap; 336 typedef base::hash_map<GLuint, scoped_refptr<Buffer> > BufferMap;
337 BufferMap buffers_; 337 BufferMap buffers_;
338 338
339 // Whether or not buffers can be bound to multiple targets. 339 // Whether or not buffers can be bound to multiple targets.
340 bool allow_buffers_on_multiple_targets_; 340 bool allow_buffers_on_multiple_targets_;
341 341
342 // Whether or not allow using GL_FIXED type for vertex attribs. 342 // Whether or not allow using GL_FIXED type for vertex attribs.
343 bool allow_fixed_attribs_; 343 bool allow_fixed_attribs_;
344 344
345 // Counts the number of Buffer allocated with 'this' as its manager. 345 // Counts the number of Buffer allocated with 'this' as its manager.
346 // Allows to check no Buffer will outlive this. 346 // Allows to check no Buffer will outlive this.
347 unsigned int buffer_count_; 347 unsigned int buffer_count_;
348 348
349 GLuint primitive_restart_fixed_index_; 349 GLuint primitive_restart_fixed_index_;
350 350
351 bool have_context_; 351 bool have_context_;
352 bool use_client_side_arrays_for_stream_buffers_; 352 bool use_client_side_arrays_for_stream_buffers_;
353 353
354 DISALLOW_COPY_AND_ASSIGN(BufferManager); 354 DISALLOW_COPY_AND_ASSIGN(BufferManager);
355 }; 355 };
356 356
357 } // namespace gles2 357 } // namespace gles2
358 } // namespace gpu 358 } // namespace gpu
359 359
360 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ 360 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/command_buffer_shared_test.cc ('k') | gpu/command_buffer/service/buffer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698