OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 // Locks the cache for safety, but does not attempt to lock the object we're
checking for. | 110 // Locks the cache for safety, but does not attempt to lock the object we're
checking for. |
111 bool isCached(const ImageFrameGenerator*, const SkISize& scaledSize, size_t
index); | 111 bool isCached(const ImageFrameGenerator*, const SkISize& scaledSize, size_t
index); |
112 | 112 |
113 // Remove all cache entries indexed by ImageFrameGenerator. | 113 // Remove all cache entries indexed by ImageFrameGenerator. |
114 void removeCacheIndexedByGenerator(const ImageFrameGenerator*); | 114 void removeCacheIndexedByGenerator(const ImageFrameGenerator*); |
115 | 115 |
116 void clear(); | 116 void clear(); |
117 void setCacheLimitInBytes(size_t); | 117 void setCacheLimitInBytes(size_t); |
118 size_t memoryUsageInBytes(); | 118 size_t memoryUsageInBytes(); |
119 unsigned cacheEntries(); | 119 int cacheEntries(); |
120 unsigned imageCacheEntries(); | 120 int imageCacheEntries(); |
121 unsigned decoderCacheEntries(); | 121 int decoderCacheEntries(); |
122 | 122 |
123 private: | 123 private: |
124 // Image cache entry is identified by: | 124 // Image cache entry is identified by: |
125 // 1. Pointer to ImageFrameGenerator. | 125 // 1. Pointer to ImageFrameGenerator. |
126 // 2. Size of the image. | 126 // 2. Size of the image. |
127 // 3. Frame index. | 127 // 3. Frame index. |
128 // 4. Frame generation. Increments on each progressive decode. | 128 // 4. Frame generation. Increments on each progressive decode. |
129 // | 129 // |
130 // The use of generation ID is to allow multiple versions of an image frame | 130 // The use of generation ID is to allow multiple versions of an image frame |
131 // be stored in the cache. Each generation comes from a progressive decode. | 131 // be stored in the cache. Each generation comes from a progressive decode. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // m_cacheLimitInBytes | 314 // m_cacheLimitInBytes |
315 // m_memoryUsageInBytes | 315 // m_memoryUsageInBytes |
316 // This mutex also protects calls to underlying skBitmap's | 316 // This mutex also protects calls to underlying skBitmap's |
317 // lockPixels()/unlockPixels() as they are not threadsafe. | 317 // lockPixels()/unlockPixels() as they are not threadsafe. |
318 Mutex m_mutex; | 318 Mutex m_mutex; |
319 }; | 319 }; |
320 | 320 |
321 } // namespace WebCore | 321 } // namespace WebCore |
322 | 322 |
323 #endif | 323 #endif |
OLD | NEW |