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, 2008 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2008 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 requestPreload(type, url, charset); | 337 requestPreload(type, url, charset); |
338 } | 338 } |
339 | 339 |
340 void DocLoader::checkForPendingPreloads() | 340 void DocLoader::checkForPendingPreloads() |
341 { | 341 { |
342 unsigned count = m_pendingPreloads.size(); | 342 unsigned count = m_pendingPreloads.size(); |
343 if (!count || !m_doc->body() || !m_doc->body()->renderer()) | 343 if (!count || !m_doc->body() || !m_doc->body()->renderer()) |
344 return; | 344 return; |
345 for (unsigned i = 0; i < count; ++i) { | 345 for (unsigned i = 0; i < count; ++i) { |
346 PendingPreload& preload = m_pendingPreloads[i]; | 346 PendingPreload& preload = m_pendingPreloads[i]; |
347 requestPreload(preload.m_type, preload.m_url, preload.m_charset); | 347 // Don't request preload if the resource already loaded normally (this w
ill result in double load if the page is being reloaded with cached results igno
red). |
| 348 if (!cachedResource(m_doc->completeURL(preload.m_url))) |
| 349 requestPreload(preload.m_type, preload.m_url, preload.m_charset); |
348 } | 350 } |
349 m_pendingPreloads.clear(); | 351 m_pendingPreloads.clear(); |
350 } | 352 } |
351 | 353 |
352 void DocLoader::requestPreload(CachedResource::Type type, const String& url, con
st String& charset) | 354 void DocLoader::requestPreload(CachedResource::Type type, const String& url, con
st String& charset) |
353 { | 355 { |
354 String encoding; | 356 String encoding; |
355 if (type == CachedResource::Script || type == CachedResource::CSSStyleSheet) | 357 if (type == CachedResource::Script || type == CachedResource::CSSStyleSheet) |
356 encoding = charset.isEmpty() ? m_doc->frame()->loader()->encoding() : ch
arset; | 358 encoding = charset.isEmpty() ? m_doc->frame()->loader()->encoding() : ch
arset; |
357 | 359 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 if (scripts) | 432 if (scripts) |
431 printf("SCRIPTS: %d (%d hits, hit rate %d%%)\n", scripts, scripts - scri
ptMisses, (scripts - scriptMisses) * 100 / scripts); | 433 printf("SCRIPTS: %d (%d hits, hit rate %d%%)\n", scripts, scripts - scri
ptMisses, (scripts - scriptMisses) * 100 / scripts); |
432 if (stylesheets) | 434 if (stylesheets) |
433 printf("STYLESHEETS: %d (%d hits, hit rate %d%%)\n", stylesheets, styles
heets - stylesheetMisses, (stylesheets - stylesheetMisses) * 100 / stylesheets); | 435 printf("STYLESHEETS: %d (%d hits, hit rate %d%%)\n", stylesheets, styles
heets - stylesheetMisses, (stylesheets - stylesheetMisses) * 100 / stylesheets); |
434 if (images) | 436 if (images) |
435 printf("IMAGES: %d (%d hits, hit rate %d%%)\n", images, images - imageM
isses, (images - imageMisses) * 100 / images); | 437 printf("IMAGES: %d (%d hits, hit rate %d%%)\n", images, images - imageM
isses, (images - imageMisses) * 100 / images); |
436 } | 438 } |
437 #endif | 439 #endif |
438 | 440 |
439 } | 441 } |
OLD | NEW |