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

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

Issue 542863004: Site Isolation: RenderView-->RenderFrame for WebContentsVideoCaptureDevice and WebContentsAudioInpu… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment/naming, per review suggestions. Created 6 years, 3 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 #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/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 this, 373 this,
374 stream_id, 374 stream_id,
375 render_view_id, 375 render_view_id,
376 render_frame_id, 376 render_frame_id,
377 params, 377 params,
378 output_device_id, 378 output_device_id,
379 shared_memory.Pass(), 379 shared_memory.Pass(),
380 reader.PassAs<media::AudioOutputController::SyncReader>())); 380 reader.PassAs<media::AudioOutputController::SyncReader>()));
381 if (mirroring_manager_) { 381 if (mirroring_manager_) {
382 mirroring_manager_->AddDiverter( 382 mirroring_manager_->AddDiverter(
383 render_process_id_, entry->render_view_id(), entry->controller()); 383 render_process_id_, entry->render_frame_id(), entry->controller());
384 } 384 }
385 audio_entries_.insert(std::make_pair(stream_id, entry.release())); 385 audio_entries_.insert(std::make_pair(stream_id, entry.release()));
386 audio_log_->OnCreated(stream_id, params, output_device_id); 386 audio_log_->OnCreated(stream_id, params, output_device_id);
387 } 387 }
388 388
389 void AudioRendererHost::OnPlayStream(int stream_id) { 389 void AudioRendererHost::OnPlayStream(int stream_id) {
390 DCHECK_CURRENTLY_ON(BrowserThread::IO); 390 DCHECK_CURRENTLY_ON(BrowserThread::IO);
391 391
392 AudioEntry* entry = LookupById(stream_id); 392 AudioEntry* entry = LookupById(stream_id);
393 if (!entry) { 393 if (!entry) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 438
439 // Prevent oustanding callbacks from attempting to close/delete the same 439 // Prevent oustanding callbacks from attempting to close/delete the same
440 // AudioEntry twice. 440 // AudioEntry twice.
441 AudioEntryMap::iterator i = audio_entries_.find(stream_id); 441 AudioEntryMap::iterator i = audio_entries_.find(stream_id);
442 if (i == audio_entries_.end()) 442 if (i == audio_entries_.end())
443 return; 443 return;
444 scoped_ptr<AudioEntry> entry(i->second); 444 scoped_ptr<AudioEntry> entry(i->second);
445 audio_entries_.erase(i); 445 audio_entries_.erase(i);
446 446
447 media::AudioOutputController* const controller = entry->controller(); 447 media::AudioOutputController* const controller = entry->controller();
448 if (mirroring_manager_) { 448 if (mirroring_manager_)
449 mirroring_manager_->RemoveDiverter( 449 mirroring_manager_->RemoveDiverter(controller);
450 render_process_id_, entry->render_view_id(), controller);
451 }
452 controller->Close( 450 controller->Close(
453 base::Bind(&AudioRendererHost::DeleteEntry, this, base::Passed(&entry))); 451 base::Bind(&AudioRendererHost::DeleteEntry, this, base::Passed(&entry)));
454 audio_log_->OnClosed(stream_id); 452 audio_log_->OnClosed(stream_id);
455 } 453 }
456 454
457 void AudioRendererHost::DeleteEntry(scoped_ptr<AudioEntry> entry) { 455 void AudioRendererHost::DeleteEntry(scoped_ptr<AudioEntry> entry) {
458 DCHECK_CURRENTLY_ON(BrowserThread::IO); 456 DCHECK_CURRENTLY_ON(BrowserThread::IO);
459 457
460 // At this point, make the final "say" in audio playback state. 458 // At this point, make the final "say" in audio playback state.
461 MediaObserver* const media_observer = 459 MediaObserver* const media_observer =
(...skipping 27 matching lines...) Expand all
489 487
490 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); 488 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id);
491 return i != audio_entries_.end() ? i->second : NULL; 489 return i != audio_entries_.end() ? i->second : NULL;
492 } 490 }
493 491
494 bool AudioRendererHost::HasActiveAudio() { 492 bool AudioRendererHost::HasActiveAudio() {
495 return !base::AtomicRefCountIsZero(&num_playing_streams_); 493 return !base::AtomicRefCountIsZero(&num_playing_streams_);
496 } 494 }
497 495
498 } // namespace content 496 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698