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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const ResourceRequest& lastResourceRequest() const; | 120 const ResourceRequest& lastResourceRequest() const; |
121 | 121 |
122 void setRevalidatingRequest(const ResourceRequest& request) { m_revalidating
Request = request; } | 122 void setRevalidatingRequest(const ResourceRequest& request) { m_revalidating
Request = request; } |
123 | 123 |
124 const KURL& url() const { return m_resourceRequest.url();} | 124 const KURL& url() const { return m_resourceRequest.url();} |
125 Type getType() const { return static_cast<Type>(m_type); } | 125 Type getType() const { return static_cast<Type>(m_type); } |
126 const ResourceLoaderOptions& options() const { return m_options; } | 126 const ResourceLoaderOptions& options() const { return m_options; } |
127 ResourceLoaderOptions& mutableOptions() { return m_options; } | 127 ResourceLoaderOptions& mutableOptions() { return m_options; } |
128 | 128 |
129 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); | 129 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); |
130 ResourcePriority priorityFromClients(); | 130 virtual ResourcePriority priorityFromObservers() { return ResourcePriority()
; } |
131 | 131 |
132 void addClient(ResourceClient*); | 132 void addClient(ResourceClient*); |
133 void removeClient(ResourceClient*); | 133 void removeClient(ResourceClient*); |
134 bool hasClients() const { return !m_clients.isEmpty() || !m_clientsAwaitingC
allback.isEmpty() || !m_finishedClients.isEmpty(); } | 134 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() ||
!m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } |
135 | 135 |
136 enum PreloadResult { | 136 enum PreloadResult { |
137 PreloadNotReferenced, | 137 PreloadNotReferenced, |
138 PreloadReferenced, | 138 PreloadReferenced, |
139 PreloadReferencedWhileLoading, | 139 PreloadReferencedWhileLoading, |
140 PreloadReferencedWhileComplete | 140 PreloadReferencedWhileComplete |
141 }; | 141 }; |
142 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m
_preloadResult); } | 142 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m
_preloadResult); } |
143 | 143 |
144 virtual void didAddClient(ResourceClient*); | |
145 virtual void didRemoveClient(ResourceClient*) { } | |
146 virtual void allClientsRemoved(); | |
147 | |
148 unsigned count() const { return m_clients.size(); } | 144 unsigned count() const { return m_clients.size(); } |
149 | 145 |
150 Status getStatus() const { return static_cast<Status>(m_status); } | 146 Status getStatus() const { return static_cast<Status>(m_status); } |
151 void setStatus(Status status) { m_status = status; } | 147 void setStatus(Status status) { m_status = status; } |
152 | 148 |
153 size_t size() const { return encodedSize() + decodedSize() + overheadSize();
} | 149 size_t size() const { return encodedSize() + decodedSize() + overheadSize();
} |
154 size_t encodedSize() const { return m_encodedSize; } | 150 size_t encodedSize() const { return m_encodedSize; } |
155 size_t decodedSize() const { return m_decodedSize; } | 151 size_t decodedSize() const { return m_decodedSize; } |
156 size_t overheadSize() const; | 152 size_t overheadSize() const; |
157 | 153 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 virtual void checkNotify(); | 255 virtual void checkNotify(); |
260 | 256 |
261 virtual void destroyDecodedDataForFailedRevalidation() { } | 257 virtual void destroyDecodedDataForFailedRevalidation() { } |
262 | 258 |
263 void setEncodedSize(size_t); | 259 void setEncodedSize(size_t); |
264 void setDecodedSize(size_t); | 260 void setDecodedSize(size_t); |
265 void didAccessDecodedData(); | 261 void didAccessDecodedData(); |
266 | 262 |
267 void finishPendingClients(); | 263 void finishPendingClients(); |
268 | 264 |
| 265 virtual void didAddClient(ResourceClient*); |
| 266 void willAddClientOrObserver(); |
| 267 |
| 268 // |this| object may be dead after didRemoveClientOrObserver(). |
| 269 void didRemoveClientOrObserver(); |
| 270 virtual void allClientsAndObserversRemoved(); |
| 271 |
269 HashCountedSet<ResourceClient*> m_clients; | 272 HashCountedSet<ResourceClient*> m_clients; |
270 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; | 273 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; |
271 HashCountedSet<ResourceClient*> m_finishedClients; | 274 HashCountedSet<ResourceClient*> m_finishedClients; |
272 | 275 |
273 class ResourceCallback : public NoBaseWillBeGarbageCollectedFinalized<Resour
ceCallback> { | 276 class ResourceCallback : public NoBaseWillBeGarbageCollectedFinalized<Resour
ceCallback> { |
274 public: | 277 public: |
275 static ResourceCallback* callbackHandler(); | 278 static ResourceCallback* callbackHandler(); |
276 DECLARE_TRACE(); | 279 DECLARE_TRACE(); |
277 void schedule(Resource*); | 280 void schedule(Resource*); |
278 void cancel(Resource*); | 281 void cancel(Resource*); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 Resource::Type m_type; | 380 Resource::Type m_type; |
378 }; | 381 }; |
379 | 382 |
380 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 383 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
381 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType(
) == Resource::typeName, resource.getType() == Resource::typeName); \ | 384 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType(
) == Resource::typeName, resource.getType() == Resource::typeName); \ |
382 inline typeName##Resource* to##typeName##Resource(const RefPtrWillBeRawPtr<R
esource>& ptr) { return to##typeName##Resource(ptr.get()); } | 385 inline typeName##Resource* to##typeName##Resource(const RefPtrWillBeRawPtr<R
esource>& ptr) { return to##typeName##Resource(ptr.get()); } |
383 | 386 |
384 } // namespace blink | 387 } // namespace blink |
385 | 388 |
386 #endif | 389 #endif |
OLD | NEW |