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 @@
#include "device/bluetooth/bluetooth_socket_win.h"
#include "device/bluetooth/bluetooth_task_manager_win.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "net/log/net_log_source.h"
namespace device {
......@@ -261,12 +260,12 @@ void BluetoothAdapterWin::DevicesPolled(
base::STLSetIntersection<DeviceAddressSet>(known_devices, new_devices);
for (const auto& device_state : devices) {
if (added_devices.find(device_state->address) != added_devices.end()) {
BluetoothDeviceWin* device_win =
new BluetoothDeviceWin(this, *device_state, ui_task_runner_,
socket_thread_, NULL, net::NetLogSource());
devices_[device_state->address] = base::WrapUnique(device_win);
auto device_win = std::make_unique<BluetoothDeviceWin>(
this, *device_state, ui_task_runner_, socket_thread_);
BluetoothDeviceWin* device_win_raw = device_win.get();
devices_[device_state->address] = std::move(device_win);
for (auto& observer : observers_)
observer.DeviceAdded(this, device_win);
observer.DeviceAdded(this, device_win_raw);
} else if (changed_devices.find(device_state->address) !=
changed_devices.end()) {
auto iter = devices_.find(device_state->address);
......
......@@ -5,6 +5,7 @@
#include "device/bluetooth/bluetooth_device_win.h"
#include <string>
#include <unordered_map>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
......@@ -29,15 +30,11 @@ namespace device {
BluetoothDeviceWin::BluetoothDeviceWin(
BluetoothAdapterWin* adapter,
const BluetoothTaskManagerWin::DeviceState& device_state,
const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
const scoped_refptr<BluetoothSocketThread>& socket_thread,
net::NetLog* net_log,
const net::NetLogSource& net_log_source)
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<BluetoothSocketThread> socket_thread)
: BluetoothDevice(adapter),
ui_task_runner_(ui_task_runner),
socket_thread_(socket_thread),
net_log_(net_log),
net_log_source_(net_log_source) {
ui_task_runner_(std::move(ui_task_runner)),
socket_thread_(std::move(socket_thread)) {
Update(device_state);
}
......
......@@ -8,7 +8,9 @@
#include <stdint.h>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/macros.h"
......@@ -16,11 +18,6 @@
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_task_manager_win.h"
#include "net/log/net_log_source.h"
namespace net {
class NetLog;
}
namespace device {
......@@ -36,10 +33,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin
explicit BluetoothDeviceWin(
BluetoothAdapterWin* adapter,
const BluetoothTaskManagerWin::DeviceState& device_state,
const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
const scoped_refptr<BluetoothSocketThread>& socket_thread,
net::NetLog* net_log,
const net::NetLogSource& net_log_source);
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<BluetoothSocketThread> socket_thread);
~BluetoothDeviceWin() override;
// BluetoothDevice override
......@@ -139,8 +134,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
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
// https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
......
......@@ -66,17 +66,15 @@ class BluetoothDeviceWinTest : public testing::Test {
base::HexStringToBytes(kTestVideoSdpBytes, &video_state->sdp_bytes);
device_state_->service_record_states.push_back(std::move(video_state));
device_.reset(new BluetoothDeviceWin(NULL, *device_state_, ui_task_runner,
socket_thread, NULL,
net::NetLogSource()));
device_.reset(new BluetoothDeviceWin(nullptr, *device_state_,
ui_task_runner, socket_thread));
// Add empty device.
empty_device_state_.reset(new BluetoothTaskManagerWin::DeviceState());
empty_device_state_->name = std::string(kDeviceName);
empty_device_state_->address = kDeviceAddress;
empty_device_.reset(new BluetoothDeviceWin(NULL, *empty_device_state_,
ui_task_runner, socket_thread,
NULL, net::NetLogSource()));
empty_device_.reset(new BluetoothDeviceWin(nullptr, *empty_device_state_,
ui_task_runner, socket_thread));
}
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