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

Side by Side Diff: media/audio/audio_output_controller.cc

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 years, 1 month 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
« no previous file with comments | « media/audio/audio_input_controller.cc ('k') | media/base/data_buffer_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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "media/audio/audio_output_controller.h" 5 #include "media/audio/audio_output_controller.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 8
9 // The following parameters limit the request buffer and packet size from the 9 // The following parameters limit the request buffer and packet size from the
10 // renderer to avoid renderer from requesting too much memory. 10 // renderer to avoid renderer from requesting too much memory.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 scoped_refptr<AudioOutputController> AudioOutputController::Create( 51 scoped_refptr<AudioOutputController> AudioOutputController::Create(
52 EventHandler* event_handler, 52 EventHandler* event_handler,
53 AudioParameters params, 53 AudioParameters params,
54 uint32 hardware_buffer_size, 54 uint32 hardware_buffer_size,
55 uint32 buffer_capacity) { 55 uint32 buffer_capacity) {
56 56
57 if (!CheckParameters(params, hardware_buffer_size)) 57 if (!CheckParameters(params, hardware_buffer_size))
58 return NULL; 58 return NULL;
59 59
60 // Starts the audio controller thread. 60 // Starts the audio controller thread.
61 scoped_refptr<AudioOutputController> controller = new AudioOutputController( 61 scoped_refptr<AudioOutputController> controller(new AudioOutputController(
62 event_handler, buffer_capacity, NULL); 62 event_handler, buffer_capacity, NULL));
63 63
64 controller->message_loop_ = 64 controller->message_loop_ =
65 AudioManager::GetAudioManager()->GetMessageLoop(); 65 AudioManager::GetAudioManager()->GetMessageLoop();
66 controller->message_loop_->PostTask( 66 controller->message_loop_->PostTask(
67 FROM_HERE, 67 FROM_HERE,
68 NewRunnableMethod(controller.get(), &AudioOutputController::DoCreate, 68 NewRunnableMethod(controller.get(), &AudioOutputController::DoCreate,
69 params, hardware_buffer_size)); 69 params, hardware_buffer_size));
70 return controller; 70 return controller;
71 } 71 }
72 72
73 // static 73 // static
74 scoped_refptr<AudioOutputController> AudioOutputController::CreateLowLatency( 74 scoped_refptr<AudioOutputController> AudioOutputController::CreateLowLatency(
75 EventHandler* event_handler, 75 EventHandler* event_handler,
76 AudioParameters params, 76 AudioParameters params,
77 uint32 hardware_buffer_size, 77 uint32 hardware_buffer_size,
78 SyncReader* sync_reader) { 78 SyncReader* sync_reader) {
79 79
80 DCHECK(sync_reader); 80 DCHECK(sync_reader);
81 81
82 if (!CheckParameters(params, hardware_buffer_size)) 82 if (!CheckParameters(params, hardware_buffer_size))
83 return NULL; 83 return NULL;
84 84
85 // Starts the audio controller thread. 85 // Starts the audio controller thread.
86 scoped_refptr<AudioOutputController> controller = new AudioOutputController( 86 scoped_refptr<AudioOutputController> controller(new AudioOutputController(
87 event_handler, 0, sync_reader); 87 event_handler, 0, sync_reader));
88 88
89 controller->message_loop_ = 89 controller->message_loop_ =
90 AudioManager::GetAudioManager()->GetMessageLoop(); 90 AudioManager::GetAudioManager()->GetMessageLoop();
91 controller->message_loop_->PostTask( 91 controller->message_loop_->PostTask(
92 FROM_HERE, 92 FROM_HERE,
93 NewRunnableMethod(controller.get(), &AudioOutputController::DoCreate, 93 NewRunnableMethod(controller.get(), &AudioOutputController::DoCreate,
94 params, hardware_buffer_size)); 94 params, hardware_buffer_size));
95 return controller; 95 return controller;
96 } 96 }
97 97
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 buffers_state.pending_bytes += buffer_.forward_bytes(); 329 buffers_state.pending_bytes += buffer_.forward_bytes();
330 330
331 // If we need more data then call the event handler to ask for more data. 331 // If we need more data then call the event handler to ask for more data.
332 // It is okay that we don't lock in this block because the parameters are 332 // It is okay that we don't lock in this block because the parameters are
333 // correct and in the worst case we are just asking more data than needed. 333 // correct and in the worst case we are just asking more data than needed.
334 AutoUnlock auto_unlock(lock_); 334 AutoUnlock auto_unlock(lock_);
335 handler_->OnMoreData(this, buffers_state); 335 handler_->OnMoreData(this, buffers_state);
336 } 336 }
337 337
338 } // namespace media 338 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_controller.cc ('k') | media/base/data_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698