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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Addressing code review comments from ortuno (still working on test changes) 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return; 219 return;
220 case CacheQueryOutcome::NO_DEVICE: 220 case CacheQueryOutcome::NO_DEVICE:
221 RecordGetCharacteristicsOutcome(quantity, 221 RecordGetCharacteristicsOutcome(quantity,
222 UMAGetCharacteristicOutcome::NO_DEVICE); 222 UMAGetCharacteristicOutcome::NO_DEVICE);
223 return; 223 return;
224 case CacheQueryOutcome::NO_SERVICE: 224 case CacheQueryOutcome::NO_SERVICE:
225 RecordGetCharacteristicsOutcome(quantity, 225 RecordGetCharacteristicsOutcome(quantity,
226 UMAGetCharacteristicOutcome::NO_SERVICE); 226 UMAGetCharacteristicOutcome::NO_SERVICE);
227 return; 227 return;
228 case CacheQueryOutcome::NO_CHARACTERISTIC: 228 case CacheQueryOutcome::NO_CHARACTERISTIC:
229 case CacheQueryOutcome::NO_DESCRIPTOR:
229 NOTREACHED(); 230 NOTREACHED();
230 return; 231 return;
231 } 232 }
232 } 233 }
233 234
234 void RecordGetCharacteristicsCharacteristic( 235 void RecordGetCharacteristicsCharacteristic(
235 blink::mojom::WebBluetoothGATTQueryQuantity quantity, 236 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
236 const base::Optional<BluetoothUUID>& characteristic) { 237 const base::Optional<BluetoothUUID>& characteristic) {
237 switch (quantity) { 238 switch (quantity) {
238 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE: 239 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE:
(...skipping 16 matching lines...) Expand all
255 switch (operation) { 256 switch (operation) {
256 case UMAGATTOperation::CHARACTERISTIC_READ: 257 case UMAGATTOperation::CHARACTERISTIC_READ:
257 RecordCharacteristicReadValueOutcome(outcome); 258 RecordCharacteristicReadValueOutcome(outcome);
258 return; 259 return;
259 case UMAGATTOperation::CHARACTERISTIC_WRITE: 260 case UMAGATTOperation::CHARACTERISTIC_WRITE:
260 RecordCharacteristicWriteValueOutcome(outcome); 261 RecordCharacteristicWriteValueOutcome(outcome);
261 return; 262 return;
262 case UMAGATTOperation::START_NOTIFICATIONS: 263 case UMAGATTOperation::START_NOTIFICATIONS:
263 RecordStartNotificationsOutcome(outcome); 264 RecordStartNotificationsOutcome(outcome);
264 return; 265 return;
266 case UMAGATTOperation::DESCRIPTOR_READ:
267 case UMAGATTOperation::DESCRIPTOR_WRITE:
268 // TODO(crbug.com/667319): Record descriptor interactions.
269 return;
265 case UMAGATTOperation::COUNT: 270 case UMAGATTOperation::COUNT:
266 NOTREACHED(); 271 NOTREACHED();
267 return; 272 return;
268 } 273 }
269 NOTREACHED(); 274 NOTREACHED();
270 } 275 }
271 276
272 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome( 277 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome(
273 CacheQueryOutcome outcome) { 278 CacheQueryOutcome outcome) {
274 switch (outcome) { 279 switch (outcome) {
275 case CacheQueryOutcome::SUCCESS: 280 case CacheQueryOutcome::SUCCESS:
276 case CacheQueryOutcome::BAD_RENDERER: 281 case CacheQueryOutcome::BAD_RENDERER:
277 // No need to record a success or renderer crash. 282 // No need to record a success or renderer crash.
278 NOTREACHED(); 283 NOTREACHED();
279 return UMAGATTOperationOutcome::NOT_SUPPORTED; 284 return UMAGATTOperationOutcome::NOT_SUPPORTED;
280 case CacheQueryOutcome::NO_DEVICE: 285 case CacheQueryOutcome::NO_DEVICE:
281 return UMAGATTOperationOutcome::NO_DEVICE; 286 return UMAGATTOperationOutcome::NO_DEVICE;
282 case CacheQueryOutcome::NO_SERVICE: 287 case CacheQueryOutcome::NO_SERVICE:
283 return UMAGATTOperationOutcome::NO_SERVICE; 288 return UMAGATTOperationOutcome::NO_SERVICE;
284 case CacheQueryOutcome::NO_CHARACTERISTIC: 289 case CacheQueryOutcome::NO_CHARACTERISTIC:
285 return UMAGATTOperationOutcome::NO_CHARACTERISTIC; 290 return UMAGATTOperationOutcome::NO_CHARACTERISTIC;
291 case CacheQueryOutcome::NO_DESCRIPTOR:
292 return UMAGATTOperationOutcome::NO_DESCRIPTOR;
286 } 293 }
287 NOTREACHED() << "No need to record success or renderer crash"; 294 NOTREACHED() << "No need to record success or renderer crash";
288 return UMAGATTOperationOutcome::NOT_SUPPORTED; 295 return UMAGATTOperationOutcome::NOT_SUPPORTED;
289 } 296 }
290 297
291 // Characteristic.readValue 298 // Characteristic.readValue
292 299
293 // static 300 // static
294 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) { 301 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) {
295 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome", 302 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 341 }
335 342
336 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) { 343 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) {
337 UMA_HISTOGRAM_ENUMERATION( 344 UMA_HISTOGRAM_ENUMERATION(
338 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel", 345 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel",
339 static_cast<int>(level), 346 static_cast<int>(level),
340 static_cast<int>(UMARSSISignalStrengthLevel::COUNT)); 347 static_cast<int>(UMARSSISignalStrengthLevel::COUNT));
341 } 348 }
342 349
343 } // namespace content 350 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698