| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // The basic usage of the Filter interface is described in the comment at | 5 // The basic usage of the Filter interface is described in the comment at |
| 6 // the beginning of filter.h. If Filter::Factory is passed a vector of | 6 // the beginning of filter.h. If Filter::Factory is passed a vector of |
| 7 // size greater than 1, that interface is implemented by a series of filters | 7 // size greater than 1, that interface is implemented by a series of filters |
| 8 // connected in a chain. In such a case the first filter | 8 // connected in a chain. In such a case the first filter |
| 9 // in the chain proxies calls to ReadData() so that its return values | 9 // in the chain proxies calls to ReadData() so that its return values |
| 10 // apply to the entire chain. | 10 // apply to the entire chain. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const char kTextHtml[] = "text/html"; | 49 const char kTextHtml[] = "text/html"; |
| 50 | 50 |
| 51 // Buffer size allocated when de-compressing data. | 51 // Buffer size allocated when de-compressing data. |
| 52 const int kFilterBufSize = 32 * 1024; | 52 const int kFilterBufSize = 32 * 1024; |
| 53 | 53 |
| 54 void LogSdchProblem(const FilterContext& filter_context, | 54 void LogSdchProblem(const FilterContext& filter_context, |
| 55 SdchProblemCode problem) { | 55 SdchProblemCode problem) { |
| 56 SdchManager::SdchErrorRecovery(problem); | 56 SdchManager::SdchErrorRecovery(problem); |
| 57 filter_context.GetNetLog().AddEvent( | 57 filter_context.GetNetLog().AddEvent( |
| 58 NetLog::TYPE_SDCH_DECODING_ERROR, | 58 NetLog::TYPE_SDCH_DECODING_ERROR, |
| 59 base::Bind(&NetLogSdchResourceProblemCallback, problem)); | 59 base::Bind(NetLogSdchResourceProblemCallback, problem)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 std::string FilterTypeAsString(Filter::FilterType type_id) { | 62 std::string FilterTypeAsString(Filter::FilterType type_id) { |
| 63 switch (type_id) { | 63 switch (type_id) { |
| 64 case Filter::FILTER_TYPE_DEFLATE: | 64 case Filter::FILTER_TYPE_DEFLATE: |
| 65 return "FILTER_TYPE_DEFLATE"; | 65 return "FILTER_TYPE_DEFLATE"; |
| 66 case Filter::FILTER_TYPE_GZIP: | 66 case Filter::FILTER_TYPE_GZIP: |
| 67 return "FILTER_TYPE_GZIP"; | 67 return "FILTER_TYPE_GZIP"; |
| 68 case Filter::FILTER_TYPE_GZIP_HELPING_SDCH: | 68 case Filter::FILTER_TYPE_GZIP_HELPING_SDCH: |
| 69 return "FILTER_TYPE_GZIP_HELPING_SDCH"; | 69 return "FILTER_TYPE_GZIP_HELPING_SDCH"; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 403 |
| 404 void Filter::PushDataIntoNextFilter() { | 404 void Filter::PushDataIntoNextFilter() { |
| 405 IOBuffer* next_buffer = next_filter_->stream_buffer(); | 405 IOBuffer* next_buffer = next_filter_->stream_buffer(); |
| 406 int next_size = next_filter_->stream_buffer_size(); | 406 int next_size = next_filter_->stream_buffer_size(); |
| 407 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); | 407 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); |
| 408 if (FILTER_ERROR != last_status_) | 408 if (FILTER_ERROR != last_status_) |
| 409 next_filter_->FlushStreamBuffer(next_size); | 409 next_filter_->FlushStreamBuffer(next_size); |
| 410 } | 410 } |
| 411 | 411 |
| 412 } // namespace net | 412 } // namespace net |
| OLD | NEW |