| 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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 return 0; | 689 return 0; |
| 690 } | 690 } |
| 691 | 691 |
| 692 if (!request.resourceRequest().url().protocolIsData() && (!m_documentLoader
|| !m_documentLoader->substituteData().isValid())) { | 692 if (!request.resourceRequest().url().protocolIsData() && (!m_documentLoader
|| !m_documentLoader->substituteData().isValid())) { |
| 693 if (policy == Use && !m_validatedURLs.contains(request.resourceRequest()
.url())) { | 693 if (policy == Use && !m_validatedURLs.contains(request.resourceRequest()
.url())) { |
| 694 // Resources loaded from memory cache should be reported the first t
ime they're used. | 694 // Resources loaded from memory cache should be reported the first t
ime they're used. |
| 695 RefPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request
.options().initiatorInfo.name, monotonicallyIncreasingTime()); | 695 RefPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request
.options().initiatorInfo.name, monotonicallyIncreasingTime()); |
| 696 populateResourceTiming(info.get(), resource.get(), true); | 696 populateResourceTiming(info.get(), resource.get(), true); |
| 697 m_scheduledResourceTimingReports.add(info, resource->type() == Resou
rce::MainResource); | 697 m_scheduledResourceTimingReports.add(info, resource->type() == Resou
rce::MainResource); |
| 698 if (!m_resourceTimingReportTimer.isActive()) | 698 if (!m_resourceTimingReportTimer.isActive()) |
| 699 m_resourceTimingReportTimer.startOneShot(0); | 699 m_resourceTimingReportTimer.startOneShot(0, FROM_HERE); |
| 700 } | 700 } |
| 701 | 701 |
| 702 m_validatedURLs.add(request.resourceRequest().url()); | 702 m_validatedURLs.add(request.resourceRequest().url()); |
| 703 } | 703 } |
| 704 | 704 |
| 705 ASSERT(resource->url() == url.string()); | 705 ASSERT(resource->url() == url.string()); |
| 706 m_documentResources.set(resource->url(), resource); | 706 m_documentResources.set(resource->url(), resource); |
| 707 return resource; | 707 return resource; |
| 708 } | 708 } |
| 709 | 709 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 if (frame()) | 1045 if (frame()) |
| 1046 frame()->loader().loadDone(); | 1046 frame()->loader().loadDone(); |
| 1047 scheduleDocumentResourcesGC(); | 1047 scheduleDocumentResourcesGC(); |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 void ResourceFetcher::scheduleDocumentResourcesGC() | 1050 void ResourceFetcher::scheduleDocumentResourcesGC() |
| 1051 { | 1051 { |
| 1052 if (!m_garbageCollectDocumentResourcesTimer.isActive()) | 1052 if (!m_garbageCollectDocumentResourcesTimer.isActive()) |
| 1053 m_garbageCollectDocumentResourcesTimer.startOneShot(0); | 1053 m_garbageCollectDocumentResourcesTimer.startOneShot(0, FROM_HERE); |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 // Garbage collecting m_documentResources is a workaround for the | 1056 // Garbage collecting m_documentResources is a workaround for the |
| 1057 // ResourcePtrs on the RHS being strong references. Ideally this | 1057 // ResourcePtrs on the RHS being strong references. Ideally this |
| 1058 // would be a weak map, however ResourcePtrs perform additional | 1058 // would be a weak map, however ResourcePtrs perform additional |
| 1059 // bookkeeping on Resources, so instead pseudo-GC them -- when the | 1059 // bookkeeping on Resources, so instead pseudo-GC them -- when the |
| 1060 // reference count reaches 1, m_documentResources is the only reference, so | 1060 // reference count reaches 1, m_documentResources is the only reference, so |
| 1061 // remove it from the map. | 1061 // remove it from the map. |
| 1062 void ResourceFetcher::garbageCollectDocumentResourcesTimerFired(Timer<ResourceFe
tcher>* timer) | 1062 void ResourceFetcher::garbageCollectDocumentResourcesTimerFired(Timer<ResourceFe
tcher>* timer) |
| 1063 { | 1063 { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 case Revalidate: | 1399 case Revalidate: |
| 1400 ++m_revalidateCount; | 1400 ++m_revalidateCount; |
| 1401 return; | 1401 return; |
| 1402 case Use: | 1402 case Use: |
| 1403 ++m_useCount; | 1403 ++m_useCount; |
| 1404 return; | 1404 return; |
| 1405 } | 1405 } |
| 1406 } | 1406 } |
| 1407 | 1407 |
| 1408 } | 1408 } |
| OLD | NEW |