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

Side by Side Diff: content/child/web_url_loader_impl.cc

Issue 2163183002: Fix PerformanceResourceTiming transferSize field for sync XHR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resource_timing_sizes_worker_tests
Patch Set: Rebase Created 4 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
« no previous file with comments | « content/child/web_url_loader_impl.h ('k') | content/child/web_url_loader_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 1127
1128 std::string old_method = request.httpMethod().utf8(); 1128 std::string old_method = request.httpMethod().utf8();
1129 new_request->setHTTPMethod(WebString::fromUTF8(redirect_info.new_method)); 1129 new_request->setHTTPMethod(WebString::fromUTF8(redirect_info.new_method));
1130 if (redirect_info.new_method == old_method) 1130 if (redirect_info.new_method == old_method)
1131 new_request->setHTTPBody(request.httpBody()); 1131 new_request->setHTTPBody(request.httpBody());
1132 } 1132 }
1133 1133
1134 void WebURLLoaderImpl::loadSynchronously(const WebURLRequest& request, 1134 void WebURLLoaderImpl::loadSynchronously(const WebURLRequest& request,
1135 WebURLResponse& response, 1135 WebURLResponse& response,
1136 WebURLError& error, 1136 WebURLError& error,
1137 WebData& data) { 1137 WebData& data,
1138 int64_t& encoded_data_length) {
1138 TRACE_EVENT0("loading", "WebURLLoaderImpl::loadSynchronously"); 1139 TRACE_EVENT0("loading", "WebURLLoaderImpl::loadSynchronously");
1139 SyncLoadResponse sync_load_response; 1140 SyncLoadResponse sync_load_response;
1140 context_->Start(request, &sync_load_response); 1141 context_->Start(request, &sync_load_response);
1141 1142
1142 const GURL& final_url = sync_load_response.url; 1143 const GURL& final_url = sync_load_response.url;
1143 1144
1144 // TODO(tc): For file loads, we may want to include a more descriptive 1145 // TODO(tc): For file loads, we may want to include a more descriptive
1145 // status code or status text. 1146 // status code or status text.
1146 int error_code = sync_load_response.error_code; 1147 int error_code = sync_load_response.error_code;
1147 if (error_code != net::OK) { 1148 if (error_code != net::OK) {
1148 response.setURL(final_url); 1149 response.setURL(final_url);
1149 error.domain = WebString::fromUTF8(net::kErrorDomain); 1150 error.domain = WebString::fromUTF8(net::kErrorDomain);
1150 error.reason = error_code; 1151 error.reason = error_code;
1151 error.unreachableURL = final_url; 1152 error.unreachableURL = final_url;
1152 return; 1153 return;
1153 } 1154 }
1154 1155
1155 PopulateURLResponse(final_url, sync_load_response, &response, 1156 PopulateURLResponse(final_url, sync_load_response, &response,
1156 request.reportRawHeaders()); 1157 request.reportRawHeaders());
1157 response.addToEncodedBodyLength(sync_load_response.encoded_body_length); 1158 response.addToEncodedBodyLength(sync_load_response.encoded_body_length);
1158 response.addToDecodedBodyLength(sync_load_response.data.size()); 1159 response.addToDecodedBodyLength(sync_load_response.data.size());
1160 encoded_data_length = sync_load_response.encoded_data_length;
1159 1161
1160 data.assign(sync_load_response.data.data(), sync_load_response.data.size()); 1162 data.assign(sync_load_response.data.data(), sync_load_response.data.size());
1161 } 1163 }
1162 1164
1163 void WebURLLoaderImpl::loadAsynchronously(const WebURLRequest& request, 1165 void WebURLLoaderImpl::loadAsynchronously(const WebURLRequest& request,
1164 WebURLLoaderClient* client) { 1166 WebURLLoaderClient* client) {
1165 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::loadAsynchronously", 1167 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::loadAsynchronously",
1166 this, TRACE_EVENT_FLAG_FLOW_OUT); 1168 this, TRACE_EVENT_FLAG_FLOW_OUT);
1167 DCHECK(!context_->client()); 1169 DCHECK(!context_->client());
1168 1170
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 response->clearHTTPHeaderField(webStringName); 1234 response->clearHTTPHeaderField(webStringName);
1233 while (response_headers->EnumerateHeader(&iterator, name, &value)) { 1235 while (response_headers->EnumerateHeader(&iterator, name, &value)) {
1234 response->addHTTPHeaderField(webStringName, 1236 response->addHTTPHeaderField(webStringName,
1235 WebString::fromLatin1(value)); 1237 WebString::fromLatin1(value));
1236 } 1238 }
1237 } 1239 }
1238 return true; 1240 return true;
1239 } 1241 }
1240 1242
1241 } // namespace content 1243 } // namespace content
OLDNEW
« no previous file with comments | « content/child/web_url_loader_impl.h ('k') | content/child/web_url_loader_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698