OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkUrlDataManager_DEFINED | 8 #ifndef SkUrlDataManager_DEFINED |
9 #define SkUrlDataManager_DEFINED | 9 #define SkUrlDataManager_DEFINED |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 /* | 27 /* |
28 * Adds a data blob to the cache with a particular content type. UrlDataMan
ager will hash | 28 * Adds a data blob to the cache with a particular content type. UrlDataMan
ager will hash |
29 * the blob data to ensure uniqueness | 29 * the blob data to ensure uniqueness |
30 */ | 30 */ |
31 SkString addData(SkData*, const char* contentType); | 31 SkString addData(SkData*, const char* contentType); |
32 | 32 |
33 struct UrlData : public SkRefCnt { | 33 struct UrlData : public SkRefCnt { |
34 SkString fUrl; | 34 SkString fUrl; |
35 SkString fContentType; | 35 SkString fContentType; |
36 SkAutoTUnref<SkData> fData; | 36 sk_sp<SkData> fData; |
37 }; | 37 }; |
38 | 38 |
39 /* | 39 /* |
40 * returns the UrlData object which should be hosted at 'url' | 40 * returns the UrlData object which should be hosted at 'url' |
41 */ | 41 */ |
42 UrlData* getDataFromUrl(SkString url) { | 42 UrlData* getDataFromUrl(SkString url) { |
43 return fUrlLookup.find(url); | 43 return fUrlLookup.find(url); |
44 } | 44 } |
45 void reset(); | 45 void reset(); |
46 | 46 |
(...skipping 20 matching lines...) Expand all Loading... |
67 }; | 67 }; |
68 | 68 |
69 | 69 |
70 SkString fRootUrl; | 70 SkString fRootUrl; |
71 SkTDynamicHash<UrlData, SkData, LookupTrait> fCache; | 71 SkTDynamicHash<UrlData, SkData, LookupTrait> fCache; |
72 SkTDynamicHash<UrlData, SkString, ReverseLookupTrait> fUrlLookup; | 72 SkTDynamicHash<UrlData, SkString, ReverseLookupTrait> fUrlLookup; |
73 uint32_t fDataId; | 73 uint32_t fDataId; |
74 }; | 74 }; |
75 | 75 |
76 #endif | 76 #endif |
OLD | NEW |