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

Unified Diff: net/spdy/spdy_log_util.cc

Issue 2771033005: Split out spdy_log_util from http_log_util. (Closed)
Patch Set: Remove http_log_util.h include from two files that do not use ElideHeaderValueForNetLog(). Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_log_util.h ('k') | net/spdy/spdy_log_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_log_util.cc
diff --git a/net/spdy/spdy_log_util.cc b/net/spdy/spdy_log_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6f3d69104d63cd11788104712ae5219da3b26ff3
--- /dev/null
+++ b/net/spdy/spdy_log_util.cc
@@ -0,0 +1,40 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/spdy/spdy_log_util.h"
+
+#include "base/memory/ptr_util.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/values.h"
+#include "net/http/http_log_util.h"
+
+namespace net {
+
+std::string ElideGoAwayDebugDataForNetLog(NetLogCaptureMode capture_mode,
+ base::StringPiece debug_data) {
+ // Note: this logic should be kept in sync with stripGoAwayDebugData in
+ // chrome/browser/resources/net_internals/log_view_painter.js.
+ if (capture_mode.include_cookies_and_credentials()) {
+ return debug_data.as_string();
+ }
+
+ return std::string("[") + base::SizeTToString(debug_data.size()) +
+ std::string(" bytes were stripped]");
+}
+
+std::unique_ptr<base::ListValue> ElideSpdyHeaderBlockForNetLog(
+ const SpdyHeaderBlock& headers,
+ NetLogCaptureMode capture_mode) {
+ auto headers_list = base::MakeUnique<base::ListValue>();
+ for (SpdyHeaderBlock::const_iterator it = headers.begin();
+ it != headers.end(); ++it) {
+ headers_list->AppendString(
+ it->first.as_string() + ": " +
+ ElideHeaderValueForNetLog(capture_mode, it->first.as_string(),
+ it->second.as_string()));
+ }
+ return headers_list;
+}
+
+} // namespace net
« no previous file with comments | « net/spdy/spdy_log_util.h ('k') | net/spdy/spdy_log_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698