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 d85dbd1cce04d6eb748b9aa9e4270c2833aab1b6..6cad374ff57675ece2d3c8c0eabaa7148a11f094 100644 |
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
@@ -10,11 +10,9 @@ |
#include "content/browser/bluetooth/bluetooth_dispatcher_host.h" |
-#include "base/hash.h" |
-#include "base/metrics/histogram_macros.h" |
-#include "base/metrics/sparse_histogram.h" |
#include "base/strings/utf_string_conversions.h" |
#include "content/browser/bad_message.h" |
+#include "content/browser/bluetooth/bluetooth_metrics.h" |
#include "content/browser/frame_host/render_frame_host_impl.h" |
#include "content/common/bluetooth/bluetooth_messages.h" |
#include "device/bluetooth/bluetooth_adapter.h" |
@@ -25,167 +23,23 @@ |
#include "device/bluetooth/bluetooth_gatt_service.h" |
using blink::WebBluetoothError; |
+using content::BluetoothMetrics; |
using device::BluetoothAdapter; |
using device::BluetoothAdapterFactory; |
using device::BluetoothGattCharacteristic; |
using device::BluetoothGattService; |
using device::BluetoothUUID; |
-namespace { |
- |
-// These types of errors aren't as common. We log them to understand |
-// how common they are and if we need to investigate more. |
-enum class BluetoothGATTError { |
- UNKNOWN, |
- FAILED, |
- IN_PROGRESS, |
- NOT_PAIRED, |
- // Add errors above this line and update corresponding histograms.xml enum. |
- MAX_ERROR, |
-}; |
- |
-enum class UMARequestDeviceOutcome { |
- SUCCESS = 0, |
- NO_BLUETOOTH_ADAPTER = 1, |
- NO_RENDER_FRAME = 2, |
- DISCOVERY_START_FAILED = 3, |
- DISCOVERY_STOP_FAILED = 4, |
- NO_MATCHING_DEVICES_FOUND = 5, |
- BLUETOOTH_ADAPTER_NOT_PRESENT = 6, |
- BLUETOOTH_ADAPTER_OFF = 7, |
- // NOTE: Add new requestDevice() outcomes immediately above this line. Make |
- // sure to update the enum list in |
- // tools/metrics/histogram/histograms.xml accordingly. |
- COUNT |
-}; |
- |
-void RecordRequestDeviceOutcome(UMARequestDeviceOutcome outcome) { |
- UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.RequestDevice.Outcome", |
- static_cast<int>(outcome), |
- static_cast<int>(UMARequestDeviceOutcome::COUNT)); |
-} |
-// TODO(ortuno): Remove once we have a macro to histogram strings. |
-// http://crbug.com/520284 |
-int HashUUID(const std::string& uuid) { |
- uint32 data = base::SuperFastHash(uuid.data(), uuid.size()); |
- |
- // Strip off the signed bit because UMA doesn't support negative values, |
- // but takes a signed int as input. |
- return static_cast<int>(data & 0x7fffffff); |
-} |
- |
-void RecordRequestDeviceFilters( |
- const std::vector<content::BluetoothScanFilter>& filters) { |
- UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.Filters.Count", |
- filters.size()); |
- for (const content::BluetoothScanFilter& filter : filters) { |
- UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.FilterSize", |
- filter.services.size()); |
- for (const BluetoothUUID& service : filter.services) { |
- // TODO(ortuno): Use a macro to histogram strings. |
- // http://crbug.com/520284 |
- UMA_HISTOGRAM_SPARSE_SLOWLY( |
- "Bluetooth.Web.RequestDevice.Filters.Services", |
- HashUUID(service.canonical_value())); |
- } |
- } |
-} |
- |
-void RecordRequestDeviceOptionalServices( |
- const std::vector<BluetoothUUID>& optional_services) { |
- UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.OptionalServices.Count", |
- optional_services.size()); |
- for (const BluetoothUUID& service : optional_services) { |
- // TODO(ortuno): Use a macro to histogram strings. |
- // http://crbug.com/520284 |
- UMA_HISTOGRAM_SPARSE_SLOWLY( |
- "Bluetooth.Web.RequestDevice.OptionalServices.Services", |
- HashUUID(service.canonical_value())); |
- } |
-} |
- |
-void RecordUnionOfServices( |
- const std::vector<content::BluetoothScanFilter>& filters, |
- const std::vector<BluetoothUUID>& optional_services) { |
- std::set<BluetoothUUID> union_of_services(optional_services.begin(), |
- optional_services.end()); |
- |
- for (const content::BluetoothScanFilter& filter : filters) |
- union_of_services.insert(filter.services.begin(), filter.services.end()); |
- |
- UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.UnionOfServices.Count", |
- union_of_services.size()); |
-} |
- |
-enum class UMAGetPrimaryServiceOutcome { |
- SUCCESS, |
- NO_DEVICE, |
- NOT_FOUND, |
- // Note: Add new GetPrimaryService outcomes immediately above this line. Make |
- // sure to update the enum list in tools/metrics/histograms/histograms.xml |
- // accordingly. |
- COUNT |
-}; |
- |
-void RecordGetPrimaryServiceService(const BluetoothUUID& service) { |
- UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetPrimaryService.Services", |
- HashUUID(service.canonical_value())); |
-} |
- |
-void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome) { |
- UMA_HISTOGRAM_ENUMERATION( |
- "Bluetooth.Web.GetPrimaryService.Outcome", static_cast<int>(outcome), |
- static_cast<int>(UMAGetPrimaryServiceOutcome::COUNT)); |
-} |
- |
-enum class UMAConnectGATTOutcome { |
- SUCCESS, |
- NO_DEVICE, |
- UNKNOWN, |
- IN_PROGRESS, |
- FAILED, |
- AUTH_FAILED, |
- AUTH_CANCELED, |
- AUTH_REJECTED, |
- AUTH_TIMEOUT, |
- UNSUPPORTED_DEVICE, |
- // Note: Add new ConnectGATT outcomes immediately above this line. Make sure |
- // to update the enum list in tools/metrisc/histogram/histograms.xml |
- // accordingly. |
- COUNT |
-}; |
- |
-void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome) { |
- UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.ConnectGATT.Outcome", |
- static_cast<int>(outcome), |
- static_cast<int>(UMAConnectGATTOutcome::COUNT)); |
-} |
+using UMAWebBluetoothFunction = |
+ content::BluetoothMetrics::UMAWebBluetoothFunction; |
+using UMARequestDeviceOutcome = |
+ content::BluetoothMetrics::UMARequestDeviceOutcome; |
+using UMAConnectGATTOutcome = content::BluetoothMetrics::UMAConnectGATTOutcome; |
+using UMAGetPrimaryServiceOutcome = |
+ content::BluetoothMetrics::UMAGetPrimaryServiceOutcome; |
+using UMAGATTError = content::BluetoothMetrics::UMAGATTError; |
-void RecordConnectGATTTimeSuccess(const base::TimeDelta& duration) { |
- UMA_HISTOGRAM_MEDIUM_TIMES("Bluetooth.Web.ConnectGATT.TimeSuccess", duration); |
-} |
- |
-void RecordConnectGATTTimeFailed(const base::TimeDelta& duration) { |
- UMA_HISTOGRAM_MEDIUM_TIMES("Bluetooth.Web.ConnectGATT.TimeFailed", duration); |
-} |
- |
-enum class UMAWebBluetoothFunction { |
- REQUEST_DEVICE, |
- CONNECT_GATT, |
- GET_PRIMARY_SERVICE, |
- GET_CHARACTERISTIC, |
- CHARACTERISTIC_READ_VALUE, |
- CHARACTERISTIC_WRITE_VALUE, |
- // NOTE: Add new actions immediately above this line. Make sure to update the |
- // enum list in tools/metrics/histogram/histograms.xml accordingly. |
- COUNT |
-}; |
- |
-void RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction function) { |
- UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.FunctionCall.Count", |
- static_cast<int>(function), |
- static_cast<int>(UMAWebBluetoothFunction::COUNT)); |
-} |
+namespace { |
// TODO(ortuno): Once we have a chooser for scanning and the right |
// callback for discovered services we should delete these constants. |
@@ -220,37 +74,39 @@ bool MatchesFilters(const device::BluetoothDevice& device, |
return false; |
} |
-void AddToHistogram(BluetoothGATTError error) { |
- UMA_HISTOGRAM_ENUMERATION("Bluetooth.GATTErrors", static_cast<int>(error), |
- static_cast<int>(BluetoothGATTError::MAX_ERROR)); |
-} |
- |
WebBluetoothError TranslateConnectError( |
device::BluetoothDevice::ConnectErrorCode error_code) { |
switch (error_code) { |
case device::BluetoothDevice::ERROR_UNKNOWN: |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::UNKNOWN); |
+ BluetoothMetrics::RecordConnectGATTOutcome( |
+ UMAConnectGATTOutcome::UNKNOWN); |
return WebBluetoothError::ConnectUnknownError; |
case device::BluetoothDevice::ERROR_INPROGRESS: |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::IN_PROGRESS); |
+ BluetoothMetrics::RecordConnectGATTOutcome( |
+ UMAConnectGATTOutcome::IN_PROGRESS); |
return WebBluetoothError::ConnectAlreadyInProgress; |
case device::BluetoothDevice::ERROR_FAILED: |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::FAILED); |
+ BluetoothMetrics::RecordConnectGATTOutcome(UMAConnectGATTOutcome::FAILED); |
return WebBluetoothError::ConnectUnknownFailure; |
case device::BluetoothDevice::ERROR_AUTH_FAILED: |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::AUTH_FAILED); |
+ BluetoothMetrics::RecordConnectGATTOutcome( |
+ UMAConnectGATTOutcome::AUTH_FAILED); |
return WebBluetoothError::ConnectAuthFailed; |
case device::BluetoothDevice::ERROR_AUTH_CANCELED: |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::AUTH_CANCELED); |
+ BluetoothMetrics::RecordConnectGATTOutcome( |
+ UMAConnectGATTOutcome::AUTH_CANCELED); |
return WebBluetoothError::ConnectAuthCanceled; |
case device::BluetoothDevice::ERROR_AUTH_REJECTED: |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::AUTH_REJECTED); |
+ BluetoothMetrics::RecordConnectGATTOutcome( |
+ UMAConnectGATTOutcome::AUTH_REJECTED); |
return WebBluetoothError::ConnectAuthRejected; |
case device::BluetoothDevice::ERROR_AUTH_TIMEOUT: |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::AUTH_TIMEOUT); |
+ BluetoothMetrics::RecordConnectGATTOutcome( |
+ UMAConnectGATTOutcome::AUTH_TIMEOUT); |
return WebBluetoothError::ConnectAuthTimeout; |
case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE: |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::UNSUPPORTED_DEVICE); |
+ BluetoothMetrics::RecordConnectGATTOutcome( |
+ UMAConnectGATTOutcome::UNSUPPORTED_DEVICE); |
return WebBluetoothError::ConnectUnsupportedDevice; |
} |
NOTREACHED(); |
@@ -261,13 +117,13 @@ blink::WebBluetoothError TranslateGATTError( |
BluetoothGattService::GattErrorCode error_code) { |
switch (error_code) { |
case BluetoothGattService::GATT_ERROR_UNKNOWN: |
- AddToHistogram(BluetoothGATTError::UNKNOWN); |
+ BluetoothMetrics::RecordGATTError(UMAGATTError::UNKNOWN); |
return blink::WebBluetoothError::GATTUnknownError; |
case BluetoothGattService::GATT_ERROR_FAILED: |
- AddToHistogram(BluetoothGATTError::FAILED); |
+ BluetoothMetrics::RecordGATTError(UMAGATTError::FAILED); |
return blink::WebBluetoothError::GATTUnknownFailure; |
case BluetoothGattService::GATT_ERROR_IN_PROGRESS: |
- AddToHistogram(BluetoothGATTError::IN_PROGRESS); |
+ BluetoothMetrics::RecordGATTError(UMAGATTError::IN_PROGRESS); |
return blink::WebBluetoothError::GATTOperationInProgress; |
case BluetoothGattService::GATT_ERROR_INVALID_LENGTH: |
return blink::WebBluetoothError::GATTInvalidAttributeLength; |
@@ -276,7 +132,7 @@ blink::WebBluetoothError TranslateGATTError( |
case BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED: |
return blink::WebBluetoothError::GATTNotAuthorized; |
case BluetoothGattService::GATT_ERROR_NOT_PAIRED: |
- AddToHistogram(BluetoothGATTError::NOT_PAIRED); |
+ BluetoothMetrics::RecordGATTError(UMAGATTError::NOT_PAIRED); |
return blink::WebBluetoothError::GATTNotPaired; |
case BluetoothGattService::GATT_ERROR_NOT_SUPPORTED: |
return blink::WebBluetoothError::GATTNotSupported; |
@@ -384,10 +240,11 @@ void BluetoothDispatcherHost::OnRequestDevice( |
const std::vector<BluetoothScanFilter>& filters, |
const std::vector<BluetoothUUID>& optional_services) { |
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
- RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::REQUEST_DEVICE); |
- RecordRequestDeviceFilters(filters); |
- RecordRequestDeviceOptionalServices(optional_services); |
- RecordUnionOfServices(filters, optional_services); |
+ BluetoothMetrics::RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::REQUEST_DEVICE); |
+ BluetoothMetrics::RecordRequestDeviceFilters(filters); |
+ BluetoothMetrics::RecordRequestDeviceOptionalServices(optional_services); |
+ BluetoothMetrics::RecordUnionOfServices(filters, optional_services); |
VLOG(1) << "requestDevice called with the following filters: "; |
for (const BluetoothScanFilter& filter : filters) { |
@@ -408,7 +265,8 @@ void BluetoothDispatcherHost::OnRequestDevice( |
DLOG(WARNING) |
<< "Got a requestDevice IPC without a matching RenderFrameHost: " |
<< render_process_id_ << ", " << frame_routing_id; |
- RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_RENDER_FRAME); |
+ BluetoothMetrics::RecordRequestDeviceOutcome( |
+ UMARequestDeviceOutcome::NO_RENDER_FRAME); |
Send(new BluetoothMsg_RequestDeviceError( |
thread_id, request_id, WebBluetoothError::RequestDeviceWithoutFrame)); |
} |
@@ -429,7 +287,7 @@ void BluetoothDispatcherHost::OnRequestDevice( |
} |
if (!adapter_->IsPresent()) { |
VLOG(1) << "Bluetooth Adapter not present. Can't serve requestDevice."; |
- RecordRequestDeviceOutcome( |
+ BluetoothMetrics::RecordRequestDeviceOutcome( |
UMARequestDeviceOutcome::BLUETOOTH_ADAPTER_NOT_PRESENT); |
Send(new BluetoothMsg_RequestDeviceError( |
thread_id, request_id, WebBluetoothError::NoBluetoothAdapter)); |
@@ -444,7 +302,7 @@ void BluetoothDispatcherHost::OnRequestDevice( |
// https://crbug.com/517237 |
if (!adapter_->IsPowered()) { |
VLOG(1) << "Bluetooth Adapter is not powered. Can't serve requestDevice."; |
- RecordRequestDeviceOutcome( |
+ BluetoothMetrics::RecordRequestDeviceOutcome( |
UMARequestDeviceOutcome::BLUETOOTH_ADAPTER_OFF); |
Send(new BluetoothMsg_RequestDeviceError( |
thread_id, request_id, WebBluetoothError::BluetoothAdapterOff)); |
@@ -459,7 +317,8 @@ void BluetoothDispatcherHost::OnRequestDevice( |
weak_ptr_factory_.GetWeakPtr(), thread_id, request_id)); |
} else { |
VLOG(1) << "No BluetoothAdapter. Can't serve requestDevice."; |
- RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER); |
+ BluetoothMetrics::RecordRequestDeviceOutcome( |
+ UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER); |
Send(new BluetoothMsg_RequestDeviceError( |
thread_id, request_id, WebBluetoothError::NoBluetoothAdapter)); |
} |
@@ -471,7 +330,8 @@ void BluetoothDispatcherHost::OnConnectGATT( |
int request_id, |
const std::string& device_instance_id) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::CONNECT_GATT); |
+ BluetoothMetrics::RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::CONNECT_GATT); |
const base::TimeTicks start_time = base::TimeTicks::Now(); |
// TODO(ortuno): Right now it's pointless to check if the domain has access to |
@@ -480,7 +340,8 @@ void BluetoothDispatcherHost::OnConnectGATT( |
// the device. https://crbug.com/484745 |
device::BluetoothDevice* device = adapter_->GetDevice(device_instance_id); |
if (device == nullptr) { // See "NETWORK_ERROR Note" above. |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::NO_DEVICE); |
+ BluetoothMetrics::RecordConnectGATTOutcome( |
+ UMAConnectGATTOutcome::NO_DEVICE); |
VLOG(1) << "Bluetooth Device no longer in range."; |
Send(new BluetoothMsg_ConnectGATTError( |
thread_id, request_id, WebBluetoothError::DeviceNoLongerInRange)); |
@@ -501,8 +362,9 @@ void BluetoothDispatcherHost::OnGetPrimaryService( |
const std::string& device_instance_id, |
const std::string& service_uuid) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::GET_PRIMARY_SERVICE); |
- RecordGetPrimaryServiceService(BluetoothUUID(service_uuid)); |
+ BluetoothMetrics::RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::GET_PRIMARY_SERVICE); |
+ BluetoothMetrics::RecordGetPrimaryServiceService(BluetoothUUID(service_uuid)); |
// TODO(ortuno): Check if device_instance_id is in "allowed devices" |
// https://crbug.com/493459 |
@@ -524,7 +386,8 @@ void BluetoothDispatcherHost::OnGetCharacteristic( |
const std::string& service_instance_id, |
const std::string& characteristic_uuid) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::GET_CHARACTERISTIC); |
+ BluetoothMetrics::RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::GET_CHARACTERISTIC); |
auto device_iter = service_to_device_.find(service_instance_id); |
// A service_instance_id not in the map implies a hostile renderer |
@@ -586,7 +449,7 @@ void BluetoothDispatcherHost::OnReadValue( |
int request_id, |
const std::string& characteristic_instance_id) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- RecordWebBluetoothFunctionCall( |
+ BluetoothMetrics::RecordWebBluetoothFunctionCall( |
UMAWebBluetoothFunction::CHARACTERISTIC_READ_VALUE); |
auto characteristic_iter = |
@@ -643,7 +506,7 @@ void BluetoothDispatcherHost::OnWriteValue( |
const std::string& characteristic_instance_id, |
const std::vector<uint8_t>& value) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- RecordWebBluetoothFunctionCall( |
+ BluetoothMetrics::RecordWebBluetoothFunctionCall( |
UMAWebBluetoothFunction::CHARACTERISTIC_WRITE_VALUE); |
// Length check per step 3 of writeValue algorithm: |
@@ -720,7 +583,8 @@ void BluetoothDispatcherHost::OnDiscoverySessionStartedError(int thread_id, |
int request_id) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
DLOG(WARNING) << "BluetoothDispatcherHost::OnDiscoverySessionStartedError"; |
- RecordRequestDeviceOutcome(UMARequestDeviceOutcome::DISCOVERY_START_FAILED); |
+ BluetoothMetrics::RecordRequestDeviceOutcome( |
+ UMARequestDeviceOutcome::DISCOVERY_START_FAILED); |
Send(new BluetoothMsg_RequestDeviceError( |
thread_id, request_id, WebBluetoothError::DiscoverySessionStartFailed)); |
request_device_sessions_.erase(std::make_pair(thread_id, request_id)); |
@@ -763,14 +627,15 @@ void BluetoothDispatcherHost::OnDiscoverySessionStopped(int thread_id, |
device->IsPaired(), // paired |
content::BluetoothDevice::UUIDsFromBluetoothUUIDs( |
device->GetUUIDs())); // uuids |
- RecordRequestDeviceOutcome(UMARequestDeviceOutcome::SUCCESS); |
+ BluetoothMetrics::RecordRequestDeviceOutcome( |
+ UMARequestDeviceOutcome::SUCCESS); |
Send(new BluetoothMsg_RequestDeviceSuccess(thread_id, request_id, |
device_ipc)); |
request_device_sessions_.erase(session); |
return; |
} |
} |
- RecordRequestDeviceOutcome( |
+ BluetoothMetrics::RecordRequestDeviceOutcome( |
UMARequestDeviceOutcome::NO_MATCHING_DEVICES_FOUND); |
VLOG(1) << "No matching Bluetooth Devices found"; |
Send(new BluetoothMsg_RequestDeviceError(thread_id, request_id, |
@@ -782,7 +647,8 @@ void BluetoothDispatcherHost::OnDiscoverySessionStoppedError(int thread_id, |
int request_id) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
DLOG(WARNING) << "BluetoothDispatcherHost::OnDiscoverySessionStoppedError"; |
- RecordRequestDeviceOutcome(UMARequestDeviceOutcome::DISCOVERY_STOP_FAILED); |
+ BluetoothMetrics::RecordRequestDeviceOutcome( |
+ UMARequestDeviceOutcome::DISCOVERY_STOP_FAILED); |
Send(new BluetoothMsg_RequestDeviceError( |
thread_id, request_id, WebBluetoothError::DiscoverySessionStopFailed)); |
request_device_sessions_.erase(std::make_pair(thread_id, request_id)); |
@@ -796,8 +662,9 @@ void BluetoothDispatcherHost::OnGATTConnectionCreated( |
scoped_ptr<device::BluetoothGattConnection> connection) { |
// TODO(ortuno): Save the BluetoothGattConnection so we can disconnect |
// from it. |
- RecordConnectGATTTimeSuccess(base::TimeTicks::Now() - start_time); |
- RecordConnectGATTOutcome(UMAConnectGATTOutcome::SUCCESS); |
+ BluetoothMetrics::RecordConnectGATTTimeSuccess(base::TimeTicks::Now() - |
+ start_time); |
+ BluetoothMetrics::RecordConnectGATTOutcome(UMAConnectGATTOutcome::SUCCESS); |
Send(new BluetoothMsg_ConnectGATTSuccess(thread_id, request_id, |
device_instance_id)); |
} |
@@ -811,8 +678,10 @@ void BluetoothDispatcherHost::OnCreateGATTConnectionError( |
// There was an error creating the ATT Bearer so we reject with |
// NetworkError. |
// https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetoothdevice-connectgatt |
- RecordConnectGATTTimeFailed(base::TimeTicks::Now() - start_time); |
- // RecordConnectGATTOutcome is called by TranslateConnectError. |
+ BluetoothMetrics::RecordConnectGATTTimeFailed(base::TimeTicks::Now() - |
+ start_time); |
+ // BluetoothMetrics::RecordConnectGATTOutcome is called by |
+ // TranslateConnectError. |
Send(new BluetoothMsg_ConnectGATTError(thread_id, request_id, |
TranslateConnectError(error_code))); |
} |
@@ -826,7 +695,8 @@ void BluetoothDispatcherHost::OnServicesDiscovered( |
device::BluetoothDevice* device = adapter_->GetDevice(device_instance_id); |
if (device == nullptr) { // See "NETWORK_ERROR Note" above. |
- RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::NO_DEVICE); |
+ BluetoothMetrics::RecordGetPrimaryServiceOutcome( |
+ UMAGetPrimaryServiceOutcome::NO_DEVICE); |
VLOG(1) << "Bluetooth Device is no longer in range."; |
Send(new BluetoothMsg_GetPrimaryServiceError( |
thread_id, request_id, WebBluetoothError::DeviceNoLongerInRange)); |
@@ -844,13 +714,15 @@ void BluetoothDispatcherHost::OnServicesDiscovered( |
if (!insert_result.second) |
DCHECK(insert_result.first->second == device_instance_id); |
- RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::SUCCESS); |
+ BluetoothMetrics::RecordGetPrimaryServiceOutcome( |
+ UMAGetPrimaryServiceOutcome::SUCCESS); |
Send(new BluetoothMsg_GetPrimaryServiceSuccess(thread_id, request_id, |
service_identifier)); |
return; |
} |
} |
- RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::NOT_FOUND); |
+ BluetoothMetrics::RecordGetPrimaryServiceOutcome( |
+ UMAGetPrimaryServiceOutcome::NOT_FOUND); |
VLOG(1) << "No GATT services with UUID: " << service_uuid; |
Send(new BluetoothMsg_GetPrimaryServiceError( |
thread_id, request_id, WebBluetoothError::ServiceNotFound)); |