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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 SharedBuffer* data = archiveResource->data(); | 787 SharedBuffer* data = archiveResource->data(); |
795 if (data) | 788 if (data) |
796 resource->appendData(data->data(), data->size()); | 789 resource->appendData(data->data(), data->size()); |
797 resource->finish(); | 790 resource->finish(); |
798 return true; | 791 return true; |
799 } | 792 } |
800 | 793 |
801 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in
t64_t encodedDataLength) | 794 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in
t64_t encodedDataLength) |
802 { | 795 { |
803 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); | 796 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); |
804 RefPtrWillBeRawPtr<ResourceFetcher> protect(this); | |
805 willTerminateResourceLoader(resource->loader()); | 797 willTerminateResourceLoader(resource->loader()); |
806 | 798 |
807 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { | 799 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { |
808 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); | 800 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); |
809 if (it != m_resourceTimingInfoMap.end()) { | 801 if (it != m_resourceTimingInfoMap.end()) { |
810 OwnPtr<ResourceTimingInfo> info = it->value.release(); | 802 OwnPtr<ResourceTimingInfo> info = it->value.release(); |
811 m_resourceTimingInfoMap.remove(it); | 803 m_resourceTimingInfoMap.remove(it); |
812 populateResourceTiming(info.get(), resource, false); | 804 populateResourceTiming(info.get(), resource, false); |
813 if (resource->options().requestInitiatorContext == DocumentContext) | 805 if (resource->options().requestInitiatorContext == DocumentContext) |
814 context().addResourceTiming(*info); | 806 context().addResourceTiming(*info); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 | 1051 |
1060 DEFINE_TRACE(ResourceFetcher) | 1052 DEFINE_TRACE(ResourceFetcher) |
1061 { | 1053 { |
1062 visitor->trace(m_context); | 1054 visitor->trace(m_context); |
1063 visitor->trace(m_archiveResourceCollection); | 1055 visitor->trace(m_archiveResourceCollection); |
1064 visitor->trace(m_loaders); | 1056 visitor->trace(m_loaders); |
1065 visitor->trace(m_nonBlockingLoaders); | 1057 visitor->trace(m_nonBlockingLoaders); |
1066 } | 1058 } |
1067 | 1059 |
1068 } | 1060 } |
OLD | NEW |