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

Side by Side Diff: content/browser/renderer_host/media/audio_renderer_host.cc

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 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
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 "content/browser/renderer_host/media/audio_renderer_host.h" 5 #include "content/browser/renderer_host/media/audio_renderer_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 SendErrorMessage(stream_id); 261 SendErrorMessage(stream_id);
262 return; 262 return;
263 } 263 }
264 264
265 // If we have successfully created the SyncReader then assign it to the 265 // If we have successfully created the SyncReader then assign it to the
266 // entry and construct an AudioOutputController. 266 // entry and construct an AudioOutputController.
267 entry->reader.reset(reader.release()); 267 entry->reader.reset(reader.release());
268 entry->controller = media::AudioOutputController::Create( 268 entry->controller = media::AudioOutputController::Create(
269 audio_manager_, this, audio_params, entry->reader.get()); 269 audio_manager_, this, audio_params, entry->reader.get());
270 270
271 if (!entry->controller) { 271 if (!entry->controller.get()) {
272 SendErrorMessage(stream_id); 272 SendErrorMessage(stream_id);
273 return; 273 return;
274 } 274 }
275 275
276 // If we have created the controller successfully, create an entry and add it 276 // If we have created the controller successfully, create an entry and add it
277 // to the map. 277 // to the map.
278 entry->stream_id = stream_id; 278 entry->stream_id = stream_id;
279 audio_entries_.insert(std::make_pair(stream_id, entry.release())); 279 audio_entries_.insert(std::make_pair(stream_id, entry.release()));
280 if (media_observer_) 280 if (media_observer_)
281 media_observer_->OnSetAudioStreamStatus(this, stream_id, "created"); 281 media_observer_->OnSetAudioStreamStatus(this, stream_id, "created");
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 void AudioRendererHost::SendErrorMessage(int32 stream_id) { 355 void AudioRendererHost::SendErrorMessage(int32 stream_id) {
356 Send(new AudioMsg_NotifyStreamStateChanged( 356 Send(new AudioMsg_NotifyStreamStateChanged(
357 stream_id, media::AudioOutputIPCDelegate::kError)); 357 stream_id, media::AudioOutputIPCDelegate::kError));
358 } 358 }
359 359
360 void AudioRendererHost::DeleteEntries() { 360 void AudioRendererHost::DeleteEntries() {
361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
362 362
363 for (AudioEntryMap::iterator i = audio_entries_.begin(); 363 for (AudioEntryMap::iterator i = audio_entries_.begin();
364 i != audio_entries_.end(); ++i) { 364 i != audio_entries_.end(); ++i) {
365 CloseAndDeleteStream(i->second); 365 CloseAndDeleteStream(i->second);
366 } 366 }
367 } 367 }
368 368
369 void AudioRendererHost::CloseAndDeleteStream(AudioEntry* entry) { 369 void AudioRendererHost::CloseAndDeleteStream(AudioEntry* entry) {
370 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 370 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
371 371
372 if (!entry->pending_close) { 372 if (!entry->pending_close) {
373 entry->controller->Close( 373 entry->controller->Close(
374 base::Bind(&AudioRendererHost::DeleteEntry, this, entry)); 374 base::Bind(&AudioRendererHost::DeleteEntry, this, entry));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 return NULL; 411 return NULL;
412 } 412 }
413 413
414 AudioRendererHost::AudioEntry* AudioRendererHost::LookupByController( 414 AudioRendererHost::AudioEntry* AudioRendererHost::LookupByController(
415 media::AudioOutputController* controller) { 415 media::AudioOutputController* controller) {
416 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 416 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
417 417
418 // Iterate the map of entries. 418 // Iterate the map of entries.
419 // TODO(hclam): Implement a faster look up method. 419 // TODO(hclam): Implement a faster look up method.
420 for (AudioEntryMap::iterator i = audio_entries_.begin(); 420 for (AudioEntryMap::iterator i = audio_entries_.begin();
421 i != audio_entries_.end(); ++i) { 421 i != audio_entries_.end(); ++i) {
422 if (!i->second->pending_close && controller == i->second->controller.get()) 422 if (!i->second->pending_close && controller == i->second->controller.get())
423 return i->second; 423 return i->second;
424 } 424 }
425 return NULL; 425 return NULL;
426 } 426 }
427 427
428 media::AudioOutputController* AudioRendererHost::LookupControllerByIdForTesting( 428 media::AudioOutputController* AudioRendererHost::LookupControllerByIdForTesting(
429 int stream_id) { 429 int stream_id) {
430 AudioEntry* const entry = LookupById(stream_id); 430 AudioEntry* const entry = LookupById(stream_id);
431 return entry ? entry->controller : NULL; 431 return .get()
432 return entry ? entry->controller : NULL;
432 } 433 }
433 434
434 } // namespace content 435 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698