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

Unified Diff: content/browser/bluetooth/bluetooth_dispatcher_host.cc

Issue 1639293002: bluetooth: update bluetooth_dispatcher_host VLOG to BLUETOOTH_LOG (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@btDeviceLog
Patch Set: Created 4 years, 11 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 | « content/browser/BUILD.gn ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/bluetooth/bluetooth_dispatcher_host.cc
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
index deb626df075cda1a08b08e8fc27ee6164cdd1dbf..fa460a3ce71a5726e26c35e43c9cea21ab0994db 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -19,6 +19,7 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
+#include "components/device_event_log/device_event_log.h"
#include "content/browser/bad_message.h"
#include "content/browser/bluetooth/bluetooth_metrics.h"
#include "content/browser/bluetooth/first_device_bluetooth_chooser.h"
@@ -221,9 +222,10 @@ std::vector<BluetoothGattService*> GetPrimaryServicesByUUID(
device::BluetoothDevice* device,
const std::string& service_uuid) {
std::vector<BluetoothGattService*> services;
- VLOG(1) << "Looking for service: " << service_uuid;
+ BLUETOOTH_LOG(EVENT) << "Looking for service: " << service_uuid;
for (BluetoothGattService* service : device->GetGattServices()) {
- VLOG(1) << "Service in cache: " << service->GetUUID().canonical_value();
+ BLUETOOTH_LOG(EVENT) << "Service in cache: "
+ << service->GetUUID().canonical_value();
if (service->GetUUID().canonical_value() == service_uuid &&
service->IsPrimary()) {
services.push_back(service);
@@ -496,7 +498,8 @@ void BluetoothDispatcherHost::AdapterPoweredChanged(
void BluetoothDispatcherHost::DeviceAdded(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- VLOG(1) << "Adding device to all choosers: " << device->GetAddress();
+ BLUETOOTH_LOG(EVENT) << "Adding device to all choosers: "
+ << device->GetAddress();
for (IDMap<RequestDeviceSession, IDMapOwnPointer>::iterator iter(
&request_device_sessions_);
!iter.IsAtEnd(); iter.Advance()) {
@@ -508,7 +511,8 @@ void BluetoothDispatcherHost::DeviceAdded(device::BluetoothAdapter* adapter,
void BluetoothDispatcherHost::DeviceRemoved(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- VLOG(1) << "Marking device removed on all choosers: " << device->GetAddress();
+ BLUETOOTH_LOG(EVENT) << "Marking device removed on all choosers: "
+ << device->GetAddress();
for (IDMap<RequestDeviceSession, IDMapOwnPointer>::iterator iter(
&request_device_sessions_);
!iter.IsAtEnd(); iter.Advance()) {
@@ -524,7 +528,7 @@ void BluetoothDispatcherHost::GattServicesDiscovered(
device::BluetoothDevice* device) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
const std::string& device_address = device->GetAddress();
- VLOG(1) << "Services discovered for device: " << device_address;
+ BLUETOOTH_LOG(EVENT) << "Services discovered for device: " << device_address;
auto iter = pending_primary_services_requests_.find(device_address);
if (iter == pending_primary_services_requests_.end()) {
@@ -543,7 +547,7 @@ void BluetoothDispatcherHost::GattServicesDiscovered(
AddToServicesMapAndSendGetPrimaryServiceSuccess(
*services[0], request.thread_id, request.request_id);
} else {
- VLOG(1) << "No service found";
+ BLUETOOTH_LOG(EVENT) << "No service found";
RecordGetPrimaryServiceOutcome(
UMAGetPrimaryServiceOutcome::NOT_FOUND);
Send(new BluetoothMsg_GetPrimaryServiceError(
@@ -564,7 +568,8 @@ void BluetoothDispatcherHost::GattCharacteristicValueChanged(
device::BluetoothAdapter* adapter,
device::BluetoothGattCharacteristic* characteristic,
const std::vector<uint8_t>& value) {
- VLOG(1) << "Characteristic updated: " << characteristic->GetIdentifier();
+ BLUETOOTH_LOG(EVENT) << "Characteristic updated: "
+ << characteristic->GetIdentifier();
auto iter =
active_characteristic_threads_.find(characteristic->GetIdentifier());
@@ -606,20 +611,21 @@ void BluetoothDispatcherHost::OnRequestDevice(
RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::REQUEST_DEVICE);
RecordRequestDeviceArguments(filters, optional_services);
- VLOG(1) << "requestDevice called with the following filters: ";
+ BLUETOOTH_LOG(USER) << "requestDevice called with the following filters: ";
for (const BluetoothScanFilter& filter : filters) {
- VLOG(1) << "Name: " << filter.name;
- VLOG(1) << "Name Prefix: " << filter.namePrefix;
- VLOG(1) << "Services:";
- VLOG(1) << "\t[";
+ BLUETOOTH_LOG(USER) << "Name: " << filter.name;
+ BLUETOOTH_LOG(USER) << "Name Prefix: " << filter.namePrefix;
+ BLUETOOTH_LOG(USER) << "Services:";
+ BLUETOOTH_LOG(USER) << "\t[";
for (const BluetoothUUID& service : filter.services)
- VLOG(1) << "\t\t" << service.value();
- VLOG(1) << "\t]";
+ BLUETOOTH_LOG(USER) << "\t\t" << service.value();
+ BLUETOOTH_LOG(USER) << "\t]";
}
- VLOG(1) << "requestDevice called with the following optional services: ";
+ BLUETOOTH_LOG(USER)
+ << "requestDevice called with the following optional services: ";
for (const BluetoothUUID& service : optional_services)
- VLOG(1) << "\t" << service.value();
+ BLUETOOTH_LOG(USER) << "\t" << service.value();
RenderFrameHostImpl* render_frame_host =
RenderFrameHostImpl::FromID(render_process_id_, frame_routing_id);
@@ -635,7 +641,7 @@ void BluetoothDispatcherHost::OnRequestDevice(
}
if (!adapter_) {
- VLOG(1) << "No BluetoothAdapter. Can't serve requestDevice.";
+ BLUETOOTH_LOG(EVENT) << "No BluetoothAdapter. Can't serve requestDevice.";
RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER);
Send(new BluetoothMsg_RequestDeviceError(
thread_id, request_id, WebBluetoothError::NoBluetoothAdapter));
@@ -643,7 +649,8 @@ void BluetoothDispatcherHost::OnRequestDevice(
}
if (!adapter_->IsPresent()) {
- VLOG(1) << "Bluetooth Adapter not present. Can't serve requestDevice.";
+ BLUETOOTH_LOG(EVENT)
+ << "Bluetooth Adapter not present. Can't serve requestDevice.";
RecordRequestDeviceOutcome(
UMARequestDeviceOutcome::BLUETOOTH_ADAPTER_NOT_PRESENT);
Send(new BluetoothMsg_RequestDeviceError(
@@ -679,24 +686,25 @@ void BluetoothDispatcherHost::OnRequestDevice(
}
}
if (!session->chooser) {
- LOG(WARNING)
+ BLUETOOTH_LOG(EVENT)
<< "No Bluetooth chooser implementation; falling back to first device.";
session->chooser.reset(
new FirstDeviceBluetoothChooser(chooser_event_handler));
}
if (!session->chooser->CanAskForScanningPermission()) {
- VLOG(1) << "Closing immediately because Chooser cannot obtain permission.";
+ BLUETOOTH_LOG(EVENT)
+ << "Closing immediately because Chooser cannot obtain permission.";
OnBluetoothChooserEvent(chooser_id,
BluetoothChooser::Event::DENIED_PERMISSION, "");
return;
}
// Populate the initial list of devices.
- VLOG(1) << "Populating " << adapter_->GetDevices().size()
- << " devices in chooser " << chooser_id;
+ BLUETOOTH_LOG(EVENT) << "Populating " << adapter_->GetDevices().size()
+ << " devices in chooser " << chooser_id;
for (const device::BluetoothDevice* device : adapter_->GetDevices()) {
- VLOG(1) << "\t" << device->GetAddress();
+ BLUETOOTH_LOG(EVENT) << "\t" << device->GetAddress();
session->AddFilteredDevice(*device);
}
@@ -736,7 +744,7 @@ void BluetoothDispatcherHost::OnConnectGATT(int thread_id,
auto connection_iter = device_id_to_connection_map_.find(device_id);
if (connection_iter != device_id_to_connection_map_.end()) {
if (connection_iter->second->IsConnected()) {
- VLOG(1) << "Already connected.";
+ BLUETOOTH_LOG(EVENT) << "Already connected.";
Send(new BluetoothMsg_ConnectGATTSuccess(thread_id, request_id,
device_id));
return;
@@ -773,7 +781,7 @@ void BluetoothDispatcherHost::OnDisconnect(int thread_id,
// The last BluetoothGattConnection for a device closes the connection when
// it's destroyed.
if (device_id_to_connection_map_.erase(device_id)) {
- VLOG(1) << "Disconnecting device: " << device_id;
+ BLUETOOTH_LOG(EVENT) << "Disconnecting device: " << device_id;
}
}
@@ -815,7 +823,7 @@ void BluetoothDispatcherHost::OnGetPrimaryService(
// 1. & 2.
if (!services.empty()) {
- VLOG(1) << "Service found in device.";
+ BLUETOOTH_LOG(EVENT) << "Service found in device.";
const BluetoothGattService& service = *services[0];
DCHECK(service.IsPrimary());
AddToServicesMapAndSendGetPrimaryServiceSuccess(service, thread_id,
@@ -825,14 +833,14 @@ void BluetoothDispatcherHost::OnGetPrimaryService(
// 3.
if (query_result.device->IsGattServicesDiscoveryComplete()) {
- VLOG(1) << "Service not found in device.";
+ BLUETOOTH_LOG(EVENT) << "Service not found in device.";
RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::NOT_FOUND);
Send(new BluetoothMsg_GetPrimaryServiceError(
thread_id, request_id, WebBluetoothError::ServiceNotFound));
return;
}
- VLOG(1) << "Adding service request to pending requests.";
+ BLUETOOTH_LOG(EVENT) << "Adding service request to pending requests.";
// 4.
AddToPendingPrimaryServicesRequest(
query_result.device->GetAddress(),
@@ -1068,7 +1076,7 @@ void BluetoothDispatcherHost::OnDiscoverySessionStarted(
int chooser_id,
scoped_ptr<device::BluetoothDiscoverySession> discovery_session) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- VLOG(1) << "Started discovery session for " << chooser_id;
+ BLUETOOTH_LOG(EVENT) << "Started discovery session for " << chooser_id;
if (RequestDeviceSession* session =
request_device_sessions_.Lookup(chooser_id)) {
session->discovery_session = std::move(discovery_session);
@@ -1076,15 +1084,17 @@ void BluetoothDispatcherHost::OnDiscoverySessionStarted(
// Arrange to stop discovery later.
discovery_session_timer_.Reset();
} else {
- VLOG(1) << "Chooser " << chooser_id
- << " was closed before the session finished starting. Stopping.";
+ BLUETOOTH_LOG(EVENT)
+ << "Chooser " << chooser_id
+ << " was closed before the session finished starting. Stopping.";
StopDiscoverySession(std::move(discovery_session));
}
}
void BluetoothDispatcherHost::OnDiscoverySessionStartedError(int chooser_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- VLOG(1) << "Failed to start discovery session for " << chooser_id;
+ BLUETOOTH_LOG(EVENT) << "Failed to start discovery session for "
+ << chooser_id;
if (RequestDeviceSession* session =
request_device_sessions_.Lookup(chooser_id)) {
if (session->chooser && !session->discovery_session) {
@@ -1155,7 +1165,7 @@ void BluetoothDispatcherHost::FinishClosingChooser(
if (event == BluetoothChooser::Event::CANCELLED) {
RecordRequestDeviceOutcome(
UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_CANCELLED);
- VLOG(1) << "Bluetooth chooser cancelled";
+ BLUETOOTH_LOG(EVENT) << "Bluetooth chooser cancelled";
Send(new BluetoothMsg_RequestDeviceError(
session->thread_id, session->request_id,
WebBluetoothError::ChooserCancelled));
@@ -1165,7 +1175,7 @@ void BluetoothDispatcherHost::FinishClosingChooser(
if (event == BluetoothChooser::Event::DENIED_PERMISSION) {
RecordRequestDeviceOutcome(
UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_DENIED_PERMISSION);
- VLOG(1) << "Bluetooth chooser denied permission";
+ BLUETOOTH_LOG(EVENT) << "Bluetooth chooser denied permission";
Send(new BluetoothMsg_RequestDeviceError(
session->thread_id, session->request_id,
WebBluetoothError::ChooserDeniedPermission));
@@ -1179,7 +1189,7 @@ void BluetoothDispatcherHost::FinishClosingChooser(
// chooser->AddDevice().
const device::BluetoothDevice* const device = adapter_->GetDevice(device_id);
if (device == nullptr) {
- VLOG(1) << "Device " << device_id << " no longer in adapter";
+ BLUETOOTH_LOG(EVENT) << "Device " << device_id << " no longer in adapter";
RecordRequestDeviceOutcome(UMARequestDeviceOutcome::CHOSEN_DEVICE_VANISHED);
Send(new BluetoothMsg_RequestDeviceError(
session->thread_id, session->request_id,
@@ -1188,10 +1198,10 @@ void BluetoothDispatcherHost::FinishClosingChooser(
return;
}
- VLOG(1) << "Device: " << device->GetName();
- VLOG(1) << "UUIDs: ";
+ BLUETOOTH_LOG(EVENT) << "Device: " << device->GetName();
+ BLUETOOTH_LOG(EVENT) << "UUIDs: ";
for (BluetoothUUID uuid : device->GetUUIDs())
- VLOG(1) << "\t" << uuid.canonical_value();
+ BLUETOOTH_LOG(EVENT) << "\t" << uuid.canonical_value();
const std::string& device_id_for_origin = allowed_devices_map_.AddDevice(
session->origin, device->GetAddress(), session->filters,
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698