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

Side by Side Diff: components/safe_browsing_db/v4_protocol_manager.h

Issue 1657233002: SafeBrowsing: Create a custom histogram enum for V4 GetHash results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sb-v4-4
Patch Set: Rebase 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_H_
7 7
8 // A class that implements Chrome's interface with the SafeBrowsing V4 protocol. 8 // A class that implements Chrome's interface with the SafeBrowsing V4 protocol.
9 // 9 //
10 // The V4ProtocolManager handles formatting and making requests of, and handling 10 // The V4ProtocolManager handles formatting and making requests of, and handling
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 FullHashCallback callback); 79 FullHashCallback callback);
80 80
81 // Retrieve the full hash and API metadata for a set of prefixes, and invoke 81 // Retrieve the full hash and API metadata for a set of prefixes, and invoke
82 // the callback argument when the results are retrieved. The callback may be 82 // the callback argument when the results are retrieved. The callback may be
83 // invoked synchronously. 83 // invoked synchronously.
84 virtual void GetFullHashesWithApis(const std::vector<SBPrefix>& prefixes, 84 virtual void GetFullHashesWithApis(const std::vector<SBPrefix>& prefixes,
85 FullHashCallback callback); 85 FullHashCallback callback);
86 86
87 // Enumerate failures for histogramming purposes. DO NOT CHANGE THE 87 // Enumerate failures for histogramming purposes. DO NOT CHANGE THE
88 // ORDERING OF THESE VALUES. 88 // ORDERING OF THESE VALUES.
89 // TODO(kcarattini): Use a custom v4 histogram set.
90 enum ResultType { 89 enum ResultType {
91 // 200 response code means that the server recognized the hash 90 // 200 response code means that the server recognized the hash
92 // prefix, while 204 is an empty response indicating that the 91 // prefix.
93 // server did not recognize it. 92 GET_HASH_STATUS_200 = 0,
94 GET_HASH_STATUS_200,
95 GET_HASH_STATUS_204,
96
97 // Subset of successful responses which returned no full hashes.
98 // This includes the STATUS_204 case, and the *_ERROR cases.
99 GET_HASH_FULL_HASH_EMPTY,
100
101 // Subset of successful responses for which one or more of the
102 // full hashes matched (should lead to an interstitial).
103 GET_HASH_FULL_HASH_HIT,
104
105 // Subset of successful responses which weren't empty and have no
106 // matches. It means that there was a prefix collision which was
107 // cleared up by the full hashes.
108 GET_HASH_FULL_HASH_MISS,
109 93
110 // Subset of successful responses where the response body wasn't parsable. 94 // Subset of successful responses where the response body wasn't parsable.
111 GET_HASH_PARSE_ERROR, 95 GET_HASH_PARSE_ERROR = 1,
112 96
113 // Gethash request failed (network error). 97 // Gethash request failed (network error).
114 GET_HASH_NETWORK_ERROR, 98 GET_HASH_NETWORK_ERROR = 2,
115 99
116 // Gethash request returned HTTP result code other than 200 or 204. 100 // Gethash request returned HTTP result code other than 200.
117 GET_HASH_HTTP_ERROR, 101 GET_HASH_HTTP_ERROR = 3,
118 102
119 // Gethash attempted during error backoff, no request sent. 103 // Gethash attempted during error backoff, no request sent.
120 GET_HASH_BACKOFF_ERROR, 104 GET_HASH_BACKOFF_ERROR = 4,
121 105
122 // Gethash attempted before min wait duration elapsed, no request sent. 106 // Gethash attempted before min wait duration elapsed, no request sent.
123 GET_HASH_MIN_WAIT_DURATION_ERROR, 107 GET_HASH_MIN_WAIT_DURATION_ERROR = 5,
124 108
125 // Memory space for histograms is determined by the max. ALWAYS 109 // Memory space for histograms is determined by the max. ALWAYS
126 // ADD NEW VALUES BEFORE THIS ONE. 110 // ADD NEW VALUES BEFORE THIS ONE.
127 GET_HASH_RESULT_MAX 111 GET_HASH_RESULT_MAX = 6
128 }; 112 };
129 113
130 // Record a GetHash result. 114 // Record a GetHash result.
131 static void RecordGetHashResult(ResultType result_type); 115 static void RecordGetHashResult(ResultType result_type);
132 116
133 // Record HTTP response code when there's no error in fetching an HTTP 117 // Record HTTP response code when there's no error in fetching an HTTP
134 // request, and the error code, when there is. 118 // request, and the error code, when there is.
135 // |metric_name| is the name of the UMA metric to record the response code or 119 // |metric_name| is the name of the UMA metric to record the response code or
136 // error code against, |status| represents the status of the HTTP request, and 120 // error code against, |status| represents the status of the HTTP request, and
137 // |response code| represents the HTTP response code received from the server. 121 // |response code| represents the HTTP response code received from the server.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 net::URLRequestContextGetter* request_context_getter, 250 net::URLRequestContextGetter* request_context_getter,
267 const V4ProtocolConfig& config) = 0; 251 const V4ProtocolConfig& config) = 0;
268 252
269 private: 253 private:
270 DISALLOW_COPY_AND_ASSIGN(V4ProtocolManagerFactory); 254 DISALLOW_COPY_AND_ASSIGN(V4ProtocolManagerFactory);
271 }; 255 };
272 256
273 } // namespace safe_browsing 257 } // namespace safe_browsing
274 258
275 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_H_ 259 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698