| 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 TypeDecoder, | 109 TypeDecoder, |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 CacheEntry(const ImageFrameGenerator* generator, int useCount) | 112 CacheEntry(const ImageFrameGenerator* generator, int useCount) |
| 113 : m_generator(generator), m_useCount(useCount), m_prev(0), m_next(0) {} | 113 : m_generator(generator), m_useCount(useCount), m_prev(0), m_next(0) {} |
| 114 | 114 |
| 115 virtual ~CacheEntry() { ASSERT(!m_useCount); } | 115 virtual ~CacheEntry() { DCHECK(!m_useCount); } |
| 116 | 116 |
| 117 const ImageFrameGenerator* generator() const { return m_generator; } | 117 const ImageFrameGenerator* generator() const { return m_generator; } |
| 118 int useCount() const { return m_useCount; } | 118 int useCount() const { return m_useCount; } |
| 119 void incrementUseCount() { ++m_useCount; } | 119 void incrementUseCount() { ++m_useCount; } |
| 120 void decrementUseCount() { | 120 void decrementUseCount() { |
| 121 --m_useCount; | 121 --m_useCount; |
| 122 ASSERT(m_useCount >= 0); | 122 DCHECK_GE(m_useCount, 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 type() const = 0; | 128 virtual CacheType type() const = 0; |
| 129 | 129 |
| 130 protected: | 130 protected: |
| 131 const ImageFrameGenerator* m_generator; | 131 const ImageFrameGenerator* m_generator; |
| 132 int m_useCount; | 132 int m_useCount; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // m_heapLimitInBytes | 246 // m_heapLimitInBytes |
| 247 // m_heapMemoryUsageInBytes | 247 // m_heapMemoryUsageInBytes |
| 248 // This mutex also protects calls to underlying skBitmap's | 248 // This mutex also protects calls to underlying skBitmap's |
| 249 // lockPixels()/unlockPixels() as they are not threadsafe. | 249 // lockPixels()/unlockPixels() as they are not threadsafe. |
| 250 Mutex m_mutex; | 250 Mutex m_mutex; |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 } // namespace blink | 253 } // namespace blink |
| 254 | 254 |
| 255 #endif | 255 #endif |
| OLD | NEW |