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

Side by Side Diff: net/filter/filter.cc

Issue 138533008: If SDCH is disabled, don't add an SDCH filter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "net/filter/filter.h" 5 #include "net/filter/filter.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/mime_util.h" 10 #include "net/base/mime_util.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 Filter* filter_list) { 362 Filter* filter_list) {
363 scoped_ptr<Filter> first_filter; // Soon to be start of chain. 363 scoped_ptr<Filter> first_filter; // Soon to be start of chain.
364 switch (type_id) { 364 switch (type_id) {
365 case FILTER_TYPE_GZIP_HELPING_SDCH: 365 case FILTER_TYPE_GZIP_HELPING_SDCH:
366 case FILTER_TYPE_DEFLATE: 366 case FILTER_TYPE_DEFLATE:
367 case FILTER_TYPE_GZIP: 367 case FILTER_TYPE_GZIP:
368 first_filter.reset(InitGZipFilter(type_id, buffer_size)); 368 first_filter.reset(InitGZipFilter(type_id, buffer_size));
369 break; 369 break;
370 case FILTER_TYPE_SDCH: 370 case FILTER_TYPE_SDCH:
371 case FILTER_TYPE_SDCH_POSSIBLE: 371 case FILTER_TYPE_SDCH_POSSIBLE:
372 first_filter.reset(InitSdchFilter(type_id, filter_context, buffer_size)); 372 if (SdchManager::Global() && SdchManager::sdch_enabled()) {
373 first_filter.reset(
374 InitSdchFilter(type_id, filter_context, buffer_size));
375 }
373 break; 376 break;
374 default: 377 default:
375 break; 378 break;
376 } 379 }
377 380
378 if (!first_filter.get()) 381 if (!first_filter.get())
379 return NULL; 382 return NULL;
380 383
381 first_filter->next_filter_.reset(filter_list); 384 first_filter->next_filter_.reset(filter_list);
382 return first_filter.release(); 385 return first_filter.release();
383 } 386 }
384 387
385 void Filter::InitBuffer(int buffer_size) { 388 void Filter::InitBuffer(int buffer_size) {
386 DCHECK(!stream_buffer()); 389 DCHECK(!stream_buffer());
387 DCHECK_GT(buffer_size, 0); 390 DCHECK_GT(buffer_size, 0);
388 stream_buffer_ = new IOBuffer(buffer_size); 391 stream_buffer_ = new IOBuffer(buffer_size);
389 stream_buffer_size_ = buffer_size; 392 stream_buffer_size_ = buffer_size;
390 } 393 }
391 394
392 void Filter::PushDataIntoNextFilter() { 395 void Filter::PushDataIntoNextFilter() {
393 IOBuffer* next_buffer = next_filter_->stream_buffer(); 396 IOBuffer* next_buffer = next_filter_->stream_buffer();
394 int next_size = next_filter_->stream_buffer_size(); 397 int next_size = next_filter_->stream_buffer_size();
395 last_status_ = ReadFilteredData(next_buffer->data(), &next_size); 398 last_status_ = ReadFilteredData(next_buffer->data(), &next_size);
396 if (FILTER_ERROR != last_status_) 399 if (FILTER_ERROR != last_status_)
397 next_filter_->FlushStreamBuffer(next_size); 400 next_filter_->FlushStreamBuffer(next_size);
398 } 401 }
399 402
400 } // namespace net 403 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698