OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/buffered_resource_handler.h" | 5 #include "chrome/browser/renderer_host/buffered_resource_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (!not_modified_status && ShouldWaitForPlugins()) { | 210 if (!not_modified_status && ShouldWaitForPlugins()) { |
211 wait_for_plugins_ = true; | 211 wait_for_plugins_ = true; |
212 return true; | 212 return true; |
213 } | 213 } |
214 | 214 |
215 return false; | 215 return false; |
216 } | 216 } |
217 | 217 |
218 bool BufferedResourceHandler::ShouldBuffer(const GURL& url, | 218 bool BufferedResourceHandler::ShouldBuffer(const GURL& url, |
219 const std::string& mime_type) { | 219 const std::string& mime_type) { |
220 // We are willing to buffer for HTTP and HTTPS. | 220 // We are willing to buffer for HTTP, HTTPS, and HTTPSV. |
221 bool sniffable_scheme = url.is_empty() || | 221 bool sniffable_scheme = url.is_empty() || |
222 url.SchemeIs(chrome::kHttpScheme) || | 222 url.SchemeIs(chrome::kHttpScheme) || |
223 url.SchemeIs(chrome::kHttpsScheme); | 223 url.SchemeIs(chrome::kHttpsScheme) || |
| 224 url.SchemeIs(chrome::kHttpsvScheme); |
224 if (!sniffable_scheme) | 225 if (!sniffable_scheme) |
225 return false; | 226 return false; |
226 | 227 |
227 // Today, the only reason to buffer the request is to fix the doctype decoding | 228 // Today, the only reason to buffer the request is to fix the doctype decoding |
228 // performed by webkit: if there is not enough data it will go to quirks mode. | 229 // performed by webkit: if there is not enough data it will go to quirks mode. |
229 // We only expect the doctype check to apply to html documents. | 230 // We only expect the doctype check to apply to html documents. |
230 return mime_type == "text/html"; | 231 return mime_type == "text/html"; |
231 } | 232 } |
232 | 233 |
233 bool BufferedResourceHandler::DidBufferEnough(int bytes_read) { | 234 bool BufferedResourceHandler::DidBufferEnough(int bytes_read) { |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 wait_for_plugins_ = false; | 483 wait_for_plugins_ = false; |
483 if (!request_) | 484 if (!request_) |
484 return; | 485 return; |
485 | 486 |
486 ResourceDispatcherHostRequestInfo* info = | 487 ResourceDispatcherHostRequestInfo* info = |
487 ResourceDispatcherHost::InfoForRequest(request_); | 488 ResourceDispatcherHost::InfoForRequest(request_); |
488 host_->PauseRequest(info->child_id(), info->request_id(), false); | 489 host_->PauseRequest(info->child_id(), info->request_id(), false); |
489 if (!CompleteResponseStarted(info->request_id(), false)) | 490 if (!CompleteResponseStarted(info->request_id(), false)) |
490 host_->CancelRequest(info->child_id(), info->request_id(), false); | 491 host_->CancelRequest(info->child_id(), info->request_id(), false); |
491 } | 492 } |
OLD | NEW |