Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp |
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp |
index 1c386003578feff3e054182e966c08b99d9f42e7..5e630e58fb14fa55beeda90bab8baebc49af6dde 100644 |
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp |
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp |
@@ -4,6 +4,8 @@ |
#include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" |
+#include <memory> |
+#include <utility> |
#include "bindings/core/v8/ScriptPromise.h" |
#include "bindings/core/v8/ScriptPromiseResolver.h" |
#include "core/dom/DOMException.h" |
@@ -13,14 +15,12 @@ |
#include "modules/bluetooth/BluetoothCharacteristicProperties.h" |
#include "modules/bluetooth/BluetoothDevice.h" |
#include "modules/bluetooth/BluetoothError.h" |
+#include "modules/bluetooth/BluetoothMetrics.h" |
#include "modules/bluetooth/BluetoothRemoteGATTDescriptor.h" |
#include "modules/bluetooth/BluetoothRemoteGATTService.h" |
#include "modules/bluetooth/BluetoothRemoteGATTUtils.h" |
#include "modules/bluetooth/BluetoothUUID.h" |
-#include <memory> |
-#include <utility> |
- |
namespace blink { |
BluetoothRemoteGATTCharacteristic::BluetoothRemoteGATTCharacteristic( |
@@ -124,6 +124,9 @@ void BluetoothRemoteGATTCharacteristic::ReadValueCallback( |
ScriptPromise BluetoothRemoteGATTCharacteristic::readValue( |
ScriptState* scriptState) { |
+ RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::CHARACTERISTIC_READ_VALUE); |
+ |
if (!GetGatt()->connected()) { |
return ScriptPromise::rejectWithDOMException( |
scriptState, |
@@ -176,6 +179,9 @@ void BluetoothRemoteGATTCharacteristic::WriteValueCallback( |
ScriptPromise BluetoothRemoteGATTCharacteristic::writeValue( |
ScriptState* scriptState, |
const DOMArrayPiece& value) { |
+ RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::CHARACTERISTIC_WRITE_VALUE); |
+ |
if (!GetGatt()->connected()) { |
return ScriptPromise::rejectWithDOMException( |
scriptState, |
@@ -240,6 +246,9 @@ void BluetoothRemoteGATTCharacteristic::NotificationsCallback( |
ScriptPromise BluetoothRemoteGATTCharacteristic::startNotifications( |
ScriptState* scriptState) { |
+ RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::CHARACTERISTIC_START_NOTIFICATIONS); |
+ |
if (!GetGatt()->connected()) { |
return ScriptPromise::rejectWithDOMException( |
scriptState, |
@@ -268,6 +277,9 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::startNotifications( |
ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications( |
ScriptState* scriptState) { |
+ RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::CHARACTERISTIC_STOP_NOTIFICATIONS); |
+ |
if (!GetGatt()->connected()) { |
return ScriptPromise::rejectWithDOMException( |
scriptState, |
@@ -298,6 +310,9 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::getDescriptor( |
ScriptState* scriptState, |
const StringOrUnsignedLong& descriptorUUID, |
ExceptionState& exceptionState) { |
+ RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::CHARACTERISTIC_GET_DESCRIPTOR); |
+ |
String descriptor = |
BluetoothUUID::getDescriptor(descriptorUUID, exceptionState); |
if (exceptionState.hadException()) |
@@ -311,6 +326,9 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::getDescriptor( |
ScriptPromise BluetoothRemoteGATTCharacteristic::getDescriptors( |
ScriptState* scriptState, |
ExceptionState&) { |
+ RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::CHARACTERISTIC_GET_DESCRIPTORS); |
+ |
return GetDescriptorsImpl( |
scriptState, mojom::blink::WebBluetoothGATTQueryQuantity::MULTIPLE); |
} |
@@ -319,6 +337,9 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::getDescriptors( |
ScriptState* scriptState, |
const StringOrUnsignedLong& descriptorUUID, |
ExceptionState& exceptionState) { |
+ RecordWebBluetoothFunctionCall( |
+ UMAWebBluetoothFunction::CHARACTERISTIC_GET_DESCRIPTORS); |
+ |
String descriptor = |
BluetoothUUID::getDescriptor(descriptorUUID, exceptionState); |
if (exceptionState.hadException()) |