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

Side by Side Diff: content/browser/bluetooth/bluetooth_metrics.cc

Issue 2667053002: Add RemoteGATTDescriptor to WebBluetoothFunction histogram enum. (Closed)
Patch Set: ortuno review. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 #include "content/browser/bluetooth/bluetooth_metrics.h" 5 #include "content/browser/bluetooth/bluetooth_metrics.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 HashUUID(characteristic)); 259 HashUUID(characteristic));
260 return; 260 return;
261 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE: 261 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE:
262 UMA_HISTOGRAM_SPARSE_SLOWLY( 262 UMA_HISTOGRAM_SPARSE_SLOWLY(
263 "Bluetooth.Web.GetCharacteristics.Characteristic", 263 "Bluetooth.Web.GetCharacteristics.Characteristic",
264 HashUUID(characteristic)); 264 HashUUID(characteristic));
265 return; 265 return;
266 } 266 }
267 } 267 }
268 268
269 void RecordGetDescriptorsDescriptor(
270 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
271 const base::Optional<BluetoothUUID>& descriptor) {
272 switch (quantity) {
273 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE:
274 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetDescriptor.Descriptor",
275 HashUUID(descriptor));
276 return;
277 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE:
278 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetDescriptors.Descriptor",
279 HashUUID(descriptor));
Ilya Sherman 2017/02/11 00:18:27 Are the UUIDs whitelisted in any way? If not, is
dougt 2017/02/11 00:56:09 I do not think so. The UUIDs can be any value but
Ilya Sherman 2017/02/11 01:02:36 I'm not comfortable with recording a histogram tha
ortuno 2017/02/13 00:34:15 Making custom descriptors is quite rare and there
Ilya Sherman 2017/02/13 22:06:57 Okay, thanks for clarifying that. LGTM assuming t
280 return;
281 }
282 }
283
284 void RecordGetDescriptorsOutcome(
285 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
286 UMAGetDescriptorOutcome outcome) {
287 switch (quantity) {
288 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE:
289 UMA_HISTOGRAM_ENUMERATION(
290 "Bluetooth.Web.GetDescriptor.Outcome", static_cast<int>(outcome),
291 static_cast<int>(UMAGetDescriptorOutcome::COUNT));
292 return;
293 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE:
294 UMA_HISTOGRAM_ENUMERATION(
295 "Bluetooth.Web.GetDescriptors.Outcome", static_cast<int>(outcome),
296 static_cast<int>(UMAGetDescriptorOutcome::COUNT));
297 return;
298 }
299 }
300
301 void RecordGetDescriptorsOutcome(
302 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
303 CacheQueryOutcome outcome) {
304 switch (outcome) {
305 case CacheQueryOutcome::SUCCESS:
306 case CacheQueryOutcome::BAD_RENDERER:
307 // No need to record a success or renderer crash.
308 NOTREACHED();
309 return;
310 case CacheQueryOutcome::NO_DEVICE:
311 RecordGetDescriptorsOutcome(quantity, UMAGetDescriptorOutcome::NO_DEVICE);
312 return;
313 case CacheQueryOutcome::NO_SERVICE:
314 RecordGetDescriptorsOutcome(quantity,
315 UMAGetDescriptorOutcome::NO_SERVICE);
316 return;
317 case CacheQueryOutcome::NO_CHARACTERISTIC:
318 RecordGetDescriptorsOutcome(quantity,
319 UMAGetDescriptorOutcome::NO_CHARACTERISTIC);
320 case CacheQueryOutcome::NO_DESCRIPTOR:
321 NOTREACHED();
322 return;
323 }
324 }
325
269 // GATT Operations 326 // GATT Operations
270 327
271 void RecordGATTOperationOutcome(UMAGATTOperation operation, 328 void RecordGATTOperationOutcome(UMAGATTOperation operation,
272 UMAGATTOperationOutcome outcome) { 329 UMAGATTOperationOutcome outcome) {
273 switch (operation) { 330 switch (operation) {
274 case UMAGATTOperation::CHARACTERISTIC_READ: 331 case UMAGATTOperation::CHARACTERISTIC_READ:
275 RecordCharacteristicReadValueOutcome(outcome); 332 RecordCharacteristicReadValueOutcome(outcome);
276 return; 333 return;
277 case UMAGATTOperation::CHARACTERISTIC_WRITE: 334 case UMAGATTOperation::CHARACTERISTIC_WRITE:
278 RecordCharacteristicWriteValueOutcome(outcome); 335 RecordCharacteristicWriteValueOutcome(outcome);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) { 451 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) {
395 if (!accept_all_devices) { 452 if (!accept_all_devices) {
396 UMA_HISTOGRAM_SPARSE_SLOWLY( 453 UMA_HISTOGRAM_SPARSE_SLOWLY(
397 "Bluetooth.Web.RequestDevice." 454 "Bluetooth.Web.RequestDevice."
398 "NumOfDevicesInChooserWhenNotAcceptingAllDevices", 455 "NumOfDevicesInChooserWhenNotAcceptingAllDevices",
399 std::min(num_of_devices, kMaxNumOfDevices)); 456 std::min(num_of_devices, kMaxNumOfDevices));
400 } 457 }
401 } 458 }
402 459
403 } // namespace content 460 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698