| OLD | NEW |
| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 UMA_HISTOGRAM_ENUMERATION( | 131 UMA_HISTOGRAM_ENUMERATION( |
| 132 "Bluetooth.Web.GetPrimaryService.Outcome", static_cast<int>(outcome), | 132 "Bluetooth.Web.GetPrimaryService.Outcome", static_cast<int>(outcome), |
| 133 static_cast<int>(UMAGetPrimaryServiceOutcome::COUNT)); | 133 static_cast<int>(UMAGetPrimaryServiceOutcome::COUNT)); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void RecordGetPrimaryServiceOutcome(CacheQueryOutcome outcome) { | 136 void RecordGetPrimaryServiceOutcome(CacheQueryOutcome outcome) { |
| 137 DCHECK(outcome == CacheQueryOutcome::NO_DEVICE); | 137 DCHECK(outcome == CacheQueryOutcome::NO_DEVICE); |
| 138 RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::NO_DEVICE); | 138 RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::NO_DEVICE); |
| 139 } | 139 } |
| 140 | 140 |
| 141 // getCharacteristic | 141 // getCharacteristic & getCharacteristics |
| 142 | 142 |
| 143 void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome) { | 143 void RecordGetCharacteristicsOutcome(bool single_characteristic, |
| 144 UMA_HISTOGRAM_ENUMERATION( | 144 UMAGetCharacteristicOutcome outcome) { |
| 145 "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome), | 145 if (single_characteristic) { |
| 146 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); | 146 UMA_HISTOGRAM_ENUMERATION( |
| 147 "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome), |
| 148 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); |
| 149 } else { |
| 150 UMA_HISTOGRAM_ENUMERATION( |
| 151 "Bluetooth.Web.GetCharacteristics.Outcome", static_cast<int>(outcome), |
| 152 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); |
| 153 } |
| 147 } | 154 } |
| 148 | 155 |
| 149 void RecordGetCharacteristicOutcome(CacheQueryOutcome outcome) { | 156 void RecordGetCharacteristicsOutcome(bool single_characteristic, |
| 157 CacheQueryOutcome outcome) { |
| 150 switch (outcome) { | 158 switch (outcome) { |
| 151 case CacheQueryOutcome::SUCCESS: | 159 case CacheQueryOutcome::SUCCESS: |
| 152 case CacheQueryOutcome::BAD_RENDERER: | 160 case CacheQueryOutcome::BAD_RENDERER: |
| 153 // No need to record a success or renderer crash. | |
| 154 NOTREACHED(); | |
| 155 return; | |
| 156 case CacheQueryOutcome::NO_DEVICE: | |
| 157 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_DEVICE); | |
| 158 return; | |
| 159 case CacheQueryOutcome::NO_SERVICE: | |
| 160 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_SERVICE); | |
| 161 return; | |
| 162 case CacheQueryOutcome::NO_CHARACTERISTIC: | |
| 163 NOTREACHED(); | |
| 164 return; | |
| 165 } | |
| 166 } | |
| 167 | |
| 168 void RecordGetCharacteristicCharacteristic(const std::string& characteristic) { | |
| 169 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic", | |
| 170 HashUUID(characteristic)); | |
| 171 } | |
| 172 | |
| 173 // getCharacteristics | |
| 174 | |
| 175 void RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome outcome) { | |
| 176 UMA_HISTOGRAM_ENUMERATION( | |
| 177 "Bluetooth.Web.GetCharacteristics.Outcome", static_cast<int>(outcome), | |
| 178 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); | |
| 179 } | |
| 180 | |
| 181 void RecordGetCharacteristicsOutcome(CacheQueryOutcome outcome) { | |
| 182 switch (outcome) { | |
| 183 case CacheQueryOutcome::SUCCESS: | |
| 184 case CacheQueryOutcome::BAD_RENDERER: | |
| 185 // No need to record a success or renderer crash. | 161 // No need to record a success or renderer crash. |
| 186 NOTREACHED(); | 162 NOTREACHED(); |
| 187 return; | 163 return; |
| 188 case CacheQueryOutcome::NO_DEVICE: | 164 case CacheQueryOutcome::NO_DEVICE: |
| 189 RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_DEVICE); | 165 RecordGetCharacteristicsOutcome(single_characteristic, |
| 166 UMAGetCharacteristicOutcome::NO_DEVICE); |
| 190 return; | 167 return; |
| 191 case CacheQueryOutcome::NO_SERVICE: | 168 case CacheQueryOutcome::NO_SERVICE: |
| 192 RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_SERVICE); | 169 RecordGetCharacteristicsOutcome(single_characteristic, |
| 170 UMAGetCharacteristicOutcome::NO_SERVICE); |
| 193 return; | 171 return; |
| 194 case CacheQueryOutcome::NO_CHARACTERISTIC: | 172 case CacheQueryOutcome::NO_CHARACTERISTIC: |
| 195 NOTREACHED(); | 173 NOTREACHED(); |
| 196 return; | 174 return; |
| 197 } | 175 } |
| 198 } | 176 } |
| 199 | 177 |
| 200 void RecordGetCharacteristicsCharacteristic(const std::string& characteristic) { | 178 void RecordGetCharacteristicsCharacteristic(bool single_characteristic, |
| 201 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristics.Characteristic", | 179 const std::string& characteristic) { |
| 202 HashUUID(characteristic)); | 180 if (single_characteristic) { |
| 181 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 182 "Bluetooth.Web.GetCharacteristic.Characteristic", |
| 183 HashUUID(characteristic)); |
| 184 } else { |
| 185 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 186 "Bluetooth.Web.GetCharacteristics.Characteristic", |
| 187 HashUUID(characteristic)); |
| 188 } |
| 203 } | 189 } |
| 204 | 190 |
| 205 // GATT Operations | 191 // GATT Operations |
| 206 | 192 |
| 207 void RecordGATTOperationOutcome(UMAGATTOperation operation, | 193 void RecordGATTOperationOutcome(UMAGATTOperation operation, |
| 208 UMAGATTOperationOutcome outcome) { | 194 UMAGATTOperationOutcome outcome) { |
| 209 switch (operation) { | 195 switch (operation) { |
| 210 case UMAGATTOperation::CHARACTERISTIC_READ: | 196 case UMAGATTOperation::CHARACTERISTIC_READ: |
| 211 RecordCharacteristicReadValueOutcome(outcome); | 197 RecordCharacteristicReadValueOutcome(outcome); |
| 212 return; | 198 return; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 static_cast<int>(outcome), | 262 static_cast<int>(outcome), |
| 277 static_cast<int>(UMAGATTOperationOutcome::COUNT)); | 263 static_cast<int>(UMAGATTOperationOutcome::COUNT)); |
| 278 } | 264 } |
| 279 | 265 |
| 280 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { | 266 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { |
| 281 RecordStartNotificationsOutcome( | 267 RecordStartNotificationsOutcome( |
| 282 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); | 268 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); |
| 283 } | 269 } |
| 284 | 270 |
| 285 } // namespace content | 271 } // namespace content |
| OLD | NEW |