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

Unified Diff: media/audio/audio_system_impl.cc

Issue 2828143006: AudioSystemImpl binding cleanup (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_system_impl.cc
diff --git a/media/audio/audio_system_impl.cc b/media/audio/audio_system_impl.cc
index 9d009aa5079c9d47b692ab38e13920e5ea12a85c..f45aaaca89239f05b5c53d366b45c010b0a37257 100644
--- a/media/audio/audio_system_impl.cc
+++ b/media/audio/audio_system_impl.cc
@@ -97,9 +97,10 @@ void AudioSystemImpl::GetInputStreamParameters(
const std::string& device_id,
OnAudioParamsCallback on_params_cb) const {
if (GetTaskRunner()->BelongsToCurrentThread()) {
- GetTaskRunner()->PostTask(
- FROM_HERE, base::Bind(on_params_cb, GetInputParametersOnDeviceThread(
- audio_manager_, device_id)));
+ GetTaskRunner()->PostTask(FROM_HERE,
+ base::BindOnce(std::move(on_params_cb),
+ GetInputParametersOnDeviceThread(
+ audio_manager_, device_id)));
return;
}
base::PostTaskAndReplyWithResult(
@@ -113,9 +114,10 @@ void AudioSystemImpl::GetOutputStreamParameters(
const std::string& device_id,
OnAudioParamsCallback on_params_cb) const {
if (GetTaskRunner()->BelongsToCurrentThread()) {
- GetTaskRunner()->PostTask(
- FROM_HERE, base::Bind(on_params_cb, GetOutputParametersOnDeviceThread(
- audio_manager_, device_id)));
+ GetTaskRunner()->PostTask(FROM_HERE,
+ base::BindOnce(std::move(on_params_cb),
+ GetOutputParametersOnDeviceThread(
+ audio_manager_, device_id)));
return;
}
base::PostTaskAndReplyWithResult(
@@ -128,8 +130,8 @@ void AudioSystemImpl::GetOutputStreamParameters(
void AudioSystemImpl::HasInputDevices(OnBoolCallback on_has_devices_cb) const {
if (GetTaskRunner()->BelongsToCurrentThread()) {
GetTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(on_has_devices_cb, audio_manager_->HasAudioInputDevices()));
+ FROM_HERE, base::BindOnce(std::move(on_has_devices_cb),
+ audio_manager_->HasAudioInputDevices()));
return;
}
base::PostTaskAndReplyWithResult(
@@ -142,8 +144,8 @@ void AudioSystemImpl::HasInputDevices(OnBoolCallback on_has_devices_cb) const {
void AudioSystemImpl::HasOutputDevices(OnBoolCallback on_has_devices_cb) const {
if (GetTaskRunner()->BelongsToCurrentThread()) {
GetTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(on_has_devices_cb, audio_manager_->HasAudioOutputDevices()));
+ FROM_HERE, base::BindOnce(std::move(on_has_devices_cb),
+ audio_manager_->HasAudioOutputDevices()));
return;
}
base::PostTaskAndReplyWithResult(
@@ -158,9 +160,10 @@ void AudioSystemImpl::GetDeviceDescriptions(
bool for_input) {
if (GetTaskRunner()->BelongsToCurrentThread()) {
GetTaskRunner()->PostTask(
- FROM_HERE, base::Bind(on_descriptions_cb,
- base::Passed(GetDeviceDescriptionsOnDeviceThread(
- audio_manager_, for_input))));
+ FROM_HERE,
+ base::BindOnce(std::move(on_descriptions_cb),
+ base::Passed(GetDeviceDescriptionsOnDeviceThread(
+ audio_manager_, for_input))));
return;
}
@@ -176,9 +179,9 @@ void AudioSystemImpl::GetAssociatedOutputDeviceID(
OnDeviceIdCallback on_device_id_cb) {
if (GetTaskRunner()->BelongsToCurrentThread()) {
GetTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(on_device_id_cb, audio_manager_->GetAssociatedOutputDeviceID(
- input_device_id)));
+ FROM_HERE, base::BindOnce(std::move(on_device_id_cb),
+ audio_manager_->GetAssociatedOutputDeviceID(
+ input_device_id)));
return;
}
base::PostTaskAndReplyWithResult(
@@ -196,12 +199,13 @@ void AudioSystemImpl::GetInputDeviceInfo(
// asynchronously, so we always post GetInputDeviceInfoOnDeviceThread(), which
// will syncronously call the (bound to current loop or not) callback.
GetTaskRunner()->PostTask(
- FROM_HERE, base::Bind(&GetInputDeviceInfoOnDeviceThread,
- base::Unretained(audio_manager_), input_device_id,
- GetTaskRunner()->BelongsToCurrentThread()
- ? std::move(on_input_device_info_cb)
- : media::BindToCurrentLoop(
- std::move(on_input_device_info_cb))));
+ FROM_HERE,
+ base::BindOnce(
+ &GetInputDeviceInfoOnDeviceThread, base::Unretained(audio_manager_),
+ input_device_id,
+ GetTaskRunner()->BelongsToCurrentThread()
+ ? std::move(on_input_device_info_cb)
+ : media::BindToCurrentLoop(std::move(on_input_device_info_cb))));
}
base::SingleThreadTaskRunner* AudioSystemImpl::GetTaskRunner() const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698