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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 return false; | 625 return false; |
626 if (policy != Use) | 626 if (policy != Use) |
627 return true; | 627 return true; |
628 if (resource->stillNeedsLoad()) | 628 if (resource->stillNeedsLoad()) |
629 return true; | 629 return true; |
630 return request.options().synchronousPolicy == RequestSynchronously && resour
ce->isLoading(); | 630 return request.options().synchronousPolicy == RequestSynchronously && resour
ce->isLoading(); |
631 } | 631 } |
632 | 632 |
633 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest&
request, ResourceLoadStartType type) | 633 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest&
request, ResourceLoadStartType type) |
634 { | 634 { |
| 635 if (type == ResourceLoadingFromCache) |
| 636 notifyLoadedFromMemoryCache(resource); |
| 637 |
635 if (request.resourceRequest().url().protocolIsData() || (m_documentLoader &&
m_documentLoader->substituteData().isValid())) | 638 if (request.resourceRequest().url().protocolIsData() || (m_documentLoader &&
m_documentLoader->substituteData().isValid())) |
636 return; | 639 return; |
637 | 640 |
638 if (type == ResourceLoadingFromCache && !m_validatedURLs.contains(request.re
sourceRequest().url())) { | 641 if (type == ResourceLoadingFromCache && !m_validatedURLs.contains(request.re
sourceRequest().url())) { |
639 // Resources loaded from memory cache should be reported the first time
they're used. | 642 // Resources loaded from memory cache should be reported the first time
they're used. |
640 RefPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.opt
ions().initiatorInfo.name, monotonicallyIncreasingTime()); | 643 RefPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.opt
ions().initiatorInfo.name, monotonicallyIncreasingTime()); |
641 populateResourceTiming(info.get(), resource, true); | 644 populateResourceTiming(info.get(), resource, true); |
642 m_scheduledResourceTimingReports.add(info, resource->type() == Resource:
:MainResource); | 645 m_scheduledResourceTimingReports.add(info, resource->type() == Resource:
:MainResource); |
643 if (!m_resourceTimingReportTimer.isActive()) | 646 if (!m_resourceTimingReportTimer.isActive()) |
644 m_resourceTimingReportTimer.startOneShot(0, FROM_HERE); | 647 m_resourceTimingReportTimer.startOneShot(0, FROM_HERE); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 memoryCache()->remove(resource.get()); | 681 memoryCache()->remove(resource.get()); |
679 // Fall through | 682 // Fall through |
680 case Load: | 683 case Load: |
681 resource = loadResource(type, request, request.charset()); | 684 resource = loadResource(type, request, request.charset()); |
682 break; | 685 break; |
683 case Revalidate: | 686 case Revalidate: |
684 resource = revalidateResource(request, resource.get()); | 687 resource = revalidateResource(request, resource.get()); |
685 break; | 688 break; |
686 case Use: | 689 case Use: |
687 memoryCache()->updateForAccess(resource.get()); | 690 memoryCache()->updateForAccess(resource.get()); |
688 notifyLoadedFromMemoryCache(resource.get()); | |
689 break; | 691 break; |
690 } | 692 } |
691 | 693 |
692 if (!resource) | 694 if (!resource) |
693 return 0; | 695 return 0; |
694 | 696 |
695 if (!resource->hasClients()) | 697 if (!resource->hasClients()) |
696 m_deadStatsRecorder.update(policy); | 698 m_deadStatsRecorder.update(policy); |
697 | 699 |
698 if (policy != Use) | 700 if (policy != Use) |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 } | 1472 } |
1471 } | 1473 } |
1472 | 1474 |
1473 void ResourceFetcher::trace(Visitor* visitor) | 1475 void ResourceFetcher::trace(Visitor* visitor) |
1474 { | 1476 { |
1475 visitor->trace(m_document); | 1477 visitor->trace(m_document); |
1476 ResourceLoaderHost::trace(visitor); | 1478 ResourceLoaderHost::trace(visitor); |
1477 } | 1479 } |
1478 | 1480 |
1479 } | 1481 } |
OLD | NEW |