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