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( |
144 UMA_HISTOGRAM_ENUMERATION( | 144 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
145 "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome), | 145 UMAGetCharacteristicOutcome outcome) { |
146 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); | 146 switch (quantity) { |
147 } | 147 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE: |
148 | 148 UMA_HISTOGRAM_ENUMERATION( |
149 void RecordGetCharacteristicOutcome(CacheQueryOutcome outcome) { | 149 "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome), |
150 switch (outcome) { | 150 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); |
151 case CacheQueryOutcome::SUCCESS: | |
152 case CacheQueryOutcome::BAD_RENDERER: | |
153 // No need to record a success or renderer crash. | |
154 NOTREACHED(); | |
155 return; | 151 return; |
156 case CacheQueryOutcome::NO_DEVICE: | 152 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE: |
157 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_DEVICE); | 153 UMA_HISTOGRAM_ENUMERATION( |
158 return; | 154 "Bluetooth.Web.GetCharacteristics.Outcome", static_cast<int>(outcome), |
159 case CacheQueryOutcome::NO_SERVICE: | 155 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); |
160 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_SERVICE); | |
161 return; | |
162 case CacheQueryOutcome::NO_CHARACTERISTIC: | |
163 NOTREACHED(); | |
164 return; | 156 return; |
165 } | 157 } |
166 } | 158 } |
167 | 159 |
168 void RecordGetCharacteristicCharacteristic(const std::string& characteristic) { | 160 void RecordGetCharacteristicsOutcome( |
169 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic", | 161 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
170 HashUUID(characteristic)); | 162 CacheQueryOutcome outcome) { |
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) { | 163 switch (outcome) { |
183 case CacheQueryOutcome::SUCCESS: | 164 case CacheQueryOutcome::SUCCESS: |
184 case CacheQueryOutcome::BAD_RENDERER: | 165 case CacheQueryOutcome::BAD_RENDERER: |
185 // No need to record a success or renderer crash. | 166 // No need to record a success or renderer crash. |
186 NOTREACHED(); | 167 NOTREACHED(); |
187 return; | 168 return; |
188 case CacheQueryOutcome::NO_DEVICE: | 169 case CacheQueryOutcome::NO_DEVICE: |
189 RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_DEVICE); | 170 RecordGetCharacteristicsOutcome(quantity, |
| 171 UMAGetCharacteristicOutcome::NO_DEVICE); |
190 return; | 172 return; |
191 case CacheQueryOutcome::NO_SERVICE: | 173 case CacheQueryOutcome::NO_SERVICE: |
192 RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_SERVICE); | 174 RecordGetCharacteristicsOutcome(quantity, |
| 175 UMAGetCharacteristicOutcome::NO_SERVICE); |
193 return; | 176 return; |
194 case CacheQueryOutcome::NO_CHARACTERISTIC: | 177 case CacheQueryOutcome::NO_CHARACTERISTIC: |
195 NOTREACHED(); | 178 NOTREACHED(); |
196 return; | 179 return; |
197 } | 180 } |
198 } | 181 } |
199 | 182 |
200 void RecordGetCharacteristicsCharacteristic(const std::string& characteristic) { | 183 void RecordGetCharacteristicsCharacteristic( |
201 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristics.Characteristic", | 184 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
202 HashUUID(characteristic)); | 185 const std::string& characteristic) { |
| 186 switch (quantity) { |
| 187 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE: |
| 188 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 189 "Bluetooth.Web.GetCharacteristic.Characteristic", |
| 190 HashUUID(characteristic)); |
| 191 return; |
| 192 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE: |
| 193 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 194 "Bluetooth.Web.GetCharacteristics.Characteristic", |
| 195 HashUUID(characteristic)); |
| 196 return; |
| 197 } |
203 } | 198 } |
204 | 199 |
205 // GATT Operations | 200 // GATT Operations |
206 | 201 |
207 void RecordGATTOperationOutcome(UMAGATTOperation operation, | 202 void RecordGATTOperationOutcome(UMAGATTOperation operation, |
208 UMAGATTOperationOutcome outcome) { | 203 UMAGATTOperationOutcome outcome) { |
209 switch (operation) { | 204 switch (operation) { |
210 case UMAGATTOperation::CHARACTERISTIC_READ: | 205 case UMAGATTOperation::CHARACTERISTIC_READ: |
211 RecordCharacteristicReadValueOutcome(outcome); | 206 RecordCharacteristicReadValueOutcome(outcome); |
212 return; | 207 return; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 static_cast<int>(outcome), | 271 static_cast<int>(outcome), |
277 static_cast<int>(UMAGATTOperationOutcome::COUNT)); | 272 static_cast<int>(UMAGATTOperationOutcome::COUNT)); |
278 } | 273 } |
279 | 274 |
280 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { | 275 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { |
281 RecordStartNotificationsOutcome( | 276 RecordStartNotificationsOutcome( |
282 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); | 277 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); |
283 } | 278 } |
284 | 279 |
285 } // namespace content | 280 } // namespace content |
OLD | NEW |