| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
| 36 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
| 37 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class WebDiscardableMemory; | 41 class WebDiscardableMemory; |
| 42 | 42 |
| 43 } // namespace blink | 43 } // namespace blink |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace blink { |
| 46 | 46 |
| 47 // A simple vector implementation that supports purgeable memory. The vector is | 47 // A simple vector implementation that supports purgeable memory. The vector is |
| 48 // already locked at construction and locking uses an internal counter which | 48 // already locked at construction and locking uses an internal counter which |
| 49 // means that N calls to lock() must be followed by N+1 calls to unlock() to | 49 // means that N calls to lock() must be followed by N+1 calls to unlock() to |
| 50 // actually make the vector purgeable. | 50 // actually make the vector purgeable. |
| 51 class PLATFORM_EXPORT PurgeableVector { | 51 class PLATFORM_EXPORT PurgeableVector { |
| 52 WTF_MAKE_NONCOPYABLE(PurgeableVector); | 52 WTF_MAKE_NONCOPYABLE(PurgeableVector); |
| 53 public: | 53 public: |
| 54 enum PurgeableOption { | 54 enum PurgeableOption { |
| 55 NotPurgeable, | 55 NotPurgeable, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Note that there can't be data both in |m_vector| and | 115 // Note that there can't be data both in |m_vector| and |
| 116 // |m_discardable|, i.e. only one of them is used at a given time. | 116 // |m_discardable|, i.e. only one of them is used at a given time. |
| 117 Vector<char> m_vector; | 117 Vector<char> m_vector; |
| 118 OwnPtr<blink::WebDiscardableMemory> m_discardable; | 118 OwnPtr<blink::WebDiscardableMemory> m_discardable; |
| 119 size_t m_discardableCapacity; | 119 size_t m_discardableCapacity; |
| 120 size_t m_discardableSize; | 120 size_t m_discardableSize; |
| 121 bool m_isPurgeable; | 121 bool m_isPurgeable; |
| 122 int m_locksCount; | 122 int m_locksCount; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 } // namespace WebCore | 125 } // namespace blink |
| 126 | 126 |
| 127 #endif // PurgeableVector_h | 127 #endif // PurgeableVector_h |
| OLD | NEW |