Chromium Code Reviews| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 | 119 |
| 120 // This url can have a fragment, but it can match resources that differ by t he fragment only. | 120 // This url can have a fragment, but it can match resources that differ by t he fragment only. |
| 121 const KURL& url() const { return m_resourceRequest.url();} | 121 const KURL& url() const { return m_resourceRequest.url();} |
| 122 Type getType() const { return static_cast<Type>(m_type); } | 122 Type getType() const { return static_cast<Type>(m_type); } |
| 123 const ResourceLoaderOptions& options() const { return m_options; } | 123 const ResourceLoaderOptions& options() const { return m_options; } |
| 124 ResourceLoaderOptions& mutableOptions() { return m_options; } | 124 ResourceLoaderOptions& mutableOptions() { return m_options; } |
| 125 | 125 |
| 126 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); | 126 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); |
| 127 virtual ResourcePriority priorityFromObservers() { return ResourcePriority() ; } | 127 virtual ResourcePriority priorityFromObservers() { return ResourcePriority() ; } |
| 128 | 128 |
| 129 void addClient(ResourceClient*); | 129 // |passive| indicates that the client should not affect whether a preload |
| 130 // considers itself referenced. | |
| 131 void addClient(ResourceClient*, bool passive = false); | |
|
hiroshige
2016/06/17 12:15:17
Defining and using enum instead of |bool| will be
Charlie Harrison
2016/07/13 18:18:14
Done.
| |
| 130 void removeClient(ResourceClient*); | 132 void removeClient(ResourceClient*); |
| 131 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } | 133 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } |
| 132 | 134 |
| 133 enum PreloadResult { | 135 enum PreloadResult { |
| 134 PreloadNotReferenced, | 136 PreloadNotReferenced, |
| 135 PreloadReferenced, | 137 PreloadReferenced, |
| 136 PreloadReferencedWhileLoading, | 138 PreloadReferencedWhileLoading, |
| 137 PreloadReferencedWhileComplete | 139 PreloadReferencedWhileComplete |
| 138 }; | 140 }; |
| 139 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m _preloadResult); } | 141 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m _preloadResult); } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 | 249 |
| 248 virtual void destroyDecodedDataForFailedRevalidation() { } | 250 virtual void destroyDecodedDataForFailedRevalidation() { } |
| 249 | 251 |
| 250 void setEncodedSize(size_t); | 252 void setEncodedSize(size_t); |
| 251 void setDecodedSize(size_t); | 253 void setDecodedSize(size_t); |
| 252 void didAccessDecodedData(); | 254 void didAccessDecodedData(); |
| 253 | 255 |
| 254 void finishPendingClients(); | 256 void finishPendingClients(); |
| 255 | 257 |
| 256 virtual void didAddClient(ResourceClient*); | 258 virtual void didAddClient(ResourceClient*); |
| 257 void willAddClientOrObserver(); | 259 void willAddClientOrObserver(bool passive = false); |
|
hiroshige
2016/06/17 12:15:17
Please do not set default value for |passive| here
Charlie Harrison
2016/07/13 18:18:14
Done.
| |
| 258 | 260 |
| 259 // |this| object may be dead after didRemoveClientOrObserver(). | 261 // |this| object may be dead after didRemoveClientOrObserver(). |
| 260 void didRemoveClientOrObserver(); | 262 void didRemoveClientOrObserver(); |
| 261 virtual void allClientsAndObserversRemoved(); | 263 virtual void allClientsAndObserversRemoved(); |
| 262 | 264 |
| 263 HashCountedSet<ResourceClient*> m_clients; | 265 HashCountedSet<ResourceClient*> m_clients; |
| 264 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; | 266 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; |
| 265 HashCountedSet<ResourceClient*> m_finishedClients; | 267 HashCountedSet<ResourceClient*> m_finishedClients; |
| 266 | 268 |
| 267 bool hasClient(ResourceClient* client) { return m_clients.contains(client) | | m_clientsAwaitingCallback.contains(client) || m_finishedClients.contains(clien t); } | 269 bool hasClient(ResourceClient* client) { return m_clients.contains(client) | | m_clientsAwaitingCallback.contains(client) || m_finishedClients.contains(clien t); } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 | 359 |
| 358 Resource::Type m_type; | 360 Resource::Type m_type; |
| 359 }; | 361 }; |
| 360 | 362 |
| 361 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 363 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
| 362 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); | 364 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); |
| 363 | 365 |
| 364 } // namespace blink | 366 } // namespace blink |
| 365 | 367 |
| 366 #endif | 368 #endif |
| OLD | NEW |