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 type() const { return static_cast<Type>(m_type); } | 130 Type type() 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 priorityFromClients() { 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 // TODO(hiroshige): ClientsOrObservers |
140 virtual bool hasClients() const { return !m_clients.isEmpty() || !m_clientsA waitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } | |
hiroshige
2016/02/20 02:00:19
In this CL, hasClients() counts not only ResourceC
| |
140 | 141 |
141 enum PreloadResult { | 142 enum PreloadResult { |
142 PreloadNotReferenced, | 143 PreloadNotReferenced, |
143 PreloadReferenced, | 144 PreloadReferenced, |
144 PreloadReferencedWhileLoading, | 145 PreloadReferencedWhileLoading, |
145 PreloadReferencedWhileComplete | 146 PreloadReferencedWhileComplete |
146 }; | 147 }; |
147 PreloadResult preloadResult() const { return static_cast<PreloadResult>(m_pr eloadResult); } | 148 PreloadResult preloadResult() const { return static_cast<PreloadResult>(m_pr eloadResult); } |
148 | 149 |
149 virtual void didAddClient(ResourceClient*); | 150 virtual void didAddClient(ResourceClient*); |
150 virtual void didRemoveClient(ResourceClient*) { } | 151 |
152 // |this| object may be dead after didRemoveClient(). | |
153 // TODO(hiroshige): ClientOrObserver | |
154 void didRemoveClient(); | |
155 // TODO(hiroshige): ClientsOrObservers | |
151 virtual void allClientsRemoved(); | 156 virtual void allClientsRemoved(); |
152 | 157 |
153 unsigned count() const { return m_clients.size(); } | 158 unsigned count() const { return m_clients.size(); } |
154 | 159 |
155 Status status() const { return static_cast<Status>(m_status); } | 160 Status status() const { return static_cast<Status>(m_status); } |
156 void setStatus(Status status) { m_status = status; } | 161 void setStatus(Status status) { m_status = status; } |
157 | 162 |
158 size_t size() const { return encodedSize() + decodedSize() + overheadSize(); } | 163 size_t size() const { return encodedSize() + decodedSize() + overheadSize(); } |
159 size_t encodedSize() const { return m_encodedSize; } | 164 size_t encodedSize() const { return m_encodedSize; } |
160 size_t decodedSize() const { return m_decodedSize; } | 165 size_t decodedSize() const { return m_decodedSize; } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 virtual void finishOnePart(); | 276 virtual void finishOnePart(); |
272 | 277 |
273 virtual void destroyDecodedDataForFailedRevalidation() { } | 278 virtual void destroyDecodedDataForFailedRevalidation() { } |
274 | 279 |
275 void setEncodedSize(size_t); | 280 void setEncodedSize(size_t); |
276 void setDecodedSize(size_t); | 281 void setDecodedSize(size_t); |
277 void didAccessDecodedData(); | 282 void didAccessDecodedData(); |
278 | 283 |
279 void finishPendingClients(); | 284 void finishPendingClients(); |
280 | 285 |
286 // TODO(hiroshige): ClientsOrObservers | |
287 void willAddClient(); | |
288 | |
281 HashCountedSet<ResourceClient*> m_clients; | 289 HashCountedSet<ResourceClient*> m_clients; |
282 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; | 290 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; |
283 HashCountedSet<ResourceClient*> m_finishedClients; | 291 HashCountedSet<ResourceClient*> m_finishedClients; |
284 | 292 |
285 class ResourceCallback : public NoBaseWillBeGarbageCollectedFinalized<Resour ceCallback> { | 293 class ResourceCallback : public NoBaseWillBeGarbageCollectedFinalized<Resour ceCallback> { |
286 public: | 294 public: |
287 static ResourceCallback* callbackHandler(); | 295 static ResourceCallback* callbackHandler(); |
288 DECLARE_TRACE(); | 296 DECLARE_TRACE(); |
289 void schedule(Resource*); | 297 void schedule(Resource*); |
290 void cancel(Resource*); | 298 void cancel(Resource*); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 Resource::Type m_type; | 406 Resource::Type m_type; |
399 }; | 407 }; |
400 | 408 |
401 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 409 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
402 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() = = Resource::typeName, resource.type() == Resource::typeName); \ | 410 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() = = Resource::typeName, resource.type() == Resource::typeName); \ |
403 inline typeName##Resource* to##typeName##Resource(const RefPtrWillBeRawPtr<R esource>& ptr) { return to##typeName##Resource(ptr.get()); } | 411 inline typeName##Resource* to##typeName##Resource(const RefPtrWillBeRawPtr<R esource>& ptr) { return to##typeName##Resource(ptr.get()); } |
404 | 412 |
405 } // namespace blink | 413 } // namespace blink |
406 | 414 |
407 #endif | 415 #endif |
OLD | NEW |