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

Side by Side Diff: ppapi/proxy/audio_encoder_resource.cc

Issue 2254973004: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | ppapi/proxy/flash_font_file_resource.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 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 "ppapi/proxy/audio_encoder_resource.h" 5 #include "ppapi/proxy/audio_encoder_resource.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "ppapi/c/pp_array_output.h" 9 #include "ppapi/c/pp_array_output.h"
10 #include "ppapi/c/pp_codecs.h" 10 #include "ppapi/c/pp_codecs.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (error) { 225 if (error) {
226 RunCallback(&initialize_callback_, error); 226 RunCallback(&initialize_callback_, error);
227 return; 227 return;
228 } 228 }
229 229
230 // Get audio buffers shared memory buffer. 230 // Get audio buffers shared memory buffer.
231 base::SharedMemoryHandle buffer_handle; 231 base::SharedMemoryHandle buffer_handle;
232 if (!params.TakeSharedMemoryHandleAtIndex(0, &buffer_handle) || 232 if (!params.TakeSharedMemoryHandleAtIndex(0, &buffer_handle) ||
233 !audio_buffer_manager_.SetBuffers( 233 !audio_buffer_manager_.SetBuffers(
234 audio_buffer_count, audio_buffer_size, 234 audio_buffer_count, audio_buffer_size,
235 base::WrapUnique(new base::SharedMemory(buffer_handle, false)), 235 base::MakeUnique<base::SharedMemory>(buffer_handle, false), true)) {
236 true)) {
237 RunCallback(&initialize_callback_, PP_ERROR_NOMEMORY); 236 RunCallback(&initialize_callback_, PP_ERROR_NOMEMORY);
238 return; 237 return;
239 } 238 }
240 239
241 // Get bitstream buffers shared memory buffer. 240 // Get bitstream buffers shared memory buffer.
242 if (!params.TakeSharedMemoryHandleAtIndex(1, &buffer_handle) || 241 if (!params.TakeSharedMemoryHandleAtIndex(1, &buffer_handle) ||
243 !bitstream_buffer_manager_.SetBuffers( 242 !bitstream_buffer_manager_.SetBuffers(
244 bitstream_buffer_count, bitstream_buffer_size, 243 bitstream_buffer_count, bitstream_buffer_size,
245 base::WrapUnique(new base::SharedMemory(buffer_handle, false)), 244 base::MakeUnique<base::SharedMemory>(buffer_handle, false), false)) {
246 false)) {
247 RunCallback(&initialize_callback_, PP_ERROR_NOMEMORY); 245 RunCallback(&initialize_callback_, PP_ERROR_NOMEMORY);
248 return; 246 return;
249 } 247 }
250 248
251 for (int32_t i = 0; i < bitstream_buffer_manager_.number_of_buffers(); i++) 249 for (int32_t i = 0; i < bitstream_buffer_manager_.number_of_buffers(); i++)
252 bitstream_buffer_map_.insert(std::make_pair( 250 bitstream_buffer_map_.insert(std::make_pair(
253 bitstream_buffer_manager_.GetBufferPointer(i)->bitstream.data, i)); 251 bitstream_buffer_manager_.GetBufferPointer(i)->bitstream.data, i));
254 252
255 encoder_last_error_ = PP_OK; 253 encoder_last_error_ = PP_OK;
256 number_of_samples_ = number_of_samples; 254 number_of_samples_ = number_of_samples;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 349
352 void AudioEncoderResource::ReleaseBuffers() { 350 void AudioEncoderResource::ReleaseBuffers() {
353 for (AudioBufferMap::iterator it = audio_buffers_.begin(); 351 for (AudioBufferMap::iterator it = audio_buffers_.begin();
354 it != audio_buffers_.end(); ++it) 352 it != audio_buffers_.end(); ++it)
355 it->second->Invalidate(); 353 it->second->Invalidate();
356 audio_buffers_.clear(); 354 audio_buffers_.clear();
357 } 355 }
358 356
359 } // namespace proxy 357 } // namespace proxy
360 } // namespace ppapi 358 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/flash_font_file_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698