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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 2105713002: Render process changes for ResourceTiming sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resource_timing_sizes_browser_process
Patch Set: Initialise encoded_body_length for sync XHR to data: URLs Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index 125574198187efcb950f2f282e08add791c2c5f6..c39c3a30b98f2c1422267fb7005687abc458d6cd 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -917,6 +917,11 @@ void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in
if (resource->response().isHTTP() && resource->response().httpStatusCode() < 400) {
populateResourceTiming(info.get(), resource);
info->setLoadFinishTime(finishTime);
+ // encodedDataLength == -1 means "not available".
+ // TODO(ricea): Find cases where it is not available but the
+ // PerformanceResourceTiming spec requires it to be available and
+ // fix them.
+ info->addFinalTransferSize(encodedDataLength == -1 ? 0 : encodedDataLength);
if (resource->options().requestInitiatorContext == DocumentContext)
context().addResourceTiming(*info);
resource->reportResourceTimingToClients(*info);
@@ -1034,7 +1039,7 @@ static bool isManualRedirectFetchRequest(const ResourceRequest& request)
return request.fetchRedirectMode() == WebURLRequest::FetchRedirectModeManual && request.requestContext() == WebURLRequest::RequestContextFetch;
}
-bool ResourceFetcher::willFollowRedirect(Resource* resource, ResourceRequest& newRequest, const ResourceResponse& redirectResponse)
+bool ResourceFetcher::willFollowRedirect(Resource* resource, ResourceRequest& newRequest, const ResourceResponse& redirectResponse, int64_t encodedDataLength)
{
if (!isManualRedirectFetchRequest(resource->resourceRequest())) {
if (!context().canRequest(resource->getType(), newRequest, newRequest.url(), resource->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrictionForType))
@@ -1057,8 +1062,12 @@ bool ResourceFetcher::willFollowRedirect(Resource* resource, ResourceRequest& ne
}
ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resource);
- if (it != m_resourceTimingInfoMap.end())
- it->value->addRedirect(redirectResponse);
+ if (it != m_resourceTimingInfoMap.end()) {
+ RefPtr<SecurityOrigin> originalSecurityOrigin = SecurityOrigin::create(redirectResponse.url());
+ RefPtr<SecurityOrigin> redirectedSecurityOrigin = SecurityOrigin::create(newRequest.url());
+ bool crossOrigin = !redirectedSecurityOrigin->isSameSchemeHostPort(originalSecurityOrigin.get());
+ it->value->addRedirect(redirectResponse, encodedDataLength, crossOrigin);
+ }
willSendRequest(resource->identifier(), newRequest, redirectResponse, resource->options());
return true;
}
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.h ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698