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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 SharedBuffer* data = archiveResource->data(); | 789 SharedBuffer* data = archiveResource->data(); |
797 if (data) | 790 if (data) |
798 resource->appendData(data->data(), data->size()); | 791 resource->appendData(data->data(), data->size()); |
799 resource->finish(); | 792 resource->finish(); |
800 return true; | 793 return true; |
801 } | 794 } |
802 | 795 |
803 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in
t64_t encodedDataLength) | 796 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in
t64_t encodedDataLength) |
804 { | 797 { |
805 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); | 798 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); |
806 RefPtrWillBeRawPtr<ResourceFetcher> protect(this); | |
807 willTerminateResourceLoader(resource->loader()); | 799 willTerminateResourceLoader(resource->loader()); |
808 | 800 |
809 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { | 801 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { |
810 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); | 802 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); |
811 if (it != m_resourceTimingInfoMap.end()) { | 803 if (it != m_resourceTimingInfoMap.end()) { |
812 OwnPtr<ResourceTimingInfo> info = it->value.release(); | 804 OwnPtr<ResourceTimingInfo> info = it->value.release(); |
813 m_resourceTimingInfoMap.remove(it); | 805 m_resourceTimingInfoMap.remove(it); |
814 populateResourceTiming(info.get(), resource, false); | 806 populateResourceTiming(info.get(), resource, false); |
815 context().addResourceTiming(*info); | 807 context().addResourceTiming(*info); |
816 } | 808 } |
(...skipping 242 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 |