| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CachedMetadataHandler_h | 5 #ifndef CachedMetadataHandler_h |
| 6 #define CachedMetadataHandler_h | 6 #define CachedMetadataHandler_h |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 #include "wtf/Forward.h" | 9 #include "wtf/Forward.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class CachedMetadata; | 13 class CachedMetadata; |
| 14 | 14 |
| 15 // Handler class for caching operations. | 15 // Handler class for caching operations. |
| 16 class CachedMetadataHandler : public NoBaseWillBeGarbageCollectedFinalized<Cache
dMetadataHandler> { | 16 class CachedMetadataHandler : public GarbageCollectedFinalized<CachedMetadataHan
dler> { |
| 17 USING_FAST_MALLOC_WILL_BE_REMOVED(CachedMetadataHandler); | |
| 18 public: | 17 public: |
| 19 enum CacheType { | 18 enum CacheType { |
| 20 SendToPlatform, // send cache data to blink::Platform::cacheMetadata | 19 SendToPlatform, // send cache data to blink::Platform::cacheMetadata |
| 21 CacheLocally // cache only in Resource's member variables | 20 CacheLocally // cache only in Resource's member variables |
| 22 }; | 21 }; |
| 23 virtual ~CachedMetadataHandler() { } | 22 virtual ~CachedMetadataHandler() { } |
| 24 DEFINE_INLINE_VIRTUAL_TRACE() { } | 23 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 25 // Caches the given metadata in association with this resource and suggests | 24 // Caches the given metadata in association with this resource and suggests |
| 26 // that the platform persist it. The dataTypeID is a pseudo-randomly chosen | 25 // that the platform persist it. The dataTypeID is a pseudo-randomly chosen |
| 27 // identifier that is used to distinguish data generated by the caller. | 26 // identifier that is used to distinguish data generated by the caller. |
| 28 virtual void setCachedMetadata(unsigned dataTypeID, const char*, size_t, Cac
heType = SendToPlatform) = 0; | 27 virtual void setCachedMetadata(unsigned dataTypeID, const char*, size_t, Cac
heType = SendToPlatform) = 0; |
| 29 // Reset existing metadata, to allow setting new data. | 28 // Reset existing metadata, to allow setting new data. |
| 30 virtual void clearCachedMetadata(CacheType = CacheLocally) = 0; | 29 virtual void clearCachedMetadata(CacheType = CacheLocally) = 0; |
| 31 // Returns cached metadata of the given type associated with this resource. | 30 // Returns cached metadata of the given type associated with this resource. |
| 32 virtual CachedMetadata* cachedMetadata(unsigned dataTypeID) const = 0; | 31 virtual CachedMetadata* cachedMetadata(unsigned dataTypeID) const = 0; |
| 33 // Returns the encoding to which the cache is specific. | 32 // Returns the encoding to which the cache is specific. |
| 34 virtual String encoding() const = 0; | 33 virtual String encoding() const = 0; |
| 35 | 34 |
| 36 protected: | 35 protected: |
| 37 CachedMetadataHandler() { } | 36 CachedMetadataHandler() { } |
| 38 }; | 37 }; |
| 39 } // namespace blink | 38 } // namespace blink |
| 40 | 39 |
| 41 #endif // CachedMetadataHandler_h | 40 #endif // CachedMetadataHandler_h |
| OLD | NEW |