| 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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 if (type == Resource::MainResource) | 1196 if (type == Resource::MainResource) |
| 1197 return; | 1197 return; |
| 1198 | 1198 |
| 1199 String encoding; | 1199 String encoding; |
| 1200 if (type == Resource::Script || type == Resource::CSSStyleSheet) | 1200 if (type == Resource::Script || type == Resource::CSSStyleSheet) |
| 1201 encoding = charset.isEmpty() ? m_document->charset().string() : charset; | 1201 encoding = charset.isEmpty() ? m_document->charset().string() : charset; |
| 1202 | 1202 |
| 1203 request.setCharset(encoding); | 1203 request.setCharset(encoding); |
| 1204 request.setForPreload(true); | 1204 request.setForPreload(true); |
| 1205 | 1205 |
| 1206 ResourcePtr<Resource> resource = requestResource(type, request); | 1206 ResourcePtr<Resource> resource; |
| 1207 // Loading images involves several special cases, so use dedicated fetch met
hod instead. |
| 1208 if (type == Resource::Image) |
| 1209 resource = fetchImage(request); |
| 1210 if (!resource) |
| 1211 resource = requestResource(type, request); |
| 1207 if (!resource || (m_preloads && m_preloads->contains(resource.get()))) | 1212 if (!resource || (m_preloads && m_preloads->contains(resource.get()))) |
| 1208 return; | 1213 return; |
| 1209 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload"); | 1214 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload"); |
| 1210 resource->increasePreloadCount(); | 1215 resource->increasePreloadCount(); |
| 1211 | 1216 |
| 1212 if (!m_preloads) | 1217 if (!m_preloads) |
| 1213 m_preloads = adoptPtr(new ListHashSet<Resource*>); | 1218 m_preloads = adoptPtr(new ListHashSet<Resource*>); |
| 1214 m_preloads->add(resource.get()); | 1219 m_preloads->add(resource.get()); |
| 1215 | 1220 |
| 1216 #if PRELOAD_DEBUG | 1221 #if PRELOAD_DEBUG |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 } | 1490 } |
| 1486 } | 1491 } |
| 1487 | 1492 |
| 1488 void ResourceFetcher::trace(Visitor* visitor) | 1493 void ResourceFetcher::trace(Visitor* visitor) |
| 1489 { | 1494 { |
| 1490 visitor->trace(m_document); | 1495 visitor->trace(m_document); |
| 1491 ResourceLoaderHost::trace(visitor); | 1496 ResourceLoaderHost::trace(visitor); |
| 1492 } | 1497 } |
| 1493 | 1498 |
| 1494 } | 1499 } |
| OLD | NEW |