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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm

Issue 2912633002: bluetooth: macOS: Adding histograms for NSError values (Closed)
Patch Set: Created 3 years, 7 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
Index: device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
index 900f3f6613ff866b754d734485da20efe264d7d6..9ae0546d22cc1dd1279728188801fbfc74006fb7 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
@@ -9,6 +9,7 @@
#include "base/strings/sys_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "device/bluetooth/bluetooth_adapter_mac.h"
+#include "device/bluetooth/bluetooth_adapter_mac_metrics.h"
#include "device/bluetooth/bluetooth_device_mac.h"
#include "device/bluetooth/bluetooth_gatt_notify_session.h"
#include "device/bluetooth/bluetooth_remote_gatt_descriptor_mac.h"
@@ -251,6 +252,11 @@ void BluetoothRemoteGattCharacteristicMac::DidUpdateValue(NSError* error) {
CHECK_EQ(GetCBPeripheral().state, CBPeripheralStateConnected);
// This method is called when the characteristic is read and when a
// notification is received.
+ if (error) {
+ LogNSErrorToHistogram(
+ error,
+ WebBluetoothMacOSAPIs::WEB_BLUETOOTH_MACOS_APIS_DID_UPDATE_VALUE);
+ }
if (HasPendingRead()) {
std::pair<ValueCallback, ErrorCallback> callbacks;
callbacks.swap(read_characteristic_value_callbacks_);
@@ -289,6 +295,10 @@ void BluetoothRemoteGattCharacteristicMac::UpdateValue() {
}
void BluetoothRemoteGattCharacteristicMac::DidWriteValue(NSError* error) {
+ if (error) {
+ LogNSErrorToHistogram(
+ error, WebBluetoothMacOSAPIs::WEB_BLUETOOTH_MACOS_APIS_DID_WRITE_VALUE);
+ }
// We could have called cancelPeripheralConnection, which causes
// [CBPeripheral state] to be CBPeripheralStateDisconnected, before or during
// a write without response callback so we flush all pending writes.
@@ -341,6 +351,9 @@ void BluetoothRemoteGattCharacteristicMac::DidUpdateNotificationState(
return;
}
if (error) {
+ LogNSErrorToHistogram(
+ error, WebBluetoothMacOSAPIs::
+ WEB_BLUETOOTH_MACOS_APIS_DID_UPDATE_NOTIFICATION_STATE);
BluetoothGattService::GattErrorCode error_code =
BluetoothDeviceMac::GetGattErrorCodeFromNSError(error);
VLOG(1) << *this

Powered by Google App Engine
This is Rietveld 408576698