summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-17 06:00:55 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-17 06:00:55 +0000
commit216c17f4d83ba354f911b13fafd18c030169a23e (patch)
tree10b5a5c83ee3adc02e2b9220e537d3fc81516cff /content/browser
parentb2b676c5cd27587140fbfcb276d4d2d09362834d (diff)
downloadchromium_src-216c17f4d83ba354f911b13fafd18c030169a23e.zip
chromium_src-216c17f4d83ba354f911b13fafd18c030169a23e.tar.gz
chromium_src-216c17f4d83ba354f911b13fafd18c030169a23e.tar.bz2
We don't need to buffer network responses anymore now that we have an HTML5
parser that can parse doctypes across packet boundaries. Review URL: http://codereview.chromium.org/7038001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/renderer_host/buffered_resource_handler.cc40
-rw-r--r--content/browser/renderer_host/buffered_resource_handler.h5
2 files changed, 1 insertions, 44 deletions
diff --git a/content/browser/renderer_host/buffered_resource_handler.cc b/content/browser/renderer_host/buffered_resource_handler.cc
index d1c233a..06b78e5 100644
--- a/content/browser/renderer_host/buffered_resource_handler.cc
+++ b/content/browser/renderer_host/buffered_resource_handler.cc
@@ -62,7 +62,6 @@ BufferedResourceHandler::BufferedResourceHandler(ResourceHandler* handler,
read_buffer_size_(0),
bytes_read_(0),
sniff_content_(false),
- should_buffer_(false),
wait_for_plugins_(false),
buffering_(false),
finished_(false) {
@@ -134,7 +133,7 @@ bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
}
bool BufferedResourceHandler::OnReadCompleted(int request_id, int* bytes_read) {
- if (sniff_content_ || should_buffer_) {
+ if (sniff_content_) {
if (KeepBuffering(*bytes_read))
return true;
@@ -202,14 +201,6 @@ bool BufferedResourceHandler::DelayResponse() {
response_->response_head.mime_type.assign(mime_type);
}
- if (ShouldBuffer(request_->url(), mime_type)) {
- // This is a temporary fix for the fact that webkit expects to have
- // enough data to decode the doctype in order to select the rendering
- // mode.
- should_buffer_ = true;
- return true;
- }
-
if (!not_modified_status && ShouldWaitForPlugins()) {
wait_for_plugins_ = true;
return true;
@@ -218,21 +209,6 @@ bool BufferedResourceHandler::DelayResponse() {
return false;
}
-bool BufferedResourceHandler::ShouldBuffer(const GURL& url,
- const std::string& mime_type) {
- // We are willing to buffer for HTTP and HTTPS.
- bool sniffable_scheme = url.is_empty() ||
- url.SchemeIs(chrome::kHttpScheme) ||
- url.SchemeIs(chrome::kHttpsScheme);
- if (!sniffable_scheme)
- return false;
-
- // Today, the only reason to buffer the request is to fix the doctype decoding
- // performed by webkit: if there is not enough data it will go to quirks mode.
- // We only expect the doctype check to apply to html documents.
- return mime_type == "text/html";
-}
-
bool BufferedResourceHandler::DidBufferEnough(int bytes_read) {
const int kRequiredLength = 256;
@@ -272,20 +248,6 @@ bool BufferedResourceHandler::KeepBuffering(int bytes_read) {
response_->response_head.mime_type.assign(new_type);
// We just sniffed the mime type, maybe there is a doctype to process.
- if (ShouldBuffer(request_->url(), new_type)) {
- should_buffer_ = true;
- } else if (ShouldWaitForPlugins()) {
- wait_for_plugins_ = true;
- }
- }
-
- if (should_buffer_) {
- if (!finished_ && !DidBufferEnough(bytes_read_)) {
- buffering_ = true;
- return true;
- }
-
- should_buffer_ = false;
if (ShouldWaitForPlugins())
wait_for_plugins_ = true;
}
diff --git a/content/browser/renderer_host/buffered_resource_handler.h b/content/browser/renderer_host/buffered_resource_handler.h
index ab5393e..8257f54 100644
--- a/content/browser/renderer_host/buffered_resource_handler.h
+++ b/content/browser/renderer_host/buffered_resource_handler.h
@@ -44,10 +44,6 @@ class BufferedResourceHandler : public ResourceHandler {
// Returns true if we should delay OnResponseStarted forwarding.
bool DelayResponse();
- // Returns true if there will be a need to parse the DocType of the document
- // to determine the right way to handle it.
- bool ShouldBuffer(const GURL& url, const std::string& mime_type);
-
// Returns true if there is enough information to process the DocType.
bool DidBufferEnough(int bytes_read);
@@ -88,7 +84,6 @@ class BufferedResourceHandler : public ResourceHandler {
int read_buffer_size_;
int bytes_read_;
bool sniff_content_;
- bool should_buffer_;
bool wait_for_plugins_;
bool buffering_;
bool finished_;