Implement timers by posting delayed tasks
[chromium-blink-merge.git] / third_party / WebKit / Source / core / fetch / CachedMetadataHandler.h
blob96a5122065b4c19acb919c4c4070d119cd306f37
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.
5 #ifndef CachedMetadataHandler_h
6 #define CachedMetadataHandler_h
8 #include "wtf/Forward.h"
10 namespace blink {
12 class CachedMetadata;
14 // Handler class for caching operations.
15 class CachedMetadataHandler {
16 public:
17 enum CacheType {
18 SendToPlatform, // send cache data to blink::Platform::cacheMetadata
19 CacheLocally // cache only in Resource's member variables
21 virtual ~CachedMetadataHandler() { }
22 // Caches the given metadata in association with this resource and suggests
23 // that the platform persist it. The dataTypeID is a pseudo-randomly chosen
24 // identifier that is used to distinguish data generated by the caller.
25 virtual void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CacheType = SendToPlatform) = 0;
26 // Reset existing metadata, to allow setting new data.
27 virtual void clearCachedMetadata(CacheType = CacheLocally) = 0;
28 // Returns cached metadata of the given type associated with this resource.
29 virtual CachedMetadata* cachedMetadata(unsigned dataTypeID) const = 0;
30 // Returns the encoding to which the cache is specific.
31 virtual String encoding() const = 0;
33 protected:
34 CachedMetadataHandler() { }
38 #endif // CachedMetadataHandler_h