Chromium Code Reviews| Index: net/filter/filter.cc |
| diff --git a/net/filter/filter.cc b/net/filter/filter.cc |
| index 7d3af0aebfb5a89b7c7063b02a258d0b45762beb..1313ac5d82eaf9b8aa7aae1f3be327e92553b32d 100644 |
| --- a/net/filter/filter.cc |
| +++ b/net/filter/filter.cc |
| @@ -9,11 +9,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 { |
| + |
|
Randy Smith (Not in Mondays)
2014/09/18 20:55:51
I don't particularly care, but was there a reason
baranovich
2014/09/19 12:42:44
I wanted to avoid writing net:: prefixes in LogSdc
|
| namespace { |
| // Filter types (using canonical lower case only): |
| @@ -34,9 +37,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, |
| + SdchManager::ProblemCodes problem) { |
| + SdchManager::SdchErrorRecovery(problem); |
| + filter_context.GetNetLog().AddEvent( |
| + NetLog::TYPE_SDCH_RESOURCE_ERROR, |
| + base::Bind(&NetLogSdchResourceProblemCallback, problem, true)); |
| +} |
| -namespace net { |
| +} // namespace |
| FilterContext::~FilterContext() { |
| } |
| @@ -210,13 +219,13 @@ 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, |
| + SdchManager::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, |
| + SdchManager::SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST); |
| } |
| return; |
| } |
| @@ -236,8 +245,8 @@ 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, |
| + SdchManager::OPTIONAL_GUNZIP_ENCODING_ADDED); |
| } |
| return; |
| } |
| @@ -271,14 +280,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, SdchManager::ADDED_CONTENT_ENCODING); |
| } else if (1 == encoding_types->size()) { |
| - SdchManager::SdchErrorRecovery( |
| - SdchManager::FIXED_CONTENT_ENCODING); |
| + LogSdchProblem(filter_context, SdchManager::FIXED_CONTENT_ENCODING); |
| } else { |
| - SdchManager::SdchErrorRecovery( |
| - SdchManager::FIXED_CONTENT_ENCODINGS); |
| + LogSdchProblem(filter_context, SdchManager::FIXED_CONTENT_ENCODINGS); |
| } |
| } else { |
| // Remarkable case!?! We advertised an SDCH dictionary, content-encoding |
| @@ -290,14 +296,14 @@ 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, |
| + SdchManager::BINARY_ADDED_CONTENT_ENCODING); |
| } else if (1 == encoding_types->size()) { |
| - SdchManager::SdchErrorRecovery( |
| - SdchManager::BINARY_FIXED_CONTENT_ENCODING); |
| + LogSdchProblem(filter_context, |
| + SdchManager::BINARY_FIXED_CONTENT_ENCODING); |
| } else { |
| - SdchManager::SdchErrorRecovery( |
| - SdchManager::BINARY_FIXED_CONTENT_ENCODINGS); |
| + LogSdchProblem(filter_context, |
| + SdchManager::BINARY_FIXED_CONTENT_ENCODINGS); |
| } |
| } |