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

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

Issue 1265323004: bluetooth: Move histogram related code to its own file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uma-get-primary-service
Patch Set: Add static comment Created 5 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_
7
8 #include <map>
Jeffrey Yasskin 2015/08/13 21:08:38 <map> and <set> aren't used in this file.
ortuno 2015/08/13 23:04:24 Done.
9 #include <set>
10 #include <vector>
11 // #include "content/browser/bluetooth/bluetooth_dispatcher_host.h"
Jeffrey Yasskin 2015/08/13 21:08:38 Remember to delete the commented code. :)
ortuno 2015/08/13 23:04:24 Done.
12
13 namespace base {
14 class TimeDelta;
15 }
16
17 namespace device {
18 class BluetoothUUID;
19 }
20
21 namespace content {
22 struct BluetoothScanFilter;
23
24 class BluetoothMetrics {
Jeffrey Yasskin 2015/08/13 21:08:38 Don't use classes for this sort of namespace. I th
ortuno 2015/08/13 23:04:24 Done.
25 public:
26 // General
27 enum class UMAWebBluetoothFunction {
28 REQUEST_DEVICE = 0,
29 CONNECT_GATT = 1,
30 GET_PRIMARY_SERVICE = 2,
31 GET_CHARACTERISTIC = 3,
32 CHARACTERISTIC_READ_VALUE = 4,
33 CHARACTERISTIC_WRITE_VALUE = 5,
34 // NOTE: Add new actions immediately above this line. Make sure to update
35 // the enum list in tools/metrics/histograms/histograms.xml accordingly.
36 COUNT
37 };
38 static void RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction function);
39
40 // requestDevice()
41 enum class UMARequestDeviceOutcome {
42 SUCCESS = 0,
43 NO_BLUETOOTH_ADAPTER = 1,
44 NO_RENDER_FRAME = 2,
45 DISCOVERY_START_FAILED = 3,
46 DISCOVERY_STOP_FAILED = 4,
47 NO_MATCHING_DEVICES_FOUND = 5,
48 BLUETOOTH_ADAPTER_NOT_PRESENT = 6,
49 BLUETOOTH_ADAPTER_OFF = 7,
50 // NOTE: Add new requestDevice() outcomes immediately above this line. Make
51 // sure to update the enum list in
52 // tools/metrics/histograms/histograms.xml accordingly.
53 COUNT
54 };
55 static void RecordRequestDeviceOutcome(UMARequestDeviceOutcome outcome);
Jeffrey Yasskin 2015/08/13 21:08:38 I'm feeling guilty having no comments for these fu
ortuno 2015/08/13 23:04:24 Done.
56 static void RecordRequestDeviceFilters(
Jeffrey Yasskin 2015/08/13 21:08:38 Maybe combine these three into a RecordRequestDevi
ortuno 2015/08/13 23:04:24 Done.
57 const std::vector<content::BluetoothScanFilter>& filters);
58 static void RecordRequestDeviceOptionalServices(
59 const std::vector<device::BluetoothUUID>& optional_services);
60 static void RecordUnionOfServices(
61 const std::vector<content::BluetoothScanFilter>& filters,
62 const std::vector<device::BluetoothUUID>& optional_services);
63
64 // connectGATT()
65 enum class UMAConnectGATTOutcome {
66 SUCCESS = 0,
67 NO_DEVICE = 1,
68 UNKNOWN = 2,
69 IN_PROGRESS = 3,
70 FAILED = 4,
71 AUTH_FAILED = 5,
72 AUTH_CANCELED = 6,
73 AUTH_REJECTED = 7,
74 AUTH_TIMEOUT = 8,
75 UNSUPPORTED_DEVICE = 9,
76 // Note: Add new ConnectGATT outcomes immediately above this line. Make sure
77 // to update the enum list in tools/metrics/histograms/histograms.xml
78 // accordingly.
79 COUNT
80 };
81 static void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome);
82 static void RecordConnectGATTTimeSuccess(const base::TimeDelta& duration);
83 static void RecordConnectGATTTimeFailed(const base::TimeDelta& duration);
84
85 // getPrimaryService()
86 enum class UMAGetPrimaryServiceOutcome {
87 SUCCESS = 0,
88 NO_DEVICE = 1,
89 NOT_FOUND = 2,
90 // Note: Add new GetPrimaryService outcomes immediately above this line.
91 // Make sure to update the enum list in
92 // tools/metrics/histograms/histograms.xml accordingly.
93 COUNT
94 };
95 static void RecordGetPrimaryServiceService(
96 const device::BluetoothUUID& service);
97 static void RecordGetPrimaryServiceOutcome(
98 UMAGetPrimaryServiceOutcome outcome);
99
100 // read/write characteristics
101 // TODO(ortuno): For now we are just copying over the code to record these
102 // errors but a follow up CL will add a function for each operation.
103
104 // These types of errors aren't as common. We log them to understand
105 // how common they are and if we need to investigate more.
106 enum class UMAGATTError {
107 UNKNOWN = 0,
108 FAILED = 1,
109 IN_PROGRESS = 2,
110 NOT_PAIRED = 3,
111 // Note: Add new GATT Errors immediately above this line.
112 // Make sure to update the enum list in
113 // tools/metrics/histograms/histograms.xml accordingly.
114 MAX_ERROR,
115 };
116 static void RecordGATTError(UMAGATTError error);
117 };
118
119 } // namespace content
120
121 #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