| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/quic/quic_utils.h" | 5 #include "net/quic/quic_utils.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 return string(chars, sizeof(chars)); | 285 return string(chars, sizeof(chars)); |
| 286 } | 286 } |
| 287 | 287 |
| 288 return base::UintToString(orig_tag); | 288 return base::UintToString(orig_tag); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // static | 291 // static |
| 292 QuicTagVector QuicUtils::ParseQuicConnectionOptions( | 292 QuicTagVector QuicUtils::ParseQuicConnectionOptions( |
| 293 const std::string& connection_options) { | 293 const std::string& connection_options) { |
| 294 QuicTagVector options; | 294 QuicTagVector options; |
| 295 std::vector<std::string> tokens; | |
| 296 base::SplitString(connection_options, ',', &tokens); | |
| 297 // Tokens are expected to be no more than 4 characters long, but we | 295 // Tokens are expected to be no more than 4 characters long, but we |
| 298 // handle overflow gracefully. | 296 // handle overflow gracefully. |
| 299 for (const std::string& token : tokens) { | 297 for (const base::StringPiece& token : |
| 298 base::SplitStringPiece(connection_options, ",", base::TRIM_WHITESPACE, |
| 299 base::SPLIT_WANT_ALL)) { |
| 300 uint32 option = 0; | 300 uint32 option = 0; |
| 301 for (char token_char : base::Reversed(token)) { | 301 for (char token_char : base::Reversed(token)) { |
| 302 option <<= 8; | 302 option <<= 8; |
| 303 option |= static_cast<unsigned char>(token_char); | 303 option |= static_cast<unsigned char>(token_char); |
| 304 } | 304 } |
| 305 options.push_back(option); | 305 options.push_back(option); |
| 306 } | 306 } |
| 307 return options; | 307 return options; |
| 308 } | 308 } |
| 309 | 309 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 338 } | 338 } |
| 339 return s; | 339 return s; |
| 340 } | 340 } |
| 341 | 341 |
| 342 // static | 342 // static |
| 343 QuicPriority QuicUtils::HighestPriority() { | 343 QuicPriority QuicUtils::HighestPriority() { |
| 344 return QuicWriteBlockedList::kHighestPriority; | 344 return QuicWriteBlockedList::kHighestPriority; |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace net | 347 } // namespace net |
| OLD | NEW |