| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 Filter* filter_list) { | 372 Filter* filter_list) { |
| 373 scoped_ptr<Filter> first_filter; // Soon to be start of chain. | 373 scoped_ptr<Filter> first_filter; // Soon to be start of chain. |
| 374 switch (type_id) { | 374 switch (type_id) { |
| 375 case FILTER_TYPE_GZIP_HELPING_SDCH: | 375 case FILTER_TYPE_GZIP_HELPING_SDCH: |
| 376 case FILTER_TYPE_DEFLATE: | 376 case FILTER_TYPE_DEFLATE: |
| 377 case FILTER_TYPE_GZIP: | 377 case FILTER_TYPE_GZIP: |
| 378 first_filter.reset(InitGZipFilter(type_id, buffer_size)); | 378 first_filter.reset(InitGZipFilter(type_id, buffer_size)); |
| 379 break; | 379 break; |
| 380 case FILTER_TYPE_SDCH: | 380 case FILTER_TYPE_SDCH: |
| 381 case FILTER_TYPE_SDCH_POSSIBLE: | 381 case FILTER_TYPE_SDCH_POSSIBLE: |
| 382 if (filter_context.GetURLRequestContext()->sdch_manager() && | 382 if (filter_context.GetURLRequestContext()->sdch_manager()) { |
| 383 SdchManager::sdch_enabled()) { | |
| 384 first_filter.reset( | 383 first_filter.reset( |
| 385 InitSdchFilter(type_id, filter_context, buffer_size)); | 384 InitSdchFilter(type_id, filter_context, buffer_size)); |
| 386 } | 385 } |
| 387 break; | 386 break; |
| 388 default: | 387 default: |
| 389 break; | 388 break; |
| 390 } | 389 } |
| 391 | 390 |
| 392 if (!first_filter.get()) | 391 if (!first_filter.get()) |
| 393 return NULL; | 392 return NULL; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 405 | 404 |
| 406 void Filter::PushDataIntoNextFilter() { | 405 void Filter::PushDataIntoNextFilter() { |
| 407 IOBuffer* next_buffer = next_filter_->stream_buffer(); | 406 IOBuffer* next_buffer = next_filter_->stream_buffer(); |
| 408 int next_size = next_filter_->stream_buffer_size(); | 407 int next_size = next_filter_->stream_buffer_size(); |
| 409 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); | 408 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); |
| 410 if (FILTER_ERROR != last_status_) | 409 if (FILTER_ERROR != last_status_) |
| 411 next_filter_->FlushStreamBuffer(next_size); | 410 next_filter_->FlushStreamBuffer(next_size); |
| 412 } | 411 } |
| 413 | 412 |
| 414 } // namespace net | 413 } // namespace net |
| OLD | NEW |