| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 enum Status { | 77 enum Status { |
| 78 Unknown, // let cache decide what to do with it | 78 Unknown, // let cache decide what to do with it |
| 79 Pending, // only partially loaded | 79 Pending, // only partially loaded |
| 80 Cached, // regular case | 80 Cached, // regular case |
| 81 LoadError, | 81 LoadError, |
| 82 DecodeError | 82 DecodeError |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 enum MetadataCacheType { |
| 86 SendToPlatform, // send cache data to blink::Platform::cacheMetadata |
| 87 CacheLocally // cache only in Resource's member variables |
| 88 }; |
| 89 |
| 85 Resource(const ResourceRequest&, Type); | 90 Resource(const ResourceRequest&, Type); |
| 86 #if ENABLE(OILPAN) | 91 #if ENABLE(OILPAN) |
| 87 virtual ~Resource(); | 92 virtual ~Resource(); |
| 88 #else | 93 #else |
| 89 protected: | 94 protected: |
| 90 // Only deleteIfPossible should delete this. | 95 // Only deleteIfPossible should delete this. |
| 91 virtual ~Resource(); | 96 virtual ~Resource(); |
| 92 public: | 97 public: |
| 93 #endif | 98 #endif |
| 94 virtual void dispose(); | 99 virtual void dispose(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 virtual void responseReceived(const ResourceResponse&); | 193 virtual void responseReceived(const ResourceResponse&); |
| 189 void setResponse(const ResourceResponse& response) { m_response = response;
} | 194 void setResponse(const ResourceResponse& response) { m_response = response;
} |
| 190 const ResourceResponse& response() const { return m_response; } | 195 const ResourceResponse& response() const { return m_response; } |
| 191 | 196 |
| 192 // Sets the serialized metadata retrieved from the platform's cache. | 197 // Sets the serialized metadata retrieved from the platform's cache. |
| 193 void setSerializedCachedMetadata(const char*, size_t); | 198 void setSerializedCachedMetadata(const char*, size_t); |
| 194 | 199 |
| 195 // Caches the given metadata in association with this resource and suggests | 200 // Caches the given metadata in association with this resource and suggests |
| 196 // that the platform persist it. The dataTypeID is a pseudo-randomly chosen | 201 // that the platform persist it. The dataTypeID is a pseudo-randomly chosen |
| 197 // identifier that is used to distinguish data generated by the caller. | 202 // identifier that is used to distinguish data generated by the caller. |
| 198 void setCachedMetadata(unsigned dataTypeID, const char*, size_t); | 203 void setCachedMetadata(unsigned dataTypeID, const char*, size_t, MetadataCac
heType = SendToPlatform); |
| 199 | 204 |
| 200 // Reset existing metadata, to allow setting new data. | 205 // Reset existing metadata, to allow setting new data. |
| 201 void clearCachedMetadata(); | 206 void clearCachedMetadata(); |
| 202 | 207 |
| 203 // Returns cached metadata of the given type associated with this resource. | 208 // Returns cached metadata of the given type associated with this resource. |
| 204 CachedMetadata* cachedMetadata(unsigned dataTypeID) const; | 209 CachedMetadata* cachedMetadata(unsigned dataTypeID) const; |
| 205 | 210 |
| 206 bool hasOneHandle() const; | 211 bool hasOneHandle() const; |
| 207 bool canDelete() const; | 212 bool canDelete() const; |
| 208 | 213 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 const char* ResourceTypeName(Resource::Type); | 416 const char* ResourceTypeName(Resource::Type); |
| 412 #endif | 417 #endif |
| 413 | 418 |
| 414 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 419 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
| 415 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ | 420 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ |
| 416 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } | 421 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } |
| 417 | 422 |
| 418 } | 423 } |
| 419 | 424 |
| 420 #endif | 425 #endif |
| OLD | NEW |