Commit 8d85f412 authored by Jan Wilken Doerrie's avatar Jan Wilken Doerrie Committed by Commit Bot

[bluetooth] CleanUp BluetoothDeviceWin Interface

This change removes the unused NetLog and NetLogSource from
BluetoothDeviceWin and adds a few missing #includes.

Bug: 821766
Change-Id: I74e0f888398ced801072f25e8d90a8e338dc8e79
Reviewed-on: https://chromium-review.googlesource.com/968513
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarConley Owens <cco3@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544152}
parent de80f430
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "device/bluetooth/bluetooth_socket_win.h" #include "device/bluetooth/bluetooth_socket_win.h"
#include "device/bluetooth/bluetooth_task_manager_win.h" #include "device/bluetooth/bluetooth_task_manager_win.h"
#include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/bluetooth_uuid.h"
#include "net/log/net_log_source.h"
namespace device { namespace device {
...@@ -261,12 +260,12 @@ void BluetoothAdapterWin::DevicesPolled( ...@@ -261,12 +260,12 @@ void BluetoothAdapterWin::DevicesPolled(
base::STLSetIntersection<DeviceAddressSet>(known_devices, new_devices); base::STLSetIntersection<DeviceAddressSet>(known_devices, new_devices);
for (const auto& device_state : devices) { for (const auto& device_state : devices) {
if (added_devices.find(device_state->address) != added_devices.end()) { if (added_devices.find(device_state->address) != added_devices.end()) {
BluetoothDeviceWin* device_win = auto device_win = std::make_unique<BluetoothDeviceWin>(
new BluetoothDeviceWin(this, *device_state, ui_task_runner_, this, *device_state, ui_task_runner_, socket_thread_);
socket_thread_, NULL, net::NetLogSource()); BluetoothDeviceWin* device_win_raw = device_win.get();
devices_[device_state->address] = base::WrapUnique(device_win); devices_[device_state->address] = std::move(device_win);
for (auto& observer : observers_) for (auto& observer : observers_)
observer.DeviceAdded(this, device_win); observer.DeviceAdded(this, device_win_raw);
} else if (changed_devices.find(device_state->address) != } else if (changed_devices.find(device_state->address) !=
changed_devices.end()) { changed_devices.end()) {
auto iter = devices_.find(device_state->address); auto iter = devices_.find(device_state->address);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "device/bluetooth/bluetooth_device_win.h" #include "device/bluetooth/bluetooth_device_win.h"
#include <string> #include <string>
#include <unordered_map>
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
...@@ -29,15 +30,11 @@ namespace device { ...@@ -29,15 +30,11 @@ namespace device {
BluetoothDeviceWin::BluetoothDeviceWin( BluetoothDeviceWin::BluetoothDeviceWin(
BluetoothAdapterWin* adapter, BluetoothAdapterWin* adapter,
const BluetoothTaskManagerWin::DeviceState& device_state, const BluetoothTaskManagerWin::DeviceState& device_state,
const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
const scoped_refptr<BluetoothSocketThread>& socket_thread, scoped_refptr<BluetoothSocketThread> socket_thread)
net::NetLog* net_log,
const net::NetLogSource& net_log_source)
: BluetoothDevice(adapter), : BluetoothDevice(adapter),
ui_task_runner_(ui_task_runner), ui_task_runner_(std::move(ui_task_runner)),
socket_thread_(socket_thread), socket_thread_(std::move(socket_thread)) {
net_log_(net_log),
net_log_source_(net_log_source) {
Update(device_state); Update(device_state);
} }
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
#include <stdint.h> #include <stdint.h>
#include <memory> #include <memory>
#include <set>
#include <string> #include <string>
#include <utility>
#include <vector> #include <vector>
#include "base/macros.h" #include "base/macros.h"
...@@ -16,11 +18,6 @@ ...@@ -16,11 +18,6 @@
#include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h" #include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_task_manager_win.h" #include "device/bluetooth/bluetooth_task_manager_win.h"
#include "net/log/net_log_source.h"
namespace net {
class NetLog;
}
namespace device { namespace device {
...@@ -36,10 +33,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin ...@@ -36,10 +33,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin
explicit BluetoothDeviceWin( explicit BluetoothDeviceWin(
BluetoothAdapterWin* adapter, BluetoothAdapterWin* adapter,
const BluetoothTaskManagerWin::DeviceState& device_state, const BluetoothTaskManagerWin::DeviceState& device_state,
const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
const scoped_refptr<BluetoothSocketThread>& socket_thread, scoped_refptr<BluetoothSocketThread> socket_thread);
net::NetLog* net_log,
const net::NetLogSource& net_log_source);
~BluetoothDeviceWin() override; ~BluetoothDeviceWin() override;
// BluetoothDevice override // BluetoothDevice override
...@@ -139,8 +134,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin ...@@ -139,8 +134,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
scoped_refptr<BluetoothSocketThread> socket_thread_; scoped_refptr<BluetoothSocketThread> socket_thread_;
net::NetLog* net_log_;
net::NetLogSource net_log_source_;
// The Bluetooth class of the device, a bitmask that may be decoded using // The Bluetooth class of the device, a bitmask that may be decoded using
// https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
......
...@@ -66,17 +66,15 @@ class BluetoothDeviceWinTest : public testing::Test { ...@@ -66,17 +66,15 @@ class BluetoothDeviceWinTest : public testing::Test {
base::HexStringToBytes(kTestVideoSdpBytes, &video_state->sdp_bytes); base::HexStringToBytes(kTestVideoSdpBytes, &video_state->sdp_bytes);
device_state_->service_record_states.push_back(std::move(video_state)); device_state_->service_record_states.push_back(std::move(video_state));
device_.reset(new BluetoothDeviceWin(NULL, *device_state_, ui_task_runner, device_.reset(new BluetoothDeviceWin(nullptr, *device_state_,
socket_thread, NULL, ui_task_runner, socket_thread));
net::NetLogSource()));
// Add empty device. // Add empty device.
empty_device_state_.reset(new BluetoothTaskManagerWin::DeviceState()); empty_device_state_.reset(new BluetoothTaskManagerWin::DeviceState());
empty_device_state_->name = std::string(kDeviceName); empty_device_state_->name = std::string(kDeviceName);
empty_device_state_->address = kDeviceAddress; empty_device_state_->address = kDeviceAddress;
empty_device_.reset(new BluetoothDeviceWin(NULL, *empty_device_state_, empty_device_.reset(new BluetoothDeviceWin(nullptr, *empty_device_state_,
ui_task_runner, socket_thread, ui_task_runner, socket_thread));
NULL, net::NetLogSource()));
} }
protected: protected:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment