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

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

Issue 1397983004: bluetooth: Refactor repeated code used to find a Bluetooth object from its ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-characteristic-changed-1
Patch Set: Fix compile errors on bots Created 5 years, 2 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 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 22 matching lines...) Expand all
33 CHARACTERISTIC_STOP_NOTIFICATIONS = 7, 33 CHARACTERISTIC_STOP_NOTIFICATIONS = 7,
34 // NOTE: Add new actions immediately above this line. Make sure to update 34 // NOTE: Add new actions immediately above this line. Make sure to update
35 // the enum list in tools/metrics/histograms/histograms.xml accordingly. 35 // the enum list in tools/metrics/histograms/histograms.xml accordingly.
36 COUNT 36 COUNT
37 }; 37 };
38 38
39 // There should be a call to this function for every call to the Web Bluetooth 39 // There should be a call to this function for every call to the Web Bluetooth
40 // API. 40 // API.
41 void RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction function); 41 void RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction function);
42 42
43 // Enumation for outcomes of querying the bluetooth cache.
44 enum class CacheQueryOutcome {
45 SUCCESS = 0,
46 BAD_RENDERER = 1,
47 NO_DEVICE = 2,
48 NO_SERVICE = 3,
49 NO_CHARACTERISTIC = 4,
50 };
51
43 // requestDevice() Metrics 52 // requestDevice() Metrics
44 enum class UMARequestDeviceOutcome { 53 enum class UMARequestDeviceOutcome {
45 SUCCESS = 0, 54 SUCCESS = 0,
46 NO_BLUETOOTH_ADAPTER = 1, 55 NO_BLUETOOTH_ADAPTER = 1,
47 NO_RENDER_FRAME = 2, 56 NO_RENDER_FRAME = 2,
48 OBSOLETE_DISCOVERY_START_FAILED = 3, 57 OBSOLETE_DISCOVERY_START_FAILED = 3,
49 OBSOLETE_DISCOVERY_STOP_FAILED = 4, 58 OBSOLETE_DISCOVERY_STOP_FAILED = 4,
50 OBSOLETE_NO_MATCHING_DEVICES_FOUND = 5, 59 OBSOLETE_NO_MATCHING_DEVICES_FOUND = 5,
51 BLUETOOTH_ADAPTER_NOT_PRESENT = 6, 60 BLUETOOTH_ADAPTER_NOT_PRESENT = 6,
52 OBSOLETE_BLUETOOTH_ADAPTER_OFF = 7, 61 OBSOLETE_BLUETOOTH_ADAPTER_OFF = 7,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 UNSUPPORTED_DEVICE = 9, 96 UNSUPPORTED_DEVICE = 9,
88 // Note: Add new ConnectGATT outcomes immediately above this line. Make sure 97 // Note: Add new ConnectGATT outcomes immediately above this line. Make sure
89 // to update the enum list in tools/metrics/histograms/histograms.xml 98 // to update the enum list in tools/metrics/histograms/histograms.xml
90 // accordingly. 99 // accordingly.
91 COUNT 100 COUNT
92 }; 101 };
93 // There should be a call to this function before every 102 // There should be a call to this function before every
94 // Send(BluetoothMsg_ConnectGATTSuccess) and 103 // Send(BluetoothMsg_ConnectGATTSuccess) and
95 // Send(BluetoothMsg_ConnectGATTError). 104 // Send(BluetoothMsg_ConnectGATTError).
96 void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome); 105 void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome);
106 // Records the outcome of the cache query for connectGATT. Should only be called
107 // if QueryCacheForDevice fails.
108 void RecordConnectGATTOutcome(CacheQueryOutcome outcome);
97 // Records how long it took for the connection to succeed. 109 // Records how long it took for the connection to succeed.
98 void RecordConnectGATTTimeSuccess(const base::TimeDelta& duration); 110 void RecordConnectGATTTimeSuccess(const base::TimeDelta& duration);
99 // Records how long it took for the connection to fail. 111 // Records how long it took for the connection to fail.
100 void RecordConnectGATTTimeFailed(const base::TimeDelta& duration); 112 void RecordConnectGATTTimeFailed(const base::TimeDelta& duration);
101 113
102 // getPrimaryService() Metrics 114 // getPrimaryService() Metrics
103 enum class UMAGetPrimaryServiceOutcome { 115 enum class UMAGetPrimaryServiceOutcome {
104 SUCCESS = 0, 116 SUCCESS = 0,
105 NO_DEVICE = 1, 117 NO_DEVICE = 1,
106 NOT_FOUND = 2, 118 NOT_FOUND = 2,
107 // Note: Add new GetPrimaryService outcomes immediately above this line. 119 // Note: Add new GetPrimaryService outcomes immediately above this line.
108 // Make sure to update the enum list in 120 // Make sure to update the enum list in
109 // tools/metrics/histograms/histograms.xml accordingly. 121 // tools/metrics/histograms/histograms.xml accordingly.
110 COUNT 122 COUNT
111 }; 123 };
112 // Record the service uuid used when calling getPrimaryService. 124 // Record the service uuid used when calling getPrimaryService.
113 void RecordGetPrimaryServiceService(const device::BluetoothUUID& service); 125 void RecordGetPrimaryServiceService(const device::BluetoothUUID& service);
114 // There should be a call to this function for every call to 126 // There should be a call to this function for every call to
115 // Send(BluetoothMsg_GetPrimaryServiceSuccess) and 127 // Send(BluetoothMsg_GetPrimaryServiceSuccess) and
116 // Send(BluetoothMsg_GetPrimaryServiceError). 128 // Send(BluetoothMsg_GetPrimaryServiceError).
117 void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome); 129 void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome);
130 // Records the outcome of the cache query for getPrimaryService. Should only be
131 // called if QueryCacheForDevice fails.
132 void RecordGetPrimaryServiceOutcome(CacheQueryOutcome outcome);
118 133
119 // getCharacteristic() Metrics 134 // getCharacteristic() Metrics
120 enum class UMAGetCharacteristicOutcome { 135 enum class UMAGetCharacteristicOutcome {
121 SUCCESS = 0, 136 SUCCESS = 0,
122 NO_DEVICE = 1, 137 NO_DEVICE = 1,
123 NO_SERVICE = 2, 138 NO_SERVICE = 2,
124 NOT_FOUND = 3, 139 NOT_FOUND = 3,
125 // Note: Add new outcomes immediately above this line. 140 // Note: Add new outcomes immediately above this line.
126 // Make sure to update the enum list in 141 // Make sure to update the enum list in
127 // tools/metrisc/histogram/histograms.xml accordingly. 142 // tools/metrisc/histogram/histograms.xml accordingly.
128 COUNT 143 COUNT
129 }; 144 };
130 // There should be a call to this function for every call to 145 // There should be a call to this function for every call to
131 // Send(BluetoothMsg_GetCharacteristicSuccess) and 146 // Send(BluetoothMsg_GetCharacteristicSuccess) and
132 // Send(BluetoothMsg_GetCharacteristicError). 147 // Send(BluetoothMsg_GetCharacteristicError).
133 void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome); 148 void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome);
149 // Records the outcome of the cache query for getCharacteristic. Should only be
150 // called if QueryCacheForService fails.
151 void RecordGetCharacteristicOutcome(CacheQueryOutcome outcome);
134 // Records the UUID of the characteristic used when calling getCharacteristic. 152 // Records the UUID of the characteristic used when calling getCharacteristic.
135 void RecordGetCharacteristicCharacteristic(const std::string& characteristic); 153 void RecordGetCharacteristicCharacteristic(const std::string& characteristic);
136 154
137 // GATT Operations Metrics 155 // GATT Operations Metrics
138 156
139 // These are the possible outcomes when performing GATT operations i.e. 157 // These are the possible outcomes when performing GATT operations i.e.
140 // characteristic.readValue/writeValue descriptor.readValue/writeValue. 158 // characteristic.readValue/writeValue descriptor.readValue/writeValue.
141 enum UMAGATTOperationOutcome { 159 enum UMAGATTOperationOutcome {
142 SUCCESS = 0, 160 SUCCESS = 0,
143 NO_DEVICE = 1, 161 NO_DEVICE = 1,
(...skipping 26 matching lines...) Expand all
170 // There should be a call to this function whenever the corresponding operation 188 // There should be a call to this function whenever the corresponding operation
171 // doesn't have a call to Record[Operation]Outcome. 189 // doesn't have a call to Record[Operation]Outcome.
172 void RecordGATTOperationOutcome(UMAGATTOperation operation, 190 void RecordGATTOperationOutcome(UMAGATTOperation operation,
173 UMAGATTOperationOutcome outcome); 191 UMAGATTOperationOutcome outcome);
174 192
175 // Characteristic.readValue() Metrics 193 // Characteristic.readValue() Metrics
176 // There should be a call to this function for every call to 194 // There should be a call to this function for every call to
177 // Send(BluetoothMsg_ReadCharacteristicValueSuccess) and 195 // Send(BluetoothMsg_ReadCharacteristicValueSuccess) and
178 // Send(BluetoothMsg_ReadCharacteristicValueError). 196 // Send(BluetoothMsg_ReadCharacteristicValueError).
179 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome error); 197 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome error);
198 // Records the outcome of a cache query for readValue. Should only be called if
199 // QueryCacheForCharacteristic fails.
200 void RecordCharacteristicReadValueOutcome(CacheQueryOutcome outcome);
180 201
181 // Characteristic.writeValue() Metrics 202 // Characteristic.writeValue() Metrics
182 // There should be a call to this function for every call to 203 // There should be a call to this function for every call to
183 // Send(BluetoothMsg_WriteCharacteristicValueSuccess) and 204 // Send(BluetoothMsg_WriteCharacteristicValueSuccess) and
184 // Send(BluetoothMsg_WriteCharacteristicValueError). 205 // Send(BluetoothMsg_WriteCharacteristicValueError).
185 void RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome error); 206 void RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome error);
207 // Records the outcome of a cache query for writeValue. Should only be called if
208 // QueryCacheForCharacteristic fails.
209 void RecordCharacteristicWriteValueOutcome(CacheQueryOutcome outcome);
186 210
187 // Characteristic.startNotifications() Metrics 211 // Characteristic.startNotifications() Metrics
188 // There should be a call to this function for every call to 212 // There should be a call to this function for every call to
189 // Send(BluetoothMsg_StartNotificationsSuccess) and 213 // Send(BluetoothMsg_StartNotificationsSuccess) and
190 // Send(BluetoothMsg_StopNotificationsError). 214 // Send(BluetoothMsg_StopNotificationsError).
191 void RecordStartNotificationsOutcome(UMAGATTOperationOutcome outcome); 215 void RecordStartNotificationsOutcome(UMAGATTOperationOutcome outcome);
216 // Records the outcome of a cache query for startNotifications. Should only be
217 // called if QueryCacheForCharacteristic fails.
218 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome);
192 219
193 } // namespace content 220 } // namespace content
194 221
195 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ 222 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_dispatcher_host.cc ('k') | content/browser/bluetooth/bluetooth_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698