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

Side by Side Diff: components/domain_reliability/quic_error_mapping.cc

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 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
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 #include "components/domain_reliability/quic_error_mapping.h" 5 #include "components/domain_reliability/quic_error_mapping.h"
6 6
7 namespace domain_reliability { 7 namespace domain_reliability {
8 8
9 namespace { 9 namespace {
10 10
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 "quic.connection_migration_non_migratable_stream" }, 235 "quic.connection_migration_non_migratable_stream" },
236 // Stream frame overlaps with buffered data. 236 // Stream frame overlaps with buffered data.
237 { net::QUIC_OVERLAPPING_STREAM_DATA, 237 { net::QUIC_OVERLAPPING_STREAM_DATA,
238 "quic.overlapping_stream_data" }, 238 "quic.overlapping_stream_data" },
239 239
240 // No error. Used as bound while iterating. 240 // No error. Used as bound while iterating.
241 { net::QUIC_LAST_ERROR, "quic.last_error"} 241 { net::QUIC_LAST_ERROR, "quic.last_error"}
242 }; 242 };
243 243
244 // Must be updated any time a net::QuicErrorCode is deprecated in 244 // Must be updated any time a net::QuicErrorCode is deprecated in
245 // net/quic/quic_protocol.h. 245 // net/quic/core/quic_protocol.h.
246 const int kDeprecatedQuicErrorCount = 4; 246 const int kDeprecatedQuicErrorCount = 4;
247 const int kActiveQuicErrorCount = 247 const int kActiveQuicErrorCount =
248 net::QUIC_LAST_ERROR - kDeprecatedQuicErrorCount; 248 net::QUIC_LAST_ERROR - kDeprecatedQuicErrorCount;
249 249
250 static_assert(arraysize(kQuicErrorMap) == kActiveQuicErrorCount, 250 static_assert(arraysize(kQuicErrorMap) == kActiveQuicErrorCount,
251 "quic_error_map is not in sync with quic protocol!"); 251 "quic_error_map is not in sync with quic protocol!");
252 252
253 } // namespace 253 } // namespace
254 254
255 // static 255 // static
256 bool GetDomainReliabilityBeaconQuicError(net::QuicErrorCode quic_error, 256 bool GetDomainReliabilityBeaconQuicError(net::QuicErrorCode quic_error,
257 std::string* beacon_quic_error_out) { 257 std::string* beacon_quic_error_out) {
258 if (quic_error != net::QUIC_NO_ERROR) { 258 if (quic_error != net::QUIC_NO_ERROR) {
259 // Convert a QUIC error. 259 // Convert a QUIC error.
260 // TODO(juliatuttle): Consider sorting and using binary search? 260 // TODO(juliatuttle): Consider sorting and using binary search?
261 for (size_t i = 0; i < arraysize(kQuicErrorMap); i++) { 261 for (size_t i = 0; i < arraysize(kQuicErrorMap); i++) {
262 if (kQuicErrorMap[i].quic_error == quic_error) { 262 if (kQuicErrorMap[i].quic_error == quic_error) {
263 *beacon_quic_error_out = kQuicErrorMap[i].beacon_quic_error; 263 *beacon_quic_error_out = kQuicErrorMap[i].beacon_quic_error;
264 return true; 264 return true;
265 } 265 }
266 } 266 }
267 } 267 }
268 beacon_quic_error_out->clear(); 268 beacon_quic_error_out->clear();
269 return false; 269 return false;
270 } 270 }
271 271
272 } // namespace domain_reliability 272 } // namespace domain_reliability
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698