Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: src/core/SkYUVPlanesCache.cpp

Issue 950363002: Notify resource caches when pixelref genID goes stale (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkResourceCache.cpp ('k') | tests/ImageCacheTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 #include "SkBitmapCache.h"
9 #include "SkResourceCache.h"
8 #include "SkYUVPlanesCache.h" 10 #include "SkYUVPlanesCache.h"
9 #include "SkResourceCache.h"
10 11
11 #define CHECK_LOCAL(localCache, localName, globalName, ...) \ 12 #define CHECK_LOCAL(localCache, localName, globalName, ...) \
12 ((localCache) ? localCache->localName(__VA_ARGS__) : SkResourceCache::global Name(__VA_ARGS__)) 13 ((localCache) ? localCache->localName(__VA_ARGS__) : SkResourceCache::global Name(__VA_ARGS__))
13 14
14 namespace { 15 namespace {
15 static unsigned gYUVPlanesKeyNamespaceLabel; 16 static unsigned gYUVPlanesKeyNamespaceLabel;
16 17
17 struct YUVValue { 18 struct YUVValue {
18 SkYUVPlanesCache::Info fInfo; 19 SkYUVPlanesCache::Info fInfo;
19 SkCachedData* fData; 20 SkCachedData* fData;
20 }; 21 };
21 22
22 struct YUVPlanesKey : public SkResourceCache::Key { 23 struct YUVPlanesKey : public SkResourceCache::Key {
23 YUVPlanesKey(uint32_t genID) 24 YUVPlanesKey(uint32_t genID)
24 : fGenID(genID) 25 : fGenID(genID)
25 { 26 {
26 this->init(&gYUVPlanesKeyNamespaceLabel, sizeof(genID)); 27 this->init(&gYUVPlanesKeyNamespaceLabel, SkMakeResourceCacheSharedIDForB itmap(genID),
28 sizeof(genID));
27 } 29 }
28 30
29 uint32_t fGenID; 31 uint32_t fGenID;
30 }; 32 };
31 33
32 struct YUVPlanesRec : public SkResourceCache::Rec { 34 struct YUVPlanesRec : public SkResourceCache::Rec {
33 YUVPlanesRec(YUVPlanesKey key, SkCachedData* data, SkYUVPlanesCache::Info* i nfo) 35 YUVPlanesRec(YUVPlanesKey key, SkCachedData* data, SkYUVPlanesCache::Info* i nfo)
34 : fKey(key) 36 : fKey(key)
35 { 37 {
36 fValue.fData = data; 38 fValue.fData = data;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 76
75 *info = result.fInfo; 77 *info = result.fInfo;
76 return result.fData; 78 return result.fData;
77 } 79 }
78 80
79 void SkYUVPlanesCache::Add(uint32_t genID, SkCachedData* data, Info* info, 81 void SkYUVPlanesCache::Add(uint32_t genID, SkCachedData* data, Info* info,
80 SkResourceCache* localCache) { 82 SkResourceCache* localCache) {
81 YUVPlanesKey key(genID); 83 YUVPlanesKey key(genID);
82 return CHECK_LOCAL(localCache, add, Add, SkNEW_ARGS(YUVPlanesRec, (key, data , info))); 84 return CHECK_LOCAL(localCache, add, Add, SkNEW_ARGS(YUVPlanesRec, (key, data , info)));
83 } 85 }
OLDNEW
« no previous file with comments | « src/core/SkResourceCache.cpp ('k') | tests/ImageCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698