OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "device/bluetooth/dbus/fake_bluetooth_device_client.h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_device_client.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 return; | 512 return; |
513 } | 513 } |
514 | 514 |
515 args |= O_NONBLOCK; | 515 args |= O_NONBLOCK; |
516 if (fcntl(fds[1], F_SETFL, args) < 0) { | 516 if (fcntl(fds[1], F_SETFL, args) < 0) { |
517 error_callback.Run(kNoResponseError, "failed to set socket non-blocking"); | 517 error_callback.Run(kNoResponseError, "failed to set socket non-blocking"); |
518 return; | 518 return; |
519 } | 519 } |
520 | 520 |
521 base::PostTaskWithTraits( | 521 base::PostTaskWithTraits( |
522 FROM_HERE, base::TaskTraits() | 522 FROM_HERE, |
523 .WithShutdownBehavior( | 523 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
524 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | |
525 .MayBlock(), | |
526 base::Bind(&SimulatedProfileSocket, fds[0])); | 524 base::Bind(&SimulatedProfileSocket, fds[0])); |
527 | 525 |
528 base::ScopedFD fd(fds[1]); | 526 base::ScopedFD fd(fds[1]); |
529 | 527 |
530 // Post the new connection to the service provider. | 528 // Post the new connection to the service provider. |
531 BluetoothProfileServiceProvider::Delegate::Options options; | 529 BluetoothProfileServiceProvider::Delegate::Options options; |
532 | 530 |
533 profile_service_provider->NewConnection( | 531 profile_service_provider->NewConnection( |
534 object_path, std::move(fd), options, | 532 object_path, std::move(fd), options, |
535 base::Bind(&FakeBluetoothDeviceClient::ConnectionCallback, | 533 base::Bind(&FakeBluetoothDeviceClient::ConnectionCallback, |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 properties->service_data.set_valid(true); | 1845 properties->service_data.set_valid(true); |
1848 } | 1846 } |
1849 | 1847 |
1850 properties_map_.insert(std::make_pair(device_path, std::move(properties))); | 1848 properties_map_.insert(std::make_pair(device_path, std::move(properties))); |
1851 device_list_.push_back(device_path); | 1849 device_list_.push_back(device_path); |
1852 for (auto& observer : observers_) | 1850 for (auto& observer : observers_) |
1853 observer.DeviceAdded(device_path); | 1851 observer.DeviceAdded(device_path); |
1854 } | 1852 } |
1855 | 1853 |
1856 } // namespace bluez | 1854 } // namespace bluez |
OLD | NEW |