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

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

Issue 1723723002: bluetooth: Implement Service.getCharacteristics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Merge with ToT Created 4 years, 10 months 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome) { 143 void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome) {
144 UMA_HISTOGRAM_ENUMERATION( 144 UMA_HISTOGRAM_ENUMERATION(
145 "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome), 145 "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome),
146 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); 146 static_cast<int>(UMAGetCharacteristicOutcome::COUNT));
147 } 147 }
148 148
149 void RecordGetCharacteristicOutcome(CacheQueryOutcome outcome) { 149 void RecordGetCharacteristicOutcome(CacheQueryOutcome outcome) {
150 switch (outcome) { 150 switch (outcome) {
151 case CacheQueryOutcome::SUCCESS: 151 case CacheQueryOutcome::SUCCESS:
152 case CacheQueryOutcome::BAD_RENDERER: 152 case CacheQueryOutcome::BAD_RENDERER:
153 NOTREACHED() << "No need to record a success or renderer crash"; 153 // No need to record a success or renderer crash.
154 NOTREACHED();
154 return; 155 return;
155 case CacheQueryOutcome::NO_DEVICE: 156 case CacheQueryOutcome::NO_DEVICE:
156 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_DEVICE); 157 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_DEVICE);
157 return; 158 return;
158 case CacheQueryOutcome::NO_SERVICE: 159 case CacheQueryOutcome::NO_SERVICE:
159 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_SERVICE); 160 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_SERVICE);
160 return; 161 return;
161 case CacheQueryOutcome::NO_CHARACTERISTIC: 162 case CacheQueryOutcome::NO_CHARACTERISTIC:
162 NOTREACHED(); 163 NOTREACHED();
163 return; 164 return;
164 } 165 }
165 } 166 }
166 167
167 void RecordGetCharacteristicCharacteristic(const std::string& characteristic) { 168 void RecordGetCharacteristicCharacteristic(const std::string& characteristic) {
168 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic", 169 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic",
169 HashUUID(characteristic)); 170 HashUUID(characteristic));
170 } 171 }
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.
186 NOTREACHED();
187 return;
188 case CacheQueryOutcome::NO_DEVICE:
189 RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_DEVICE);
190 return;
191 case CacheQueryOutcome::NO_SERVICE:
192 RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_SERVICE);
193 return;
194 case CacheQueryOutcome::NO_CHARACTERISTIC:
195 NOTREACHED();
196 return;
197 }
198 }
199
200 void RecordGetCharacteristicsCharacteristic(const std::string& characteristic) {
201 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristics.Characteristic",
202 HashUUID(characteristic));
203 }
204
172 // GATT Operations 205 // GATT Operations
173 206
174 void RecordGATTOperationOutcome(UMAGATTOperation operation, 207 void RecordGATTOperationOutcome(UMAGATTOperation operation,
175 UMAGATTOperationOutcome outcome) { 208 UMAGATTOperationOutcome outcome) {
176 switch (operation) { 209 switch (operation) {
177 case UMAGATTOperation::CHARACTERISTIC_READ: 210 case UMAGATTOperation::CHARACTERISTIC_READ:
178 RecordCharacteristicReadValueOutcome(outcome); 211 RecordCharacteristicReadValueOutcome(outcome);
179 return; 212 return;
180 case UMAGATTOperation::CHARACTERISTIC_WRITE: 213 case UMAGATTOperation::CHARACTERISTIC_WRITE:
181 RecordCharacteristicWriteValueOutcome(outcome); 214 RecordCharacteristicWriteValueOutcome(outcome);
182 return; 215 return;
183 case UMAGATTOperation::START_NOTIFICATIONS: 216 case UMAGATTOperation::START_NOTIFICATIONS:
184 RecordStartNotificationsOutcome(outcome); 217 RecordStartNotificationsOutcome(outcome);
185 return; 218 return;
186 case UMAGATTOperation::COUNT: 219 case UMAGATTOperation::COUNT:
187 NOTREACHED(); 220 NOTREACHED();
188 return; 221 return;
189 } 222 }
190 NOTREACHED(); 223 NOTREACHED();
191 } 224 }
192 225
193 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome( 226 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome(
194 CacheQueryOutcome outcome) { 227 CacheQueryOutcome outcome) {
195 switch (outcome) { 228 switch (outcome) {
196 case CacheQueryOutcome::SUCCESS: 229 case CacheQueryOutcome::SUCCESS:
197 case CacheQueryOutcome::BAD_RENDERER: 230 case CacheQueryOutcome::BAD_RENDERER:
198 NOTREACHED() << "No need to record success or renderer crash"; 231 // No need to record a success or renderer crash.
232 NOTREACHED();
199 return UMAGATTOperationOutcome::NOT_SUPPORTED; 233 return UMAGATTOperationOutcome::NOT_SUPPORTED;
200 case CacheQueryOutcome::NO_DEVICE: 234 case CacheQueryOutcome::NO_DEVICE:
201 return UMAGATTOperationOutcome::NO_DEVICE; 235 return UMAGATTOperationOutcome::NO_DEVICE;
202 case CacheQueryOutcome::NO_SERVICE: 236 case CacheQueryOutcome::NO_SERVICE:
203 return UMAGATTOperationOutcome::NO_SERVICE; 237 return UMAGATTOperationOutcome::NO_SERVICE;
204 case CacheQueryOutcome::NO_CHARACTERISTIC: 238 case CacheQueryOutcome::NO_CHARACTERISTIC:
205 return UMAGATTOperationOutcome::NO_CHARACTERISTIC; 239 return UMAGATTOperationOutcome::NO_CHARACTERISTIC;
206 } 240 }
207 NOTREACHED() << "No need to record success or renderer crash"; 241 NOTREACHED() << "No need to record success or renderer crash";
208 return UMAGATTOperationOutcome::NOT_SUPPORTED; 242 return UMAGATTOperationOutcome::NOT_SUPPORTED;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 static_cast<int>(outcome), 276 static_cast<int>(outcome),
243 static_cast<int>(UMAGATTOperationOutcome::COUNT)); 277 static_cast<int>(UMAGATTOperationOutcome::COUNT));
244 } 278 }
245 279
246 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { 280 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) {
247 RecordStartNotificationsOutcome( 281 RecordStartNotificationsOutcome(
248 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); 282 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome));
249 } 283 }
250 284
251 } // namespace content 285 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_metrics.h ('k') | content/common/bluetooth/bluetooth_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698