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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Ensure that we throw a kGattServerNotConnected error if getDescriptor[s] is called while not connec… Created 4 years, 1 month 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: // TODO dft
ortuno 2016/11/21 03:34:08 TODO(crbug.com/[new bug number]): Record descripto
dougt 2016/11/22 01:47:15 Acknowledged.
267 case UMAGATTOperation::DESCRIPTOR_WRITE:
268 return;
265 case UMAGATTOperation::COUNT: 269 case UMAGATTOperation::COUNT:
266 NOTREACHED(); 270 NOTREACHED();
267 return; 271 return;
268 } 272 }
269 NOTREACHED(); 273 NOTREACHED();
270 } 274 }
271 275
272 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome( 276 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome(
273 CacheQueryOutcome outcome) { 277 CacheQueryOutcome outcome) {
274 switch (outcome) { 278 switch (outcome) {
275 case CacheQueryOutcome::SUCCESS: 279 case CacheQueryOutcome::SUCCESS:
276 case CacheQueryOutcome::BAD_RENDERER: 280 case CacheQueryOutcome::BAD_RENDERER:
277 // No need to record a success or renderer crash. 281 // No need to record a success or renderer crash.
278 NOTREACHED(); 282 NOTREACHED();
279 return UMAGATTOperationOutcome::NOT_SUPPORTED; 283 return UMAGATTOperationOutcome::NOT_SUPPORTED;
280 case CacheQueryOutcome::NO_DEVICE: 284 case CacheQueryOutcome::NO_DEVICE:
281 return UMAGATTOperationOutcome::NO_DEVICE; 285 return UMAGATTOperationOutcome::NO_DEVICE;
282 case CacheQueryOutcome::NO_SERVICE: 286 case CacheQueryOutcome::NO_SERVICE:
283 return UMAGATTOperationOutcome::NO_SERVICE; 287 return UMAGATTOperationOutcome::NO_SERVICE;
284 case CacheQueryOutcome::NO_CHARACTERISTIC: 288 case CacheQueryOutcome::NO_CHARACTERISTIC:
285 return UMAGATTOperationOutcome::NO_CHARACTERISTIC; 289 return UMAGATTOperationOutcome::NO_CHARACTERISTIC;
290 case CacheQueryOutcome::NO_DESCRIPTOR:
291 return UMAGATTOperationOutcome::NO_DESCRIPTOR;
286 } 292 }
287 NOTREACHED() << "No need to record success or renderer crash"; 293 NOTREACHED() << "No need to record success or renderer crash";
288 return UMAGATTOperationOutcome::NOT_SUPPORTED; 294 return UMAGATTOperationOutcome::NOT_SUPPORTED;
289 } 295 }
290 296
291 // Characteristic.readValue 297 // Characteristic.readValue
292 298
293 // static 299 // static
294 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) { 300 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) {
295 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome", 301 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 340 }
335 341
336 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) { 342 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) {
337 UMA_HISTOGRAM_ENUMERATION( 343 UMA_HISTOGRAM_ENUMERATION(
338 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel", 344 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel",
339 static_cast<int>(level), 345 static_cast<int>(level),
340 static_cast<int>(UMARSSISignalStrengthLevel::COUNT)); 346 static_cast<int>(UMARSSISignalStrengthLevel::COUNT));
341 } 347 }
342 348
343 } // namespace content 349 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698