| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return WebURLRequest::RequestContextTrack; | 148 return WebURLRequest::RequestContextTrack; |
| 149 case Resource::SVGDocument: | 149 case Resource::SVGDocument: |
| 150 return WebURLRequest::RequestContextImage; | 150 return WebURLRequest::RequestContextImage; |
| 151 case Resource::Media: // TODO: Split this. | 151 case Resource::Media: // TODO: Split this. |
| 152 return WebURLRequest::RequestContextVideo; | 152 return WebURLRequest::RequestContextVideo; |
| 153 } | 153 } |
| 154 ASSERT_NOT_REACHED(); | 154 ASSERT_NOT_REACHED(); |
| 155 return WebURLRequest::RequestContextSubresource; | 155 return WebURLRequest::RequestContextSubresource; |
| 156 } | 156 } |
| 157 | 157 |
| 158 ResourceFetcher::ResourceFetcher(PassOwnPtrWillBeRawPtr<FetchContext> context) | 158 ResourceFetcher::ResourceFetcher(FetchContext* context) |
| 159 : m_context(context) | 159 : m_context(context) |
| 160 , m_garbageCollectDocumentResourcesTimer(this, &ResourceFetcher::garbageColl
ectDocumentResourcesTimerFired) | 160 , m_garbageCollectDocumentResourcesTimer(this, &ResourceFetcher::garbageColl
ectDocumentResourcesTimerFired) |
| 161 , m_resourceTimingReportTimer(this, &ResourceFetcher::resourceTimingReportTi
merFired) | 161 , m_resourceTimingReportTimer(this, &ResourceFetcher::resourceTimingReportTi
merFired) |
| 162 , m_autoLoadImages(true) | 162 , m_autoLoadImages(true) |
| 163 , m_imagesEnabled(true) | 163 , m_imagesEnabled(true) |
| 164 , m_allowStaleResources(false) | 164 , m_allowStaleResources(false) |
| 165 { | 165 { |
| 166 } | 166 } |
| 167 | 167 |
| 168 ResourceFetcher::~ResourceFetcher() | 168 ResourceFetcher::~ResourceFetcher() |
| 169 { | 169 { |
| 170 clearPreloads(); | 170 clearPreloads(); |
| 171 | |
| 172 #if !ENABLE(OILPAN) | |
| 173 // Make sure no requests still point to this ResourceFetcher | |
| 174 // Oilpan: no object reference can be keeping this alive, | |
| 175 // so property trivially holds. | |
| 176 ASSERT(!m_loaders || m_loaders->isEmpty()); | |
| 177 #endif | |
| 178 } | 171 } |
| 179 | 172 |
| 180 Resource* ResourceFetcher::cachedResource(const KURL& resourceURL) const | 173 Resource* ResourceFetcher::cachedResource(const KURL& resourceURL) const |
| 181 { | 174 { |
| 182 KURL url = MemoryCache::removeFragmentIdentifierIfNeeded(resourceURL); | 175 KURL url = MemoryCache::removeFragmentIdentifierIfNeeded(resourceURL); |
| 183 return m_documentResources.get(url).get(); | 176 return m_documentResources.get(url).get(); |
| 184 } | 177 } |
| 185 | 178 |
| 186 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour
ceOrigin, const KURL& url, AccessControlLoggingDecision logErrorsDecision) const | 179 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour
ceOrigin, const KURL& url, AccessControlLoggingDecision logErrorsDecision) const |
| 187 { | 180 { |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 SharedBuffer* data = archiveResource->data(); | 788 SharedBuffer* data = archiveResource->data(); |
| 796 if (data) | 789 if (data) |
| 797 resource->appendData(data->data(), data->size()); | 790 resource->appendData(data->data(), data->size()); |
| 798 resource->finish(); | 791 resource->finish(); |
| 799 return true; | 792 return true; |
| 800 } | 793 } |
| 801 | 794 |
| 802 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in
t64_t encodedDataLength) | 795 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in
t64_t encodedDataLength) |
| 803 { | 796 { |
| 804 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); | 797 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); |
| 805 RefPtrWillBeRawPtr<ResourceFetcher> protect(this); | |
| 806 willTerminateResourceLoader(resource->loader()); | 798 willTerminateResourceLoader(resource->loader()); |
| 807 | 799 |
| 808 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { | 800 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { |
| 809 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); | 801 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); |
| 810 if (it != m_resourceTimingInfoMap.end()) { | 802 if (it != m_resourceTimingInfoMap.end()) { |
| 811 OwnPtr<ResourceTimingInfo> info = it->value.release(); | 803 OwnPtr<ResourceTimingInfo> info = it->value.release(); |
| 812 m_resourceTimingInfoMap.remove(it); | 804 m_resourceTimingInfoMap.remove(it); |
| 813 populateResourceTiming(info.get(), resource, false); | 805 populateResourceTiming(info.get(), resource, false); |
| 814 if (resource->options().requestInitiatorContext == DocumentContext) | 806 if (resource->options().requestInitiatorContext == DocumentContext) |
| 815 context().addResourceTiming(*info); | 807 context().addResourceTiming(*info); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 | 1052 |
| 1061 DEFINE_TRACE(ResourceFetcher) | 1053 DEFINE_TRACE(ResourceFetcher) |
| 1062 { | 1054 { |
| 1063 visitor->trace(m_context); | 1055 visitor->trace(m_context); |
| 1064 visitor->trace(m_archiveResourceCollection); | 1056 visitor->trace(m_archiveResourceCollection); |
| 1065 visitor->trace(m_loaders); | 1057 visitor->trace(m_loaders); |
| 1066 visitor->trace(m_nonBlockingLoaders); | 1058 visitor->trace(m_nonBlockingLoaders); |
| 1067 } | 1059 } |
| 1068 | 1060 |
| 1069 } | 1061 } |
| OLD | NEW |