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

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

Issue 1707013002: [WIP][SVG 3/4] Allow invalid data: URLs to be served synchronously by Resource::load() Base URL: https://chromium.googlesource.com/chromium/src.git@Loader_SVGImage_Fix2
Patch Set: Created 4 years, 9 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 | « no previous file | 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 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 RefPtr<SharedBuffer> data; 329 RefPtr<SharedBuffer> data;
330 if (substituteData.isValid()) { 330 if (substituteData.isValid()) {
331 mimetype = substituteData.mimeType(); 331 mimetype = substituteData.mimeType();
332 charset = substituteData.textEncoding(); 332 charset = substituteData.textEncoding();
333 data = substituteData.content(); 333 data = substituteData.content();
334 } else { 334 } else {
335 WrappedResourceRequest wrappedRequest(request.resourceRequest()); 335 WrappedResourceRequest wrappedRequest(request.resourceRequest());
336 if (!Platform::current()->canHandleDataURLRequestLocally(wrappedRequest) ) 336 if (!Platform::current()->canHandleDataURLRequestLocally(wrappedRequest) )
337 return nullptr; 337 return nullptr;
338 data = PassRefPtr<SharedBuffer>(Platform::current()->parseDataURL(url, m imetype, charset)); 338 data = PassRefPtr<SharedBuffer>(Platform::current()->parseDataURL(url, m imetype, charset));
339 if (!data) 339 if (!data) {
340 return nullptr; 340 // We don't add |resource| to MemoryCache because it has an error,
341 // but make ResourceFetcher::requestResource() to return this
342 // Resource to make all data font URLs to be resolved synchronously.
343 // https://crbug.com/382170
344 RefPtrWillBeRawPtr<Resource> resource = factory.create(request.resou rceRequest(), request.charset());
345 resource->setNeedsSynchronousCacheHit(substituteData.forceSynchronou sLoad());
346 resource->setOptions(request.options());
Nate Chapin 2016/03/01 19:05:06 Can we do the this and the changes above it earlie
hiroshige 2016/03/01 22:13:14 Done.
347 resource->error(Resource::LoadError);
348 return resource.release();
349 }
341 } 350 }
342 ResourceResponse response(url, mimetype, data->size(), charset, String()); 351 ResourceResponse response(url, mimetype, data->size(), charset, String());
343 response.setHTTPStatusCode(200); 352 response.setHTTPStatusCode(200);
344 response.setHTTPStatusText("OK"); 353 response.setHTTPStatusText("OK");
345 354
346 RefPtrWillBeRawPtr<Resource> resource = factory.create(request.resourceReque st(), request.charset()); 355 RefPtrWillBeRawPtr<Resource> resource = factory.create(request.resourceReque st(), request.charset());
347 resource->setNeedsSynchronousCacheHit(substituteData.forceSynchronousLoad()) ; 356 resource->setNeedsSynchronousCacheHit(substituteData.forceSynchronousLoad()) ;
348 resource->setOptions(request.options()); 357 resource->setOptions(request.options());
349 // FIXME: We should provide a body stream here. 358 // FIXME: We should provide a body stream here.
350 resource->responseReceived(response, nullptr); 359 resource->responseReceived(response, nullptr);
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 visitor->trace(m_loaders); 1226 visitor->trace(m_loaders);
1218 visitor->trace(m_nonBlockingLoaders); 1227 visitor->trace(m_nonBlockingLoaders);
1219 #if ENABLE(OILPAN) 1228 #if ENABLE(OILPAN)
1220 visitor->trace(m_documentResources); 1229 visitor->trace(m_documentResources);
1221 visitor->trace(m_preloads); 1230 visitor->trace(m_preloads);
1222 visitor->trace(m_resourceTimingInfoMap); 1231 visitor->trace(m_resourceTimingInfoMap);
1223 #endif 1232 #endif
1224 } 1233 }
1225 1234
1226 } // namespace blink 1235 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698