Chromium Code Reviews| Index: content/child/web_url_loader_impl.cc |
| diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc |
| index 7b7405fb1d55c7040fe380da6be46988f9c9c35e..2ebe81cfa35bbd576e247326b5c2f7615987c5e8 100644 |
| --- a/content/child/web_url_loader_impl.cc |
| +++ b/content/child/web_url_loader_impl.cc |
| @@ -247,7 +247,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>, |
| virtual ~Context() {} |
| // We can optimize the handling of data URLs in most cases. |
| - bool CanHandleDataURL(const GURL& url) const; |
| + bool IsHandlableDataURLRequest() const; |
| void HandleDataURL(); |
| WebURLLoaderImpl* loader_; |
| @@ -315,7 +315,7 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, |
| request_ = request; // Save the request. |
| GURL url = request.url(); |
| - if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
| + if (IsHandlableDataURLRequest()) { |
|
darin (slow to review)
2014/09/09 05:59:11
Hmm, "Handleable" is probably a better spelling th
tyoshino (SeeGerritForStatus)
2014/09/09 07:11:59
Thanks for suggestion.
|
| if (sync_load_response) { |
| // This is a sync load. Do the work now. |
| sync_load_response->url = url; |
| @@ -658,8 +658,9 @@ void WebURLLoaderImpl::Context::OnCompletedRequest( |
| } |
| } |
| -bool WebURLLoaderImpl::Context::CanHandleDataURL(const GURL& url) const { |
| - DCHECK(url.SchemeIs("data")); |
| +bool WebURLLoaderImpl::Context::IsHandlableDataURLRequest() const { |
| + if (!request_.url().SchemeIs("data")) |
| + return false; |
| // Optimize for the case where we can handle a data URL locally. We must |
| // skip this for data URLs targetted at frames since those could trigger a |
| @@ -681,7 +682,7 @@ bool WebURLLoaderImpl::Context::CanHandleDataURL(const GURL& url) const { |
| return true; |
| std::string mime_type, unused_charset; |
| - if (net::DataURL::Parse(url, &mime_type, &unused_charset, NULL) && |
| + if (net::DataURL::Parse(request_.url(), &mime_type, &unused_charset, NULL) && |
| net::IsSupportedMimeType(mime_type)) |
| return true; |