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

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

Issue 2637343002: Implement WebBluetooth descriptor.readValue() (Closed)
Patch Set: run bad_message_reasons Created 3 years, 11 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return; 236 return;
237 case CacheQueryOutcome::NO_DEVICE: 237 case CacheQueryOutcome::NO_DEVICE:
238 RecordGetCharacteristicsOutcome(quantity, 238 RecordGetCharacteristicsOutcome(quantity,
239 UMAGetCharacteristicOutcome::NO_DEVICE); 239 UMAGetCharacteristicOutcome::NO_DEVICE);
240 return; 240 return;
241 case CacheQueryOutcome::NO_SERVICE: 241 case CacheQueryOutcome::NO_SERVICE:
242 RecordGetCharacteristicsOutcome(quantity, 242 RecordGetCharacteristicsOutcome(quantity,
243 UMAGetCharacteristicOutcome::NO_SERVICE); 243 UMAGetCharacteristicOutcome::NO_SERVICE);
244 return; 244 return;
245 case CacheQueryOutcome::NO_CHARACTERISTIC: 245 case CacheQueryOutcome::NO_CHARACTERISTIC:
246 case CacheQueryOutcome::NO_DESCRIPTOR:
246 NOTREACHED(); 247 NOTREACHED();
247 return; 248 return;
248 } 249 }
249 } 250 }
250 251
251 void RecordGetCharacteristicsCharacteristic( 252 void RecordGetCharacteristicsCharacteristic(
252 blink::mojom::WebBluetoothGATTQueryQuantity quantity, 253 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
253 const base::Optional<BluetoothUUID>& characteristic) { 254 const base::Optional<BluetoothUUID>& characteristic) {
254 switch (quantity) { 255 switch (quantity) {
255 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE: 256 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE:
(...skipping 16 matching lines...) Expand all
272 switch (operation) { 273 switch (operation) {
273 case UMAGATTOperation::CHARACTERISTIC_READ: 274 case UMAGATTOperation::CHARACTERISTIC_READ:
274 RecordCharacteristicReadValueOutcome(outcome); 275 RecordCharacteristicReadValueOutcome(outcome);
275 return; 276 return;
276 case UMAGATTOperation::CHARACTERISTIC_WRITE: 277 case UMAGATTOperation::CHARACTERISTIC_WRITE:
277 RecordCharacteristicWriteValueOutcome(outcome); 278 RecordCharacteristicWriteValueOutcome(outcome);
278 return; 279 return;
279 case UMAGATTOperation::START_NOTIFICATIONS: 280 case UMAGATTOperation::START_NOTIFICATIONS:
280 RecordStartNotificationsOutcome(outcome); 281 RecordStartNotificationsOutcome(outcome);
281 return; 282 return;
283 case UMAGATTOperation::DESCRIPTOR_READ:
284 // TODO(667319) Add reporting to descriptors
285 return;
282 case UMAGATTOperation::COUNT: 286 case UMAGATTOperation::COUNT:
283 NOTREACHED(); 287 NOTREACHED();
284 return; 288 return;
285 } 289 }
286 NOTREACHED(); 290 NOTREACHED();
287 } 291 }
288 292
289 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome( 293 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome(
290 CacheQueryOutcome outcome) { 294 CacheQueryOutcome outcome) {
291 switch (outcome) { 295 switch (outcome) {
292 case CacheQueryOutcome::SUCCESS: 296 case CacheQueryOutcome::SUCCESS:
293 case CacheQueryOutcome::BAD_RENDERER: 297 case CacheQueryOutcome::BAD_RENDERER:
294 // No need to record a success or renderer crash. 298 // No need to record a success or renderer crash.
295 NOTREACHED(); 299 NOTREACHED();
296 return UMAGATTOperationOutcome::NOT_SUPPORTED; 300 return UMAGATTOperationOutcome::NOT_SUPPORTED;
297 case CacheQueryOutcome::NO_DEVICE: 301 case CacheQueryOutcome::NO_DEVICE:
298 return UMAGATTOperationOutcome::NO_DEVICE; 302 return UMAGATTOperationOutcome::NO_DEVICE;
299 case CacheQueryOutcome::NO_SERVICE: 303 case CacheQueryOutcome::NO_SERVICE:
300 return UMAGATTOperationOutcome::NO_SERVICE; 304 return UMAGATTOperationOutcome::NO_SERVICE;
301 case CacheQueryOutcome::NO_CHARACTERISTIC: 305 case CacheQueryOutcome::NO_CHARACTERISTIC:
302 return UMAGATTOperationOutcome::NO_CHARACTERISTIC; 306 return UMAGATTOperationOutcome::NO_CHARACTERISTIC;
307 case CacheQueryOutcome::NO_DESCRIPTOR:
308 return UMAGATTOperationOutcome::NO_DESCRIPTOR;
303 } 309 }
304 NOTREACHED() << "No need to record success or renderer crash"; 310 NOTREACHED() << "No need to record success or renderer crash";
305 return UMAGATTOperationOutcome::NOT_SUPPORTED; 311 return UMAGATTOperationOutcome::NOT_SUPPORTED;
306 } 312 }
307 313
308 // Characteristic.readValue 314 // Characteristic.readValue
309 315
310 // static 316 // static
311 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) { 317 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) {
312 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome", 318 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome",
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) { 366 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) {
361 if (!accept_all_devices) { 367 if (!accept_all_devices) {
362 UMA_HISTOGRAM_SPARSE_SLOWLY( 368 UMA_HISTOGRAM_SPARSE_SLOWLY(
363 "Bluetooth.Web.RequestDevice." 369 "Bluetooth.Web.RequestDevice."
364 "NumOfDevicesInChooserWhenNotAcceptingAllDevices", 370 "NumOfDevicesInChooserWhenNotAcceptingAllDevices",
365 std::min(num_of_devices, kMaxNumOfDevices)); 371 std::min(num_of_devices, kMaxNumOfDevices));
366 } 372 }
367 } 373 }
368 374
369 } // namespace content 375 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_metrics.h ('k') | content/browser/bluetooth/web_bluetooth_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698