diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 06:34:56 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 06:34:56 +0000 |
commit | 2e7aff66fe443c29b2fc14a776dca5512b0b4729 (patch) | |
tree | 0195994507e51a675c488718dd50e7bd997d889f /chrome/browser | |
parent | 791199c674cd1aa2997e39079e33681596866fc8 (diff) | |
download | chromium_src-2e7aff66fe443c29b2fc14a776dca5512b0b4729.zip chromium_src-2e7aff66fe443c29b2fc14a776dca5512b0b4729.tar.gz chromium_src-2e7aff66fe443c29b2fc14a776dca5512b0b4729.tar.bz2 |
Increase the mime sniffer's limit for searching for binary looking bytes from
512 to 1024 bytes.
Contributed by tonyg@chromium.org
BUG=15314
TEST=net_unittests --gtest_filter=MimeSnifferTest.LooksBinary
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41687 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/renderer_host/buffered_resource_handler.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.cc b/chrome/browser/renderer_host/buffered_resource_handler.cc index c330dcc..a0f128b 100644 --- a/chrome/browser/renderer_host/buffered_resource_handler.cc +++ b/chrome/browser/renderer_host/buffered_resource_handler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,8 +26,6 @@ namespace { -const int kMaxBytesToSniff = 512; - void RecordSnifferMetrics(bool sniffing_blocked, bool we_would_like_to_sniff, const std::string& mime_type) { @@ -111,9 +109,9 @@ bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, int min_size) { if (buffering_) { DCHECK(!my_buffer_.get()); - my_buffer_ = new net::IOBuffer(kMaxBytesToSniff); + my_buffer_ = new net::IOBuffer(net::kMaxBytesToSniff); *buf = my_buffer_.get(); - *buf_size = kMaxBytesToSniff; + *buf_size = net::kMaxBytesToSniff; // TODO(willchan): Remove after debugging bug 16371. CHECK((*buf)->data()); return true; @@ -129,7 +127,7 @@ bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, // TODO(willchan): Remove after debugging bug 16371. CHECK(read_buffer_->data()); read_buffer_size_ = *buf_size; - DCHECK(read_buffer_size_ >= kMaxBytesToSniff * 2); + DCHECK_GE(read_buffer_size_, net::kMaxBytesToSniff * 2); bytes_read_ = 0; return true; } @@ -244,7 +242,7 @@ bool BufferedResourceHandler::KeepBuffering(int bytes_read) { DCHECK(read_buffer_); if (my_buffer_) { // We are using our own buffer to read, update the main buffer. - CHECK(bytes_read + bytes_read_ < read_buffer_size_); + CHECK_LT(bytes_read + bytes_read_, read_buffer_size_); memcpy(read_buffer_->data() + bytes_read_, my_buffer_->data(), bytes_read); my_buffer_ = NULL; } @@ -260,7 +258,7 @@ bool BufferedResourceHandler::KeepBuffering(int bytes_read) { // SniffMimeType() returns false if there is not enough data to determine // the mime type. However, even if it returns false, it returns a new type // that is probably better than the current one. - DCHECK(bytes_read_ < kMaxBytesToSniff); + DCHECK_LT(bytes_read_, net::kMaxBytesToSniff); if (!finished_) { buffering_ = true; return true; |