| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 const ResourceLoaderOptions& options() const { return m_options; } | 113 const ResourceLoaderOptions& options() const { return m_options; } |
| 114 void setOptions(const ResourceLoaderOptions& options) { m_options = options;
} | 114 void setOptions(const ResourceLoaderOptions& options) { m_options = options;
} |
| 115 | 115 |
| 116 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); | 116 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); |
| 117 | 117 |
| 118 void addClient(ResourceClient*); | 118 void addClient(ResourceClient*); |
| 119 void removeClient(ResourceClient*); | 119 void removeClient(ResourceClient*); |
| 120 bool hasClients() const { return !m_clients.isEmpty() || !m_clientsAwaitingC
allback.isEmpty(); } | 120 bool hasClients() const { return !m_clients.isEmpty() || !m_clientsAwaitingC
allback.isEmpty(); } |
| 121 bool deleteIfPossible(); | 121 bool deleteIfPossible(); |
| 122 | 122 |
| 123 enum PreloadResult { | |
| 124 PreloadNotReferenced, | |
| 125 PreloadReferenced, | |
| 126 PreloadReferencedWhileLoading, | |
| 127 PreloadReferencedWhileComplete | |
| 128 }; | |
| 129 PreloadResult preloadResult() const { return static_cast<PreloadResult>(m_pr
eloadResult); } | |
| 130 | |
| 131 virtual void didAddClient(ResourceClient*); | 123 virtual void didAddClient(ResourceClient*); |
| 132 virtual void didRemoveClient(ResourceClient*) { } | 124 virtual void didRemoveClient(ResourceClient*) { } |
| 133 virtual void allClientsRemoved(); | 125 virtual void allClientsRemoved(); |
| 134 | 126 |
| 135 unsigned count() const { return m_clients.size(); } | 127 unsigned count() const { return m_clients.size(); } |
| 136 | 128 |
| 137 Status status() const { return static_cast<Status>(m_status); } | 129 Status status() const { return static_cast<Status>(m_status); } |
| 138 void setStatus(Status status) { m_status = status; } | 130 void setStatus(Status status) { m_status = status; } |
| 139 | 131 |
| 140 size_t size() const { return encodedSize() + decodedSize() + overheadSize();
} | 132 size_t size() const { return encodedSize() + decodedSize() + overheadSize();
} |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 AtomicString accept() const { return m_accept; } | 176 AtomicString accept() const { return m_accept; } |
| 185 void setAccept(const AtomicString& accept) { m_accept = accept; } | 177 void setAccept(const AtomicString& accept) { m_accept = accept; } |
| 186 | 178 |
| 187 bool wasCanceled() const { return m_error.isCancellation(); } | 179 bool wasCanceled() const { return m_error.isCancellation(); } |
| 188 bool errorOccurred() const { return m_status == LoadError || m_status == Dec
odeError; } | 180 bool errorOccurred() const { return m_status == LoadError || m_status == Dec
odeError; } |
| 189 bool loadFailedOrCanceled() { return !m_error.isNull(); } | 181 bool loadFailedOrCanceled() { return !m_error.isNull(); } |
| 190 | 182 |
| 191 DataBufferingPolicy dataBufferingPolicy() const { return m_options.dataBuffe
ringPolicy; } | 183 DataBufferingPolicy dataBufferingPolicy() const { return m_options.dataBuffe
ringPolicy; } |
| 192 void setDataBufferingPolicy(DataBufferingPolicy); | 184 void setDataBufferingPolicy(DataBufferingPolicy); |
| 193 | 185 |
| 194 bool isUnusedPreload() const { return isPreloaded() && preloadResult() == Pr
eloadNotReferenced; } | |
| 195 bool isPreloaded() const { return m_preloadCount; } | |
| 196 void increasePreloadCount() { ++m_preloadCount; } | |
| 197 void decreasePreloadCount() { ASSERT(m_preloadCount); --m_preloadCount; } | |
| 198 | |
| 199 void registerHandle(ResourcePtrBase* h); | 186 void registerHandle(ResourcePtrBase* h); |
| 200 void unregisterHandle(ResourcePtrBase* h); | 187 void unregisterHandle(ResourcePtrBase* h); |
| 201 | 188 |
| 202 bool mustRevalidateDueToCacheHeaders(); | 189 bool mustRevalidateDueToCacheHeaders(); |
| 203 bool canUseCacheValidator(); | 190 bool canUseCacheValidator(); |
| 204 bool isCacheValidator() const { return m_resourceToRevalidate; } | 191 bool isCacheValidator() const { return m_resourceToRevalidate; } |
| 205 Resource* resourceToRevalidate() const { return m_resourceToRevalidate; } | 192 Resource* resourceToRevalidate() const { return m_resourceToRevalidate; } |
| 206 void setResourceToRevalidate(Resource*); | 193 void setResourceToRevalidate(Resource*); |
| 207 bool hasCacheControlNoStoreHeader(); | 194 bool hasCacheControlNoStoreHeader(); |
| 208 | 195 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 304 |
| 318 ResourceError m_error; | 305 ResourceError m_error; |
| 319 | 306 |
| 320 double m_loadFinishTime; | 307 double m_loadFinishTime; |
| 321 | 308 |
| 322 unsigned long m_identifier; | 309 unsigned long m_identifier; |
| 323 | 310 |
| 324 size_t m_encodedSize; | 311 size_t m_encodedSize; |
| 325 size_t m_decodedSize; | 312 size_t m_decodedSize; |
| 326 unsigned m_handleCount; | 313 unsigned m_handleCount; |
| 327 unsigned m_preloadCount; | |
| 328 unsigned m_protectorCount; | 314 unsigned m_protectorCount; |
| 329 | 315 |
| 330 unsigned m_preloadResult : 2; // PreloadResult | |
| 331 unsigned m_requestedFromNetworkingLayer : 1; | 316 unsigned m_requestedFromNetworkingLayer : 1; |
| 332 | 317 |
| 333 unsigned m_loading : 1; | 318 unsigned m_loading : 1; |
| 334 | 319 |
| 335 unsigned m_switchingClientsToRevalidatedResource : 1; | 320 unsigned m_switchingClientsToRevalidatedResource : 1; |
| 336 | 321 |
| 337 unsigned m_type : 4; // Type | 322 unsigned m_type : 4; // Type |
| 338 unsigned m_status : 3; // Status | 323 unsigned m_status : 3; // Status |
| 339 | 324 |
| 340 unsigned m_wasPurged : 1; | 325 unsigned m_wasPurged : 1; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 365 const char* ResourceTypeName(Resource::Type); | 350 const char* ResourceTypeName(Resource::Type); |
| 366 #endif | 351 #endif |
| 367 | 352 |
| 368 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 353 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
| 369 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ | 354 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ |
| 370 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } | 355 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } |
| 371 | 356 |
| 372 } | 357 } |
| 373 | 358 |
| 374 #endif | 359 #endif |
| OLD | NEW |