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

Unified Diff: net/filter/filter.cc

Issue 423813002: Sdch view for net-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix component linkage 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/filter/filter.h ('k') | net/filter/mock_filter_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/filter/filter.cc
diff --git a/net/filter/filter.cc b/net/filter/filter.cc
index c8a4740a40af3b01479bfba4e76860bc7fdf6e2d..c9a56bd9573dd3668494e0d31f4e05c52ed52439 100644
--- a/net/filter/filter.cc
+++ b/net/filter/filter.cc
@@ -28,11 +28,14 @@
#include "net/base/filename_util_unsafe.h"
#include "net/base/io_buffer.h"
#include "net/base/mime_util.h"
+#include "net/base/sdch_net_log_params.h"
#include "net/filter/gzip_filter.h"
#include "net/filter/sdch_filter.h"
#include "net/url_request/url_request_context.h"
#include "url/gurl.h"
+namespace net {
+
namespace {
// Filter types (using canonical lower case only):
@@ -53,9 +56,15 @@ const char kTextHtml[] = "text/html";
// Buffer size allocated when de-compressing data.
const int kFilterBufSize = 32 * 1024;
-} // namespace
+void LogSdchProblem(const FilterContext& filter_context,
+ SdchProblemCode problem) {
+ SdchManager::SdchErrorRecovery(problem);
+ filter_context.GetNetLog().AddEvent(
+ NetLog::TYPE_SDCH_DECODING_ERROR,
+ base::Bind(&NetLogSdchResourceProblemCallback, problem));
+}
-namespace net {
+} // namespace
FilterContext::~FilterContext() {
}
@@ -233,13 +242,12 @@ void Filter::FixupEncodingTypes(
// It was not an SDCH request, so we'll just record stats.
if (1 < encoding_types->size()) {
// Multiple filters were intended to only be used for SDCH (thus far!)
- SdchManager::SdchErrorRecovery(
- SdchManager::MULTIENCODING_FOR_NON_SDCH_REQUEST);
+ LogSdchProblem(filter_context, SDCH_MULTIENCODING_FOR_NON_SDCH_REQUEST);
}
if ((1 == encoding_types->size()) &&
(FILTER_TYPE_SDCH == encoding_types->front())) {
- SdchManager::SdchErrorRecovery(
- SdchManager::SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST);
+ LogSdchProblem(filter_context,
+ SDCH_SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST);
}
return;
}
@@ -259,8 +267,7 @@ void Filter::FixupEncodingTypes(
// no-op pass through filter if it doesn't get gzip headers where expected.
if (1 == encoding_types->size()) {
encoding_types->push_back(FILTER_TYPE_GZIP_HELPING_SDCH);
- SdchManager::SdchErrorRecovery(
- SdchManager::OPTIONAL_GUNZIP_ENCODING_ADDED);
+ LogSdchProblem(filter_context, SDCH_OPTIONAL_GUNZIP_ENCODING_ADDED);
}
return;
}
@@ -294,14 +301,11 @@ void Filter::FixupEncodingTypes(
// Suspicious case: Advertised dictionary, but server didn't use sdch, and
// we're HTML tagged.
if (encoding_types->empty()) {
- SdchManager::SdchErrorRecovery(
- SdchManager::ADDED_CONTENT_ENCODING);
+ LogSdchProblem(filter_context, SDCH_ADDED_CONTENT_ENCODING);
} else if (1 == encoding_types->size()) {
- SdchManager::SdchErrorRecovery(
- SdchManager::FIXED_CONTENT_ENCODING);
+ LogSdchProblem(filter_context, SDCH_FIXED_CONTENT_ENCODING);
} else {
- SdchManager::SdchErrorRecovery(
- SdchManager::FIXED_CONTENT_ENCODINGS);
+ LogSdchProblem(filter_context, SDCH_FIXED_CONTENT_ENCODINGS);
}
} else {
// Remarkable case!?! We advertised an SDCH dictionary, content-encoding
@@ -313,14 +317,11 @@ void Filter::FixupEncodingTypes(
// start with "text/html" for some other reason?? We'll report this as a
// fixup to a binary file, but it probably really is text/html (some how).
if (encoding_types->empty()) {
- SdchManager::SdchErrorRecovery(
- SdchManager::BINARY_ADDED_CONTENT_ENCODING);
+ LogSdchProblem(filter_context, SDCH_BINARY_ADDED_CONTENT_ENCODING);
} else if (1 == encoding_types->size()) {
- SdchManager::SdchErrorRecovery(
- SdchManager::BINARY_FIXED_CONTENT_ENCODING);
+ LogSdchProblem(filter_context, SDCH_BINARY_FIXED_CONTENT_ENCODING);
} else {
- SdchManager::SdchErrorRecovery(
- SdchManager::BINARY_FIXED_CONTENT_ENCODINGS);
+ LogSdchProblem(filter_context, SDCH_BINARY_FIXED_CONTENT_ENCODINGS);
}
}
« no previous file with comments | « net/filter/filter.h ('k') | net/filter/mock_filter_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698