| OLD | NEW |
| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 blink::WebString mimetype; | 164 blink::WebString mimetype; |
| 165 blink::WebString charset; | 165 blink::WebString charset; |
| 166 RefPtr<SharedBuffer> data = PassRefPtr<SharedBuffer>(blink::Platform::curren
t()->parseDataURL(url, mimetype, charset)); | 166 RefPtr<SharedBuffer> data = PassRefPtr<SharedBuffer>(blink::Platform::curren
t()->parseDataURL(url, mimetype, charset)); |
| 167 if (!data) | 167 if (!data) |
| 168 return nullptr; | 168 return nullptr; |
| 169 ResourceResponse response(url, mimetype, data->size(), charset, String()); | 169 ResourceResponse response(url, mimetype, data->size(), charset, String()); |
| 170 | 170 |
| 171 Resource* resource = createResource(Resource::Image, request, charset); | 171 Resource* resource = createResource(Resource::Image, request, charset); |
| 172 resource->setOptions(resourceOptions); | 172 resource->setOptions(resourceOptions); |
| 173 resource->responseReceived(response); | 173 // FIXME: We should provide a body stream here. |
| 174 resource->responseReceived(response, nullptr); |
| 174 if (data->size()) | 175 if (data->size()) |
| 175 resource->setResourceBuffer(data); | 176 resource->setResourceBuffer(data); |
| 176 resource->setCacheIdentifier(cacheIdentifier); | 177 resource->setCacheIdentifier(cacheIdentifier); |
| 177 resource->finish(); | 178 resource->finish(); |
| 178 return resource; | 179 return resource; |
| 179 } | 180 } |
| 180 | 181 |
| 181 static void populateResourceTiming(ResourceTimingInfo* info, Resource* resource,
bool clearLoadTimings) | 182 static void populateResourceTiming(ResourceTimingInfo* info, Resource* resource,
bool clearLoadTimings) |
| 182 { | 183 { |
| 183 info->setInitialRequest(resource->resourceRequest()); | 184 info->setInitialRequest(resource->resourceRequest()); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 const String cacheIdentifier = getCacheIdentifier(); | 430 const String cacheIdentifier = getCacheIdentifier(); |
| 430 const KURL& url = request.url(); | 431 const KURL& url = request.url(); |
| 431 if (Resource* oldResource = memoryCache()->resourceForURL(url, cacheIdentifi
er)) | 432 if (Resource* oldResource = memoryCache()->resourceForURL(url, cacheIdentifi
er)) |
| 432 memoryCache()->remove(oldResource); | 433 memoryCache()->remove(oldResource); |
| 433 | 434 |
| 434 ResourceResponse response(url, substituteData.mimeType(), substituteData.con
tent()->size(), substituteData.textEncoding(), emptyString()); | 435 ResourceResponse response(url, substituteData.mimeType(), substituteData.con
tent()->size(), substituteData.textEncoding(), emptyString()); |
| 435 ResourcePtr<Resource> resource = createResource(Resource::MainResource, requ
est.resourceRequest(), substituteData.textEncoding()); | 436 ResourcePtr<Resource> resource = createResource(Resource::MainResource, requ
est.resourceRequest(), substituteData.textEncoding()); |
| 436 resource->setNeedsSynchronousCacheHit(substituteData.forceSynchronousLoad())
; | 437 resource->setNeedsSynchronousCacheHit(substituteData.forceSynchronousLoad())
; |
| 437 resource->setOptions(request.options()); | 438 resource->setOptions(request.options()); |
| 438 resource->setDataBufferingPolicy(BufferData); | 439 resource->setDataBufferingPolicy(BufferData); |
| 439 resource->responseReceived(response); | 440 resource->responseReceived(response, nullptr); |
| 440 if (substituteData.content()->size()) | 441 if (substituteData.content()->size()) |
| 441 resource->setResourceBuffer(substituteData.content()); | 442 resource->setResourceBuffer(substituteData.content()); |
| 442 resource->setCacheIdentifier(cacheIdentifier); | 443 resource->setCacheIdentifier(cacheIdentifier); |
| 443 resource->finish(); | 444 resource->finish(); |
| 444 memoryCache()->add(resource.get()); | 445 memoryCache()->add(resource.get()); |
| 445 } | 446 } |
| 446 | 447 |
| 447 bool ResourceFetcher::canRequest(Resource::Type type, const ResourceRequest& res
ourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forPre
load, FetchRequest::OriginRestriction originRestriction) const | 448 bool ResourceFetcher::canRequest(Resource::Type type, const ResourceRequest& res
ourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forPre
load, FetchRequest::OriginRestriction originRestriction) const |
| 448 { | 449 { |
| 449 SecurityOrigin* securityOrigin = options.securityOrigin.get(); | 450 SecurityOrigin* securityOrigin = options.securityOrigin.get(); |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 | 1561 |
| 1561 void ResourceFetcher::trace(Visitor* visitor) | 1562 void ResourceFetcher::trace(Visitor* visitor) |
| 1562 { | 1563 { |
| 1563 visitor->trace(m_document); | 1564 visitor->trace(m_document); |
| 1564 visitor->trace(m_loaders); | 1565 visitor->trace(m_loaders); |
| 1565 visitor->trace(m_multipartLoaders); | 1566 visitor->trace(m_multipartLoaders); |
| 1566 ResourceLoaderHost::trace(visitor); | 1567 ResourceLoaderHost::trace(visitor); |
| 1567 } | 1568 } |
| 1568 | 1569 |
| 1569 } | 1570 } |
| OLD | NEW |