| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CachedMetadataHandler_h | |
| 6 #define CachedMetadataHandler_h | |
| 7 | |
| 8 #include "platform/heap/Handle.h" | |
| 9 #include "wtf/Forward.h" | |
| 10 #include <stdint.h> | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class CachedMetadata; | |
| 15 | |
| 16 // Handler class for caching operations. | |
| 17 class CachedMetadataHandler | |
| 18 : public GarbageCollectedFinalized<CachedMetadataHandler> { | |
| 19 public: | |
| 20 enum CacheType { | |
| 21 SendToPlatform, // send cache data to blink::Platform::cacheMetadata | |
| 22 CacheLocally // cache only in Resource's member variables | |
| 23 }; | |
| 24 virtual ~CachedMetadataHandler() {} | |
| 25 DEFINE_INLINE_VIRTUAL_TRACE() {} | |
| 26 // Caches the given metadata in association with this resource and suggests | |
| 27 // that the platform persist it. The dataTypeID is a pseudo-randomly chosen | |
| 28 // identifier that is used to distinguish data generated by the caller. | |
| 29 virtual void setCachedMetadata(uint32_t dataTypeID, | |
| 30 const char*, | |
| 31 size_t, | |
| 32 CacheType = SendToPlatform) = 0; | |
| 33 // Reset existing metadata, to allow setting new data. | |
| 34 virtual void clearCachedMetadata(CacheType = CacheLocally) = 0; | |
| 35 // Returns cached metadata of the given type associated with this resource. | |
| 36 // This cached metadata can be pruned at any time. | |
| 37 virtual PassRefPtr<CachedMetadata> cachedMetadata( | |
| 38 uint32_t dataTypeID) const = 0; | |
| 39 // Returns the encoding to which the cache is specific. | |
| 40 virtual String encoding() const = 0; | |
| 41 | |
| 42 protected: | |
| 43 CachedMetadataHandler() {} | |
| 44 }; | |
| 45 } // namespace blink | |
| 46 | |
| 47 #endif // CachedMetadataHandler_h | |
| OLD | NEW |