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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceLoader.cpp

Issue 2390583002: [WIP] WebFonts cache-aware timeout adaption (Closed)
Patch Set: handle case in RemoteFontFaceSource if cache-aware deactivated in startLoad(), rebase Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newURL)); 130 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newURL));
131 } 131 }
132 132
133 bool ResourceLoader::willFollowRedirect( 133 bool ResourceLoader::willFollowRedirect(
134 WebURLLoader*, 134 WebURLLoader*,
135 WebURLRequest& passedNewRequest, 135 WebURLRequest& passedNewRequest,
136 const WebURLResponse& passedRedirectResponse) { 136 const WebURLResponse& passedRedirectResponse) {
137 DCHECK(!passedNewRequest.isNull()); 137 DCHECK(!passedNewRequest.isNull());
138 DCHECK(!passedRedirectResponse.isNull()); 138 DCHECK(!passedRedirectResponse.isNull());
139 139
140 if (m_resource->resourceRequest().isCacheAwareLoadingActivated()) {
141 // Fail as disk cache miss and retry in ResourceFetcher::didFailLoading().
142 WebURLError error;
143 error.reason = 1; // non-zero
kouhei (in TOK) 2016/10/20 10:43:07 Would it be possible to do "error.setIsCacheMiss()
Shao-Chuan Lee 2016/10/21 04:35:02 This WebURLError object will be converted into Res
144 error.isCacheMiss = true;
145 didFail(nullptr, error);
146 return false;
147 }
148
140 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); 149 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest());
141 const ResourceResponse& redirectResponse( 150 const ResourceResponse& redirectResponse(
142 passedRedirectResponse.toResourceResponse()); 151 passedRedirectResponse.toResourceResponse());
143 newRequest.setRedirectStatus( 152 newRequest.setRedirectStatus(
144 ResourceRequest::RedirectStatus::FollowedRedirect); 153 ResourceRequest::RedirectStatus::FollowedRedirect);
145 154
146 const KURL originalURL = newRequest.url(); 155 const KURL originalURL = newRequest.url();
147 156
148 if (!m_fetcher->willFollowRedirect(m_resource.get(), newRequest, 157 if (!m_fetcher->willFollowRedirect(m_resource.get(), newRequest,
149 redirectResponse)) { 158 redirectResponse)) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // a 304, where it will overwrite the cached data we should be reusing. 268 // a 304, where it will overwrite the cached data we should be reusing.
260 if (dataOut.size()) { 269 if (dataOut.size()) {
261 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size(), 270 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size(),
262 encodedDataLength); 271 encodedDataLength);
263 m_resource->setResourceBuffer(dataOut); 272 m_resource->setResourceBuffer(dataOut);
264 } 273 }
265 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); 274 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength);
266 } 275 }
267 276
268 } // namespace blink 277 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698