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

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

Issue 13454036: Rewrite scoped_array<T> to scoped_ptr<T[]> in gpu/, Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yikes Created 7 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 | Annotate | Revision Log
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/service/buffer_manager.h" 5 #include "gpu/command_buffer/service/buffer_manager.h"
6 #include <limits> 6 #include <limits>
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
10 #include "gpu/command_buffer/service/feature_info.h" 10 #include "gpu/command_buffer/service/feature_info.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 memory_tracker_->TrackMemAlloc(buffer->size()); 252 memory_tracker_->TrackMemAlloc(buffer->size());
253 } 253 }
254 254
255 void BufferManager::DoBufferData( 255 void BufferManager::DoBufferData(
256 GLES2Decoder* decoder, 256 GLES2Decoder* decoder,
257 Buffer* buffer, 257 Buffer* buffer,
258 GLsizeiptr size, 258 GLsizeiptr size,
259 GLenum usage, 259 GLenum usage,
260 const GLvoid* data) { 260 const GLvoid* data) {
261 // Clear the buffer to 0 if no initial data was passed in. 261 // Clear the buffer to 0 if no initial data was passed in.
262 scoped_array<int8> zero; 262 scoped_ptr<int8[]> zero;
263 if (!data) { 263 if (!data) {
264 zero.reset(new int8[size]); 264 zero.reset(new int8[size]);
265 memset(zero.get(), 0, size); 265 memset(zero.get(), 0, size);
266 data = zero.get(); 266 data = zero.get();
267 } 267 }
268 268
269 GLESDECODER_COPY_REAL_GL_ERRORS_TO_WRAPPER(decoder, "glBufferData"); 269 GLESDECODER_COPY_REAL_GL_ERRORS_TO_WRAPPER(decoder, "glBufferData");
270 if (IsUsageClientSideArray(usage)) { 270 if (IsUsageClientSideArray(usage)) {
271 glBufferData(buffer->target(), 0, NULL, usage); 271 glBufferData(buffer->target(), 0, NULL, usage);
272 } else { 272 } else {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if (buffer->target() == 0) { 306 if (buffer->target() == 0) {
307 buffer->set_target(target); 307 buffer->set_target(target);
308 } 308 }
309 return true; 309 return true;
310 } 310 }
311 311
312 } // namespace gles2 312 } // namespace gles2
313 } // namespace gpu 313 } // namespace gpu
314 314
315 315
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/buffer_manager.h ('k') | gpu/command_buffer/service/buffer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698