OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ |
6 #define CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ | 6 #define CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 base::Lock lock_; | 130 base::Lock lock_; |
131 typedef base::hash_map<DiscardableSharedMemoryId, | 131 typedef base::hash_map<DiscardableSharedMemoryId, |
132 scoped_refptr<MemorySegment>> MemorySegmentMap; | 132 scoped_refptr<MemorySegment>> MemorySegmentMap; |
133 typedef base::hash_map<int, MemorySegmentMap> ProcessMap; | 133 typedef base::hash_map<int, MemorySegmentMap> ProcessMap; |
134 ProcessMap processes_; | 134 ProcessMap processes_; |
135 // Note: The elements in |segments_| are arranged in such a way that they form | 135 // Note: The elements in |segments_| are arranged in such a way that they form |
136 // a heap. The LRU memory segment always first. | 136 // a heap. The LRU memory segment always first. |
137 typedef std::vector<scoped_refptr<MemorySegment>> MemorySegmentVector; | 137 typedef std::vector<scoped_refptr<MemorySegment>> MemorySegmentVector; |
138 MemorySegmentVector segments_; | 138 MemorySegmentVector segments_; |
| 139 size_t default_memory_limit_; |
139 size_t memory_limit_; | 140 size_t memory_limit_; |
140 size_t bytes_allocated_; | 141 size_t bytes_allocated_; |
141 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 142 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
142 scoped_refptr<base::SingleThreadTaskRunner> | 143 scoped_refptr<base::SingleThreadTaskRunner> |
143 enforce_memory_policy_task_runner_; | 144 enforce_memory_policy_task_runner_; |
144 base::Closure enforce_memory_policy_callback_; | 145 base::Closure enforce_memory_policy_callback_; |
145 bool enforce_memory_policy_pending_; | 146 bool enforce_memory_policy_pending_; |
146 base::WeakPtrFactory<HostDiscardableSharedMemoryManager> weak_ptr_factory_; | 147 base::WeakPtrFactory<HostDiscardableSharedMemoryManager> weak_ptr_factory_; |
147 | 148 |
148 DISALLOW_COPY_AND_ASSIGN(HostDiscardableSharedMemoryManager); | 149 DISALLOW_COPY_AND_ASSIGN(HostDiscardableSharedMemoryManager); |
149 }; | 150 }; |
150 | 151 |
151 } // namespace content | 152 } // namespace content |
152 | 153 |
153 #endif // CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ | 154 #endif // CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ |
OLD | NEW |