| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_HTML_VIEWER_DISCARDABLE_MEMORY_ALLOCATOR_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_DISCARDABLE_MEMORY_ALLOCATOR_H_ |
| 6 #define COMPONENTS_HTML_VIEWER_DISCARDABLE_MEMORY_ALLOCATOR_H_ | 6 #define COMPONENTS_HTML_VIEWER_DISCARDABLE_MEMORY_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 |
| 8 #include <list> | 10 #include <list> |
| 9 | 11 |
| 12 #include "base/macros.h" |
| 10 #include "base/memory/discardable_memory_allocator.h" | 13 #include "base/memory/discardable_memory_allocator.h" |
| 11 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 12 | 15 |
| 13 namespace html_viewer { | 16 namespace html_viewer { |
| 14 | 17 |
| 15 // A discarable memory allocator which will unallocate chunks on new | 18 // A discarable memory allocator which will unallocate chunks on new |
| 16 // allocations. | 19 // allocations. |
| 17 class DiscardableMemoryAllocator : public base::DiscardableMemoryAllocator { | 20 class DiscardableMemoryAllocator : public base::DiscardableMemoryAllocator { |
| 18 public: | 21 public: |
| 19 explicit DiscardableMemoryAllocator(size_t desired_max_memory); | 22 explicit DiscardableMemoryAllocator(size_t desired_max_memory); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // A linked list of unlocked allocated chunks so that the tail is most | 63 // A linked list of unlocked allocated chunks so that the tail is most |
| 61 // recently accessed chunks. | 64 // recently accessed chunks. |
| 62 std::list<DiscardableMemoryChunkImpl*> live_unlocked_chunks_; | 65 std::list<DiscardableMemoryChunkImpl*> live_unlocked_chunks_; |
| 63 | 66 |
| 64 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAllocator); | 67 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAllocator); |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 } // namespace html_viewer | 70 } // namespace html_viewer |
| 68 | 71 |
| 69 #endif // COMPONENTS_HTML_VIEWER_DISCARDABLE_MEMORY_ALLOCATOR_H_ | 72 #endif // COMPONENTS_HTML_VIEWER_DISCARDABLE_MEMORY_ALLOCATOR_H_ |
| OLD | NEW |