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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Rebase Created 4 years 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 <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return; 224 return;
225 case CacheQueryOutcome::NO_DEVICE: 225 case CacheQueryOutcome::NO_DEVICE:
226 RecordGetCharacteristicsOutcome(quantity, 226 RecordGetCharacteristicsOutcome(quantity,
227 UMAGetCharacteristicOutcome::NO_DEVICE); 227 UMAGetCharacteristicOutcome::NO_DEVICE);
228 return; 228 return;
229 case CacheQueryOutcome::NO_SERVICE: 229 case CacheQueryOutcome::NO_SERVICE:
230 RecordGetCharacteristicsOutcome(quantity, 230 RecordGetCharacteristicsOutcome(quantity,
231 UMAGetCharacteristicOutcome::NO_SERVICE); 231 UMAGetCharacteristicOutcome::NO_SERVICE);
232 return; 232 return;
233 case CacheQueryOutcome::NO_CHARACTERISTIC: 233 case CacheQueryOutcome::NO_CHARACTERISTIC:
234 case CacheQueryOutcome::NO_DESCRIPTOR:
ortuno 2016/12/02 06:14:49 nit: Similarly here. I don't think we need these c
dougt 2016/12/02 18:31:27 Done.
234 NOTREACHED(); 235 NOTREACHED();
235 return; 236 return;
236 } 237 }
237 } 238 }
238 239
239 void RecordGetCharacteristicsCharacteristic( 240 void RecordGetCharacteristicsCharacteristic(
240 blink::mojom::WebBluetoothGATTQueryQuantity quantity, 241 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
241 const base::Optional<BluetoothUUID>& characteristic) { 242 const base::Optional<BluetoothUUID>& characteristic) {
242 switch (quantity) { 243 switch (quantity) {
243 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE: 244 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE:
(...skipping 16 matching lines...) Expand all
260 switch (operation) { 261 switch (operation) {
261 case UMAGATTOperation::CHARACTERISTIC_READ: 262 case UMAGATTOperation::CHARACTERISTIC_READ:
262 RecordCharacteristicReadValueOutcome(outcome); 263 RecordCharacteristicReadValueOutcome(outcome);
263 return; 264 return;
264 case UMAGATTOperation::CHARACTERISTIC_WRITE: 265 case UMAGATTOperation::CHARACTERISTIC_WRITE:
265 RecordCharacteristicWriteValueOutcome(outcome); 266 RecordCharacteristicWriteValueOutcome(outcome);
266 return; 267 return;
267 case UMAGATTOperation::START_NOTIFICATIONS: 268 case UMAGATTOperation::START_NOTIFICATIONS:
268 RecordStartNotificationsOutcome(outcome); 269 RecordStartNotificationsOutcome(outcome);
269 return; 270 return;
271 case UMAGATTOperation::DESCRIPTOR_READ:
272 case UMAGATTOperation::DESCRIPTOR_WRITE:
273 // TODO(crbug.com/667319): Record descriptor interactions.
274 return;
270 case UMAGATTOperation::COUNT: 275 case UMAGATTOperation::COUNT:
271 NOTREACHED(); 276 NOTREACHED();
272 return; 277 return;
273 } 278 }
274 NOTREACHED(); 279 NOTREACHED();
275 } 280 }
276 281
277 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome( 282 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome(
278 CacheQueryOutcome outcome) { 283 CacheQueryOutcome outcome) {
279 switch (outcome) { 284 switch (outcome) {
280 case CacheQueryOutcome::SUCCESS: 285 case CacheQueryOutcome::SUCCESS:
281 case CacheQueryOutcome::BAD_RENDERER: 286 case CacheQueryOutcome::BAD_RENDERER:
282 // No need to record a success or renderer crash. 287 // No need to record a success or renderer crash.
283 NOTREACHED(); 288 NOTREACHED();
284 return UMAGATTOperationOutcome::NOT_SUPPORTED; 289 return UMAGATTOperationOutcome::NOT_SUPPORTED;
285 case CacheQueryOutcome::NO_DEVICE: 290 case CacheQueryOutcome::NO_DEVICE:
286 return UMAGATTOperationOutcome::NO_DEVICE; 291 return UMAGATTOperationOutcome::NO_DEVICE;
287 case CacheQueryOutcome::NO_SERVICE: 292 case CacheQueryOutcome::NO_SERVICE:
288 return UMAGATTOperationOutcome::NO_SERVICE; 293 return UMAGATTOperationOutcome::NO_SERVICE;
289 case CacheQueryOutcome::NO_CHARACTERISTIC: 294 case CacheQueryOutcome::NO_CHARACTERISTIC:
290 return UMAGATTOperationOutcome::NO_CHARACTERISTIC; 295 return UMAGATTOperationOutcome::NO_CHARACTERISTIC;
296 case CacheQueryOutcome::NO_DESCRIPTOR:
297 return UMAGATTOperationOutcome::NO_DESCRIPTOR;
291 } 298 }
292 NOTREACHED() << "No need to record success or renderer crash"; 299 NOTREACHED() << "No need to record success or renderer crash";
293 return UMAGATTOperationOutcome::NOT_SUPPORTED; 300 return UMAGATTOperationOutcome::NOT_SUPPORTED;
294 } 301 }
295 302
296 // Characteristic.readValue 303 // Characteristic.readValue
297 304
298 // static 305 // static
299 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) { 306 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) {
300 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome", 307 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 346 }
340 347
341 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) { 348 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) {
342 UMA_HISTOGRAM_ENUMERATION( 349 UMA_HISTOGRAM_ENUMERATION(
343 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel", 350 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel",
344 static_cast<int>(level), 351 static_cast<int>(level),
345 static_cast<int>(UMARSSISignalStrengthLevel::COUNT)); 352 static_cast<int>(UMARSSISignalStrengthLevel::COUNT));
346 } 353 }
347 354
348 } // namespace content 355 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698