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

Unified Diff: device/bluetooth/bluez/bluetooth_audio_sink_bluez.cc

Issue 2317593002: dbus: No dbus::FileDescriptor in BluetoothMediaTransportClient (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluez/bluetooth_audio_sink_bluez.cc
diff --git a/device/bluetooth/bluez/bluetooth_audio_sink_bluez.cc b/device/bluetooth/bluez/bluetooth_audio_sink_bluez.cc
index 82ea548fd2f3e51fd9a2b08964f6b78bf5b28078..05323ec30c6400b8a82178c40affdce590d3af9c 100644
--- a/device/bluetooth/bluez/bluetooth_audio_sink_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_audio_sink_bluez.cc
@@ -26,7 +26,6 @@ namespace {
// TODO(mcchou): Add the constant to dbus/service_constants.h.
const char kBluetoothAudioSinkServicePath[] = "/org/chromium/AudioSink";
-const int kInvalidFd = -1;
const uint16_t kInvalidReadMtu = 0;
const uint16_t kInvalidWriteMtu = 0;
@@ -490,12 +489,10 @@ void BluetoothAudioSinkBlueZ::OnUnregisterFailed(
error_callback.Run(BluetoothAudioSink::ERROR_NOT_UNREGISTERED);
}
-void BluetoothAudioSinkBlueZ::OnAcquireSucceeded(dbus::FileDescriptor* fd,
+void BluetoothAudioSinkBlueZ::OnAcquireSucceeded(base::ScopedFD fd,
const uint16_t read_mtu,
const uint16_t write_mtu) {
- CHECK(fd);
- fd->CheckValidity();
- CHECK(fd->is_valid() && fd->value() != kInvalidFd);
+ CHECK(fd.is_valid());
CHECK_GT(read_mtu, kInvalidReadMtu);
CHECK_GT(write_mtu, kInvalidWriteMtu);
@@ -510,9 +507,9 @@ void BluetoothAudioSinkBlueZ::OnAcquireSucceeded(dbus::FileDescriptor* fd,
write_mtu_ = write_mtu;
// Avoids closing the same file descriptor caused by reassignment.
- if (!file_.get() || file_->GetPlatformFile() != fd->value()) {
+ if (!file_.get() || file_->GetPlatformFile() != fd.get()) {
// Takes ownership of the file descriptor.
- file_.reset(new base::File(fd->TakeValue()));
+ file_.reset(new base::File(fd.release()));
DCHECK(file_->IsValid());
VLOG(1) << "OnAcquireSucceeded - update file";
}
« no previous file with comments | « device/bluetooth/bluez/bluetooth_audio_sink_bluez.h ('k') | device/bluetooth/dbus/bluetooth_media_transport_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698