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

Unified Diff: net/quic/quic_utils.cc

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_utils.h ('k') | net/quic/quic_utils_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_utils.cc
diff --git a/net/quic/quic_utils.cc b/net/quic/quic_utils.cc
index d786a959d77ae8bf76a4105b70b66e7519589712..f1446512e86e63a06225dc0dd304eac394756535 100644
--- a/net/quic/quic_utils.cc
+++ b/net/quic/quic_utils.cc
@@ -7,12 +7,15 @@
#include <ctype.h>
#include <algorithm>
+#include <vector>
#include "base/basictypes.h"
+#include "base/containers/adapters.h"
#include "base/logging.h"
#include "base/port.h"
#include "base/strings/stringprintf.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_split.h"
#include "net/quic/quic_write_blocked_list.h"
using base::StringPiece;
@@ -280,6 +283,25 @@ string QuicUtils::TagToString(QuicTag tag) {
}
// static
+QuicTagVector QuicUtils::ParseQuicConnectionOptions(
+ const std::string& connection_options) {
+ QuicTagVector options;
+ std::vector<std::string> tokens;
+ base::SplitString(connection_options, ',', &tokens);
+ // Tokens are expected to be no more than 4 characters long, but we
+ // handle overflow gracefully.
+ for (const std::string& token : tokens) {
+ uint32 option = 0;
+ for (char token_char : base::Reversed(token)) {
+ option <<= 8;
+ option |= static_cast<unsigned char>(token_char);
+ }
+ options.push_back(option);
+ }
+ return options;
+}
+
+// static
string QuicUtils::StringToHexASCIIDump(StringPiece in_buffer) {
int offset = 0;
const int kBytesPerLine = 16; // Max bytes dumped per line
« no previous file with comments | « net/quic/quic_utils.h ('k') | net/quic/quic_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698