Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
| 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 namespace base { | 11 namespace base { |
| 12 class TimeDelta; | 12 class TimeDelta; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace device { | 15 namespace device { |
| 16 class BluetoothUUID; | 16 class BluetoothUUID; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 struct BluetoothScanFilter; | 20 struct BluetoothScanFilter; |
| 21 | 21 |
| 22 // General Metrics | 22 // General Metrics |
| 23 | 23 |
| 24 // Enumaration of each Web Bluetooth API entry point. | 24 // Enumaration of each Web Bluetooth API entry point. |
| 25 enum class UMAWebBluetoothFunction { | 25 enum class UMAWebBluetoothFunction { |
| 26 REQUEST_DEVICE = 0, | 26 REQUEST_DEVICE = 0, |
| 27 CONNECT_GATT = 1, | 27 CONNECT_GATT = 1, |
| 28 GET_PRIMARY_SERVICE = 2, | 28 GET_PRIMARY_SERVICE = 2, |
| 29 GET_CHARACTERISTIC = 3, | 29 SERVICE_GET_CHARACTERISTIC = 3, |
| 30 CHARACTERISTIC_READ_VALUE = 4, | 30 CHARACTERISTIC_READ_VALUE = 4, |
| 31 CHARACTERISTIC_WRITE_VALUE = 5, | 31 CHARACTERISTIC_WRITE_VALUE = 5, |
| 32 CHARACTERISTIC_START_NOTIFICATIONS = 6, | 32 CHARACTERISTIC_START_NOTIFICATIONS = 6, |
| 33 CHARACTERISTIC_STOP_NOTIFICATIONS = 7, | 33 CHARACTERISTIC_STOP_NOTIFICATIONS = 7, |
| 34 REMOTE_GATT_SERVER_DISCONNECT = 8, | 34 REMOTE_GATT_SERVER_DISCONNECT = 8, |
| 35 SERVICE_GET_CHARACTERISTICS = 9, | 35 SERVICE_GET_CHARACTERISTICS = 9, |
| 36 // NOTE: Add new actions immediately above this line. Make sure to update | 36 // NOTE: Add new actions immediately above this line. Make sure to update |
| 37 // the enum list in tools/metrics/histograms/histograms.xml accordingly. | 37 // the enum list in tools/metrics/histograms/histograms.xml accordingly. |
| 38 COUNT | 38 COUNT |
| 39 }; | 39 }; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 // Record the service uuid used when calling getPrimaryService. | 140 // Record the service uuid used when calling getPrimaryService. |
| 141 void RecordGetPrimaryServiceService(const device::BluetoothUUID& service); | 141 void RecordGetPrimaryServiceService(const device::BluetoothUUID& service); |
| 142 // There should be a call to this function for every call to | 142 // There should be a call to this function for every call to |
| 143 // Send(BluetoothMsg_GetPrimaryServiceSuccess) and | 143 // Send(BluetoothMsg_GetPrimaryServiceSuccess) and |
| 144 // Send(BluetoothMsg_GetPrimaryServiceError). | 144 // Send(BluetoothMsg_GetPrimaryServiceError). |
| 145 void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome); | 145 void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome); |
| 146 // Records the outcome of the cache query for getPrimaryService. Should only be | 146 // Records the outcome of the cache query for getPrimaryService. Should only be |
| 147 // called if QueryCacheForDevice fails. | 147 // called if QueryCacheForDevice fails. |
| 148 void RecordGetPrimaryServiceOutcome(CacheQueryOutcome outcome); | 148 void RecordGetPrimaryServiceOutcome(CacheQueryOutcome outcome); |
| 149 | 149 |
| 150 // getCharacteristic() Metrics | 150 // getCharacteristic() & getCharacteristics() Metrics |
|
Jeffrey Yasskin
2016/04/22 01:16:37
nit: I'd spell out "and" since & is a C++ token.
ortuno
2016/04/25 15:29:45
Done.
| |
| 151 enum class UMAGetCharacteristicOutcome { | 151 enum class UMAGetCharacteristicOutcome { |
| 152 SUCCESS = 0, | 152 SUCCESS = 0, |
| 153 NO_DEVICE = 1, | 153 NO_DEVICE = 1, |
| 154 NO_SERVICE = 2, | 154 NO_SERVICE = 2, |
| 155 NOT_FOUND = 3, | 155 NOT_FOUND = 3, |
| 156 BLACKLISTED = 4, | 156 BLACKLISTED = 4, |
| 157 NO_CHARACTERISTICS = 5, | 157 NO_CHARACTERISTICS = 5, |
| 158 // Note: Add new outcomes immediately above this line. | 158 // Note: Add new outcomes immediately above this line. |
| 159 // Make sure to update the enum list in | 159 // Make sure to update the enum list in |
| 160 // tools/metrisc/histogram/histograms.xml accordingly. | 160 // tools/metrisc/histogram/histograms.xml accordingly. |
| 161 COUNT | 161 COUNT |
| 162 }; | 162 }; |
| 163 // There should be a call to this function for every call to | |
| 164 // Send(BluetoothMsg_GetCharacteristicSuccess) and | |
| 165 // Send(BluetoothMsg_GetCharacteristicError). | |
| 166 void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome); | |
| 167 // Records the outcome of the cache query for getCharacteristic. Should only be | |
| 168 // called if QueryCacheForService fails. | |
| 169 void RecordGetCharacteristicOutcome(CacheQueryOutcome outcome); | |
| 170 // Records the UUID of the characteristic used when calling getCharacteristic. | |
| 171 void RecordGetCharacteristicCharacteristic(const std::string& characteristic); | |
| 172 | 163 |
| 173 // getCharacteristics() Metrics | 164 // There should be a call to this function whenever |
| 174 // There should be a call to this function for every call to | 165 // RemoteServiceGetCharacteristicsCallback is run. |
| 175 // Send(BluetoothMsg_GetCharacteristicsSuccess) and | 166 // |single_characteristic| should be true for getCharacteristic calls. |
| 176 // Send(BluetoothMsg_GetCharacteristicsError). | 167 void RecordGetCharacteristicsOutcome(bool single_characteristic, |
|
Jeffrey Yasskin
2016/04/22 01:16:37
Prefer enum-classes over boolean arguments unless
ortuno
2016/04/25 15:29:45
Done.
| |
| 177 void RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome outcome); | 168 UMAGetCharacteristicOutcome outcome); |
| 178 // Records the outcome of the cache query for getCharacteristics. Should only be | 169 // Records the outcome of the cache query for getCharacteristics. Should only be |
| 179 // called if QueryCacheForService fails. | 170 // called if QueryCacheForService fails. |
| 180 void RecordGetCharacteristicsOutcome(CacheQueryOutcome outcome); | 171 void RecordGetCharacteristicsOutcome(bool single_characteristic, |
| 172 CacheQueryOutcome outcome); | |
| 181 // Records the UUID of the characteristic used when calling getCharacteristic. | 173 // Records the UUID of the characteristic used when calling getCharacteristic. |
| 182 void RecordGetCharacteristicsCharacteristic(const std::string& characteristic); | 174 void RecordGetCharacteristicsCharacteristic(bool single_characteristic, |
| 175 const std::string& characteristic); | |
| 183 | 176 |
| 184 // GATT Operations Metrics | 177 // GATT Operations Metrics |
| 185 | 178 |
| 186 // These are the possible outcomes when performing GATT operations i.e. | 179 // These are the possible outcomes when performing GATT operations i.e. |
| 187 // characteristic.readValue/writeValue descriptor.readValue/writeValue. | 180 // characteristic.readValue/writeValue descriptor.readValue/writeValue. |
| 188 enum UMAGATTOperationOutcome { | 181 enum UMAGATTOperationOutcome { |
| 189 SUCCESS = 0, | 182 SUCCESS = 0, |
| 190 NO_DEVICE = 1, | 183 NO_DEVICE = 1, |
| 191 NO_SERVICE = 2, | 184 NO_SERVICE = 2, |
| 192 NO_CHARACTERISTIC = 3, | 185 NO_CHARACTERISTIC = 3, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 // Send(BluetoothMsg_StartNotificationsSuccess) and | 236 // Send(BluetoothMsg_StartNotificationsSuccess) and |
| 244 // Send(BluetoothMsg_StopNotificationsError). | 237 // Send(BluetoothMsg_StopNotificationsError). |
| 245 void RecordStartNotificationsOutcome(UMAGATTOperationOutcome outcome); | 238 void RecordStartNotificationsOutcome(UMAGATTOperationOutcome outcome); |
| 246 // Records the outcome of a cache query for startNotifications. Should only be | 239 // Records the outcome of a cache query for startNotifications. Should only be |
| 247 // called if QueryCacheForCharacteristic fails. | 240 // called if QueryCacheForCharacteristic fails. |
| 248 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome); | 241 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome); |
| 249 | 242 |
| 250 } // namespace content | 243 } // namespace content |
| 251 | 244 |
| 252 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 245 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
| OLD | NEW |