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

Side by Side Diff: webkit/glue/weburlloader_impl.cc

Issue 7461106: Inform disk cache of WebKit memory cache hits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove rank from test Created 9 years, 4 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 | Annotate | Revision Log
« webkit/glue/resource_type.h ('K') | « webkit/glue/resource_type.h ('k') | 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 (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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge.
6 6
7 #include "webkit/glue/weburlloader_impl.h" 7 #include "webkit/glue/weburlloader_impl.h"
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 return buffer_; 103 return buffer_;
104 } 104 }
105 105
106 private: 106 private:
107 int load_flags_; 107 int load_flags_;
108 std::string buffer_; 108 std::string buffer_;
109 bool has_accept_header_; 109 bool has_accept_header_;
110 }; 110 };
111 111
112 ResourceType::Type FromTargetType(WebURLRequest::TargetType type) {
113 switch (type) {
114 case WebURLRequest::TargetIsMainFrame:
115 return ResourceType::MAIN_FRAME;
116 case WebURLRequest::TargetIsSubframe:
117 return ResourceType::SUB_FRAME;
118 case WebURLRequest::TargetIsSubresource:
119 return ResourceType::SUB_RESOURCE;
120 case WebURLRequest::TargetIsStyleSheet:
121 return ResourceType::STYLESHEET;
122 case WebURLRequest::TargetIsScript:
123 return ResourceType::SCRIPT;
124 case WebURLRequest::TargetIsFontResource:
125 return ResourceType::FONT_RESOURCE;
126 case WebURLRequest::TargetIsImage:
127 return ResourceType::IMAGE;
128 case WebURLRequest::TargetIsObject:
129 return ResourceType::OBJECT;
130 case WebURLRequest::TargetIsMedia:
131 return ResourceType::MEDIA;
132 case WebURLRequest::TargetIsWorker:
133 return ResourceType::WORKER;
134 case WebURLRequest::TargetIsSharedWorker:
135 return ResourceType::SHARED_WORKER;
136 case WebURLRequest::TargetIsPrefetch:
137 return ResourceType::PREFETCH;
138 case WebURLRequest::TargetIsPrerender:
139 return ResourceType::PRERENDER;
140 case WebURLRequest::TargetIsFavicon:
141 return ResourceType::FAVICON;
142 default:
143 NOTREACHED();
144 return ResourceType::SUB_RESOURCE;
145 }
146 }
147
148 // Extracts the information from a data: url. 112 // Extracts the information from a data: url.
149 bool GetInfoFromDataURL(const GURL& url, 113 bool GetInfoFromDataURL(const GURL& url,
150 ResourceResponseInfo* info, 114 ResourceResponseInfo* info,
151 std::string* data, 115 std::string* data,
152 net::URLRequestStatus* status) { 116 net::URLRequestStatus* status) {
153 std::string mime_type; 117 std::string mime_type;
154 std::string charset; 118 std::string charset;
155 if (net::DataURL::Parse(url, &mime_type, &charset, data)) { 119 if (net::DataURL::Parse(url, &mime_type, &charset, data)) {
156 *status = net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0); 120 *status = net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0);
157 info->request_time = Time::Now(); 121 info->request_time = Time::Now();
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 request_info.method = method; 391 request_info.method = method;
428 request_info.url = url; 392 request_info.url = url;
429 request_info.first_party_for_cookies = request.firstPartyForCookies(); 393 request_info.first_party_for_cookies = request.firstPartyForCookies();
430 request_info.referrer = referrer_url; 394 request_info.referrer = referrer_url;
431 request_info.headers = flattener.GetBuffer(); 395 request_info.headers = flattener.GetBuffer();
432 request_info.load_flags = load_flags; 396 request_info.load_flags = load_flags;
433 // requestor_pid only needs to be non-zero if the request originates outside 397 // requestor_pid only needs to be non-zero if the request originates outside
434 // the render process, so we can use requestorProcessID even for requests 398 // the render process, so we can use requestorProcessID even for requests
435 // from in-process plugins. 399 // from in-process plugins.
436 request_info.requestor_pid = request.requestorProcessID(); 400 request_info.requestor_pid = request.requestorProcessID();
437 request_info.request_type = FromTargetType(request.targetType()); 401 request_info.request_type =
402 ResourceType::FromTargetType(request.targetType());
438 request_info.appcache_host_id = request.appCacheHostID(); 403 request_info.appcache_host_id = request.appCacheHostID();
439 request_info.routing_id = request.requestorID(); 404 request_info.routing_id = request.requestorID();
440 request_info.download_to_file = request.downloadToFile(); 405 request_info.download_to_file = request.downloadToFile();
441 request_info.has_user_gesture = request.hasUserGesture(); 406 request_info.has_user_gesture = request.hasUserGesture();
442 request_info.frame_id = -1; 407 request_info.frame_id = -1;
443 request_info.is_main_frame = false; 408 request_info.is_main_frame = false;
444 if (request.extraData()) { 409 if (request.extraData()) {
445 RequestExtraData* extra_data = 410 RequestExtraData* extra_data =
446 static_cast<RequestExtraData*>(request.extraData()); 411 static_cast<RequestExtraData*>(request.extraData());
447 request_info.frame_id = extra_data->frame_identifier(); 412 request_info.frame_id = extra_data->frame_identifier();
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 721
757 void WebURLLoaderImpl::cancel() { 722 void WebURLLoaderImpl::cancel() {
758 context_->Cancel(); 723 context_->Cancel();
759 } 724 }
760 725
761 void WebURLLoaderImpl::setDefersLoading(bool value) { 726 void WebURLLoaderImpl::setDefersLoading(bool value) {
762 context_->SetDefersLoading(value); 727 context_->SetDefersLoading(value);
763 } 728 }
764 729
765 } // namespace webkit_glue 730 } // namespace webkit_glue
OLDNEW
« webkit/glue/resource_type.h ('K') | « webkit/glue/resource_type.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698