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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp

Issue 2771893002: Move Bluetooth.Web.FunctionCall.Count UMA from browser to WebKit (Closed)
Patch Set: move Bluetooth.Web.FunctionCall.Count UMA from browser to WebKit Created 3 years, 9 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: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
index 8aca52efb5b14381215b3b9e844913c92bb47e59..3a2ceaf14bd16c66c3077c521784d53706c48ecd 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
@@ -4,6 +4,7 @@
#include "modules/bluetooth/BluetoothRemoteGATTServer.h"
+#include <utility>
#include "bindings/core/v8/CallbackPromiseAdapter.h"
#include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptPromiseResolver.h"
@@ -13,9 +14,9 @@
#include "modules/bluetooth/Bluetooth.h"
#include "modules/bluetooth/BluetoothDevice.h"
#include "modules/bluetooth/BluetoothError.h"
+#include "modules/bluetooth/BluetoothMetrics.h"
#include "modules/bluetooth/BluetoothRemoteGATTService.h"
#include "modules/bluetooth/BluetoothUUID.h"
-#include <utility>
namespace blink {
@@ -64,6 +65,8 @@ void BluetoothRemoteGATTServer::ConnectCallback(
}
ScriptPromise BluetoothRemoteGATTServer::connect(ScriptState* scriptState) {
+ RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::CONNECT_GATT);
+
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
@@ -77,6 +80,9 @@ ScriptPromise BluetoothRemoteGATTServer::connect(ScriptState* scriptState) {
}
void BluetoothRemoteGATTServer::disconnect(ScriptState* scriptState) {
+ RecordWebBluetoothFunctionCall(
+ UMAWebBluetoothFunction::REMOTE_GATT_SERVER_DISCONNECT);
+
if (!m_connected)
return;
m_device->CleanupDisconnectedDeviceAndFireEvent();
@@ -139,6 +145,8 @@ ScriptPromise BluetoothRemoteGATTServer::getPrimaryService(
ScriptState* scriptState,
const StringOrUnsignedLong& service,
ExceptionState& exceptionState) {
+ RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::GET_PRIMARY_SERVICE);
+
String serviceUUID = BluetoothUUID::getService(service, exceptionState);
if (exceptionState.hadException())
return exceptionState.reject(scriptState);
@@ -152,6 +160,8 @@ ScriptPromise BluetoothRemoteGATTServer::getPrimaryServices(
ScriptState* scriptState,
const StringOrUnsignedLong& service,
ExceptionState& exceptionState) {
+ RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::GET_PRIMARY_SERVICES);
+
String serviceUUID = BluetoothUUID::getService(service, exceptionState);
if (exceptionState.hadException())
return exceptionState.reject(scriptState);
@@ -164,6 +174,8 @@ ScriptPromise BluetoothRemoteGATTServer::getPrimaryServices(
ScriptPromise BluetoothRemoteGATTServer::getPrimaryServices(
ScriptState* scriptState,
ExceptionState&) {
+ RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::GET_PRIMARY_SERVICES);
+
return GetPrimaryServicesImpl(
scriptState, mojom::blink::WebBluetoothGATTQueryQuantity::MULTIPLE);
}

Powered by Google App Engine
This is Rietveld 408576698