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) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
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 | 6 |
7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() ||
!m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } | 136 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() ||
!m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } |
137 | 137 |
138 enum PreloadResult { | 138 enum PreloadResult { |
139 PreloadNotReferenced, | 139 PreloadNotReferenced, |
140 PreloadReferenced, | 140 PreloadReferenced, |
141 PreloadReferencedWhileLoading, | 141 PreloadReferencedWhileLoading, |
142 PreloadReferencedWhileComplete | 142 PreloadReferencedWhileComplete |
143 }; | 143 }; |
144 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m
_preloadResult); } | 144 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m
_preloadResult); } |
145 | 145 |
146 unsigned count() const { return m_clients.size(); } | |
147 | |
148 Status getStatus() const { return static_cast<Status>(m_status); } | 146 Status getStatus() const { return static_cast<Status>(m_status); } |
149 void setStatus(Status status) { m_status = status; } | 147 void setStatus(Status status) { m_status = status; } |
150 | 148 |
151 size_t size() const { return encodedSize() + decodedSize() + overheadSize();
} | 149 size_t size() const { return encodedSize() + decodedSize() + overheadSize();
} |
152 size_t encodedSize() const { return m_encodedSize; } | 150 size_t encodedSize() const { return m_encodedSize; } |
153 size_t decodedSize() const { return m_decodedSize; } | 151 size_t decodedSize() const { return m_decodedSize; } |
154 size_t overheadSize() const { return m_overheadSize; } | 152 size_t overheadSize() const { return m_overheadSize; } |
155 | 153 |
156 bool isLoaded() const { return m_status > Pending; } | 154 bool isLoaded() const { return m_status > Pending; } |
157 | 155 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 const ResourceResponse& response() const { return m_response; } | 188 const ResourceResponse& response() const { return m_response; } |
191 | 189 |
192 virtual void reportResourceTimingToClients(const ResourceTimingInfo&) { } | 190 virtual void reportResourceTimingToClients(const ResourceTimingInfo&) { } |
193 | 191 |
194 // Sets the serialized metadata retrieved from the platform's cache. | 192 // Sets the serialized metadata retrieved from the platform's cache. |
195 virtual void setSerializedCachedMetadata(const char*, size_t); | 193 virtual void setSerializedCachedMetadata(const char*, size_t); |
196 | 194 |
197 // This may return nullptr when the resource isn't cacheable. | 195 // This may return nullptr when the resource isn't cacheable. |
198 CachedMetadataHandler* cacheHandler(); | 196 CachedMetadataHandler* cacheHandler(); |
199 | 197 |
200 String reasonNotDeletable() const; | |
201 | |
202 AtomicString httpContentType() const; | 198 AtomicString httpContentType() const; |
203 | 199 |
204 bool wasCanceled() const { return m_error.isCancellation(); } | 200 bool wasCanceled() const { return m_error.isCancellation(); } |
205 bool errorOccurred() const { return m_status == LoadError || m_status == Dec
odeError; } | 201 bool errorOccurred() const { return m_status == LoadError || m_status == Dec
odeError; } |
206 bool loadFailedOrCanceled() { return !m_error.isNull(); } | 202 bool loadFailedOrCanceled() { return !m_error.isNull(); } |
207 | 203 |
208 DataBufferingPolicy getDataBufferingPolicy() const { return m_options.dataBu
fferingPolicy; } | 204 DataBufferingPolicy getDataBufferingPolicy() const { return m_options.dataBu
fferingPolicy; } |
209 void setDataBufferingPolicy(DataBufferingPolicy); | 205 void setDataBufferingPolicy(DataBufferingPolicy); |
210 | 206 |
211 bool isUnusedPreload() const { return isPreloaded() && getPreloadResult() ==
PreloadNotReferenced; } | 207 bool isUnusedPreload() const { return isPreloaded() && getPreloadResult() ==
PreloadNotReferenced; } |
(...skipping 25 matching lines...) Expand all Loading... |
237 double loadFinishTime() const { return m_loadFinishTime; } | 233 double loadFinishTime() const { return m_loadFinishTime; } |
238 | 234 |
239 virtual bool canReuse(const ResourceRequest&) const { return true; } | 235 virtual bool canReuse(const ResourceRequest&) const { return true; } |
240 | 236 |
241 // Used by the MemoryCache to reduce the memory consumption of the entry. | 237 // Used by the MemoryCache to reduce the memory consumption of the entry. |
242 void prune(); | 238 void prune(); |
243 | 239 |
244 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*)
const; | 240 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*)
const; |
245 | 241 |
246 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); | 242 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); |
247 static const char* resourceTypeName(Type); | |
248 | 243 |
249 protected: | 244 protected: |
250 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); | 245 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); |
251 | 246 |
252 virtual void checkNotify(); | 247 virtual void checkNotify(); |
253 | 248 |
254 virtual void destroyDecodedDataForFailedRevalidation() { } | 249 virtual void destroyDecodedDataForFailedRevalidation() { } |
255 | 250 |
256 void setEncodedSize(size_t); | 251 void setEncodedSize(size_t); |
257 void setDecodedSize(size_t); | 252 void setDecodedSize(size_t); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 302 |
308 void cancelTimerFired(Timer<Resource>*); | 303 void cancelTimerFired(Timer<Resource>*); |
309 | 304 |
310 void revalidationSucceeded(const ResourceResponse&); | 305 void revalidationSucceeded(const ResourceResponse&); |
311 void revalidationFailed(); | 306 void revalidationFailed(); |
312 | 307 |
313 size_t calculateOverheadSize() const; | 308 size_t calculateOverheadSize() const; |
314 | 309 |
315 bool unlock(); | 310 bool unlock(); |
316 | 311 |
| 312 String reasonNotDeletable() const; |
| 313 |
317 Member<CachedMetadataHandlerImpl> m_cacheHandler; | 314 Member<CachedMetadataHandlerImpl> m_cacheHandler; |
318 RefPtr<SecurityOrigin> m_fetcherSecurityOrigin; | 315 RefPtr<SecurityOrigin> m_fetcherSecurityOrigin; |
319 | 316 |
320 ResourceError m_error; | 317 ResourceError m_error; |
321 | 318 |
322 double m_loadFinishTime; | 319 double m_loadFinishTime; |
323 | 320 |
324 unsigned long m_identifier; | 321 unsigned long m_identifier; |
325 | 322 |
326 size_t m_encodedSize; | 323 size_t m_encodedSize; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 368 |
372 Resource::Type m_type; | 369 Resource::Type m_type; |
373 }; | 370 }; |
374 | 371 |
375 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 372 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
376 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType(
) == Resource::typeName, resource.getType() == Resource::typeName); | 373 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType(
) == Resource::typeName, resource.getType() == Resource::typeName); |
377 | 374 |
378 } // namespace blink | 375 } // namespace blink |
379 | 376 |
380 #endif | 377 #endif |
OLD | NEW |