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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 friend class WTF::DoublyLinkedListNode<CacheEntry>; | 105 friend class WTF::DoublyLinkedListNode<CacheEntry>; |
106 | 106 |
107 public: | 107 public: |
108 enum CacheType { | 108 enum CacheType { |
109 kTypeDecoder, | 109 kTypeDecoder, |
110 }; | 110 }; |
111 | 111 |
112 CacheEntry(const ImageFrameGenerator* generator, int use_count) | 112 CacheEntry(const ImageFrameGenerator* generator, int use_count) |
113 : generator_(generator), use_count_(use_count), prev_(0), next_(0) {} | 113 : generator_(generator), use_count_(use_count), prev_(0), next_(0) {} |
114 | 114 |
115 virtual ~CacheEntry() { ASSERT(!use_count_); } | 115 virtual ~CacheEntry() { DCHECK(!use_count_); } |
116 | 116 |
117 const ImageFrameGenerator* Generator() const { return generator_; } | 117 const ImageFrameGenerator* Generator() const { return generator_; } |
118 int UseCount() const { return use_count_; } | 118 int UseCount() const { return use_count_; } |
119 void IncrementUseCount() { ++use_count_; } | 119 void IncrementUseCount() { ++use_count_; } |
120 void DecrementUseCount() { | 120 void DecrementUseCount() { |
121 --use_count_; | 121 --use_count_; |
122 ASSERT(use_count_ >= 0); | 122 DCHECK_GE(use_count_, 0); |
123 } | 123 } |
124 | 124 |
125 // FIXME: getSafeSize() returns the size in bytes truncated to a 32-bit | 125 // FIXME: getSafeSize() returns the size in bytes truncated to a 32-bit |
126 // integer. Find a way to get the size in 64-bits. | 126 // integer. Find a way to get the size in 64-bits. |
127 virtual size_t MemoryUsageInBytes() const = 0; | 127 virtual size_t MemoryUsageInBytes() const = 0; |
128 virtual CacheType GetType() const = 0; | 128 virtual CacheType GetType() const = 0; |
129 | 129 |
130 protected: | 130 protected: |
131 const ImageFrameGenerator* generator_; | 131 const ImageFrameGenerator* generator_; |
132 int use_count_; | 132 int use_count_; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // m_heapLimitInBytes | 244 // m_heapLimitInBytes |
245 // m_heapMemoryUsageInBytes | 245 // m_heapMemoryUsageInBytes |
246 // This mutex also protects calls to underlying skBitmap's | 246 // This mutex also protects calls to underlying skBitmap's |
247 // lockPixels()/unlockPixels() as they are not threadsafe. | 247 // lockPixels()/unlockPixels() as they are not threadsafe. |
248 Mutex mutex_; | 248 Mutex mutex_; |
249 }; | 249 }; |
250 | 250 |
251 } // namespace blink | 251 } // namespace blink |
252 | 252 |
253 #endif | 253 #endif |
OLD | NEW |