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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 const ResourceRequest& lastResourceRequest() const; | 125 const ResourceRequest& lastResourceRequest() const; |
126 | 126 |
127 void setRevalidatingRequest(const ResourceRequest& request) { m_revalidating Request = request; } | 127 void setRevalidatingRequest(const ResourceRequest& request) { m_revalidating Request = request; } |
128 | 128 |
129 const KURL& url() const { return m_resourceRequest.url();} | 129 const KURL& url() const { return m_resourceRequest.url();} |
130 Type getType() const { return static_cast<Type>(m_type); } | 130 Type getType() const { return static_cast<Type>(m_type); } |
131 const ResourceLoaderOptions& options() const { return m_options; } | 131 const ResourceLoaderOptions& options() const { return m_options; } |
132 void setOptions(const ResourceLoaderOptions& options) { m_options = options; } | 132 void setOptions(const ResourceLoaderOptions& options) { m_options = options; } |
133 | 133 |
134 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); | 134 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); |
135 ResourcePriority priorityFromClients(); | 135 virtual ResourcePriority priorityFromObservers() { return ResourcePriority() ; } |
136 | 136 |
137 void addClient(ResourceClient*); | 137 void addClient(ResourceClient*); |
138 void removeClient(ResourceClient*); | 138 void removeClient(ResourceClient*); |
139 bool hasClients() const { return !m_clients.isEmpty() || !m_clientsAwaitingC allback.isEmpty() || !m_finishedClients.isEmpty(); } | 139 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } |
140 | 140 |
141 enum PreloadResult { | 141 enum PreloadResult { |
142 PreloadNotReferenced, | 142 PreloadNotReferenced, |
143 PreloadReferenced, | 143 PreloadReferenced, |
144 PreloadReferencedWhileLoading, | 144 PreloadReferencedWhileLoading, |
145 PreloadReferencedWhileComplete | 145 PreloadReferencedWhileComplete |
146 }; | 146 }; |
147 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m _preloadResult); } | 147 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m _preloadResult); } |
148 | 148 |
149 virtual void didAddClient(ResourceClient*); | 149 virtual void didAddClient(ResourceClient*); |
150 virtual void didRemoveClient(ResourceClient*) { } | 150 |
151 virtual void allClientsRemoved(); | 151 // |this| object may be dead after didRemoveClient(). |
yhirano
2016/03/02 01:20:52
didRemoveClientOrObserver
hiroshige
2016/03/12 01:03:36
Done.
| |
152 void didRemoveClientOrObserver(); | |
153 virtual void allClientsAndObserversRemoved(); | |
152 | 154 |
153 unsigned count() const { return m_clients.size(); } | 155 unsigned count() const { return m_clients.size(); } |
154 | 156 |
155 Status getStatus() const { return static_cast<Status>(m_status); } | 157 Status getStatus() const { return static_cast<Status>(m_status); } |
156 void setStatus(Status status) { m_status = status; } | 158 void setStatus(Status status) { m_status = status; } |
157 | 159 |
158 size_t size() const { return encodedSize() + decodedSize() + overheadSize(); } | 160 size_t size() const { return encodedSize() + decodedSize() + overheadSize(); } |
159 size_t encodedSize() const { return m_encodedSize; } | 161 size_t encodedSize() const { return m_encodedSize; } |
160 size_t decodedSize() const { return m_decodedSize; } | 162 size_t decodedSize() const { return m_decodedSize; } |
161 size_t overheadSize() const; | 163 size_t overheadSize() const; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 virtual void checkNotify(); | 274 virtual void checkNotify(); |
273 | 275 |
274 virtual void destroyDecodedDataForFailedRevalidation() { } | 276 virtual void destroyDecodedDataForFailedRevalidation() { } |
275 | 277 |
276 void setEncodedSize(size_t); | 278 void setEncodedSize(size_t); |
277 void setDecodedSize(size_t); | 279 void setDecodedSize(size_t); |
278 void didAccessDecodedData(); | 280 void didAccessDecodedData(); |
279 | 281 |
280 void finishPendingClients(); | 282 void finishPendingClients(); |
281 | 283 |
284 void willAddClientOrObserver(); | |
285 | |
282 HashCountedSet<ResourceClient*> m_clients; | 286 HashCountedSet<ResourceClient*> m_clients; |
283 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; | 287 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; |
284 HashCountedSet<ResourceClient*> m_finishedClients; | 288 HashCountedSet<ResourceClient*> m_finishedClients; |
285 | 289 |
286 class ResourceCallback : public NoBaseWillBeGarbageCollectedFinalized<Resour ceCallback> { | 290 class ResourceCallback : public NoBaseWillBeGarbageCollectedFinalized<Resour ceCallback> { |
287 public: | 291 public: |
288 static ResourceCallback* callbackHandler(); | 292 static ResourceCallback* callbackHandler(); |
289 DECLARE_TRACE(); | 293 DECLARE_TRACE(); |
290 void schedule(Resource*); | 294 void schedule(Resource*); |
291 void cancel(Resource*); | 295 void cancel(Resource*); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 Resource::Type m_type; | 402 Resource::Type m_type; |
399 }; | 403 }; |
400 | 404 |
401 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 405 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
402 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); \ | 406 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); \ |
403 inline typeName##Resource* to##typeName##Resource(const RefPtrWillBeRawPtr<R esource>& ptr) { return to##typeName##Resource(ptr.get()); } | 407 inline typeName##Resource* to##typeName##Resource(const RefPtrWillBeRawPtr<R esource>& ptr) { return to##typeName##Resource(ptr.get()); } |
404 | 408 |
405 } // namespace blink | 409 } // namespace blink |
406 | 410 |
407 #endif | 411 #endif |
OLD | NEW |