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_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ | 5 #ifndef CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ |
6 #define CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ | 6 #define CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ |
7 | 7 |
8 #include "base/memory/discardable_memory_allocator.h" | 8 #include "base/memory/discardable_memory_allocator.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 33 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
34 base::trace_event::ProcessMemoryDump* pmd) override; | 34 base::trace_event::ProcessMemoryDump* pmd) override; |
35 | 35 |
36 // Release memory and associated resources that have been purged. | 36 // Release memory and associated resources that have been purged. |
37 void ReleaseFreeMemory(); | 37 void ReleaseFreeMemory(); |
38 | 38 |
39 bool LockSpan(DiscardableSharedMemoryHeap::Span* span); | 39 bool LockSpan(DiscardableSharedMemoryHeap::Span* span); |
40 void UnlockSpan(DiscardableSharedMemoryHeap::Span* span); | 40 void UnlockSpan(DiscardableSharedMemoryHeap::Span* span); |
41 void ReleaseSpan(scoped_ptr<DiscardableSharedMemoryHeap::Span> span); | 41 void ReleaseSpan(scoped_ptr<DiscardableSharedMemoryHeap::Span> span); |
42 | 42 |
| 43 base::trace_event::MemoryAllocatorDump* CreateMemoryAllocatorDump( |
| 44 DiscardableSharedMemoryHeap::Span* span, |
| 45 const char* name, |
| 46 base::trace_event::ProcessMemoryDump* pmd) const; |
| 47 |
43 private: | 48 private: |
44 scoped_ptr<base::DiscardableSharedMemory> | 49 scoped_ptr<base::DiscardableSharedMemory> |
45 AllocateLockedDiscardableSharedMemory(size_t size, | 50 AllocateLockedDiscardableSharedMemory(size_t size, |
46 DiscardableSharedMemoryId id); | 51 DiscardableSharedMemoryId id); |
47 void MemoryUsageChanged(size_t new_bytes_allocated, | 52 void MemoryUsageChanged(size_t new_bytes_allocated, |
48 size_t new_bytes_free) const; | 53 size_t new_bytes_free) const; |
49 | 54 |
50 mutable base::Lock lock_; | 55 mutable base::Lock lock_; |
51 DiscardableSharedMemoryHeap heap_; | 56 DiscardableSharedMemoryHeap heap_; |
52 scoped_refptr<ThreadSafeSender> sender_; | 57 scoped_refptr<ThreadSafeSender> sender_; |
53 | 58 |
54 DISALLOW_COPY_AND_ASSIGN(ChildDiscardableSharedMemoryManager); | 59 DISALLOW_COPY_AND_ASSIGN(ChildDiscardableSharedMemoryManager); |
55 }; | 60 }; |
56 | 61 |
57 } // namespace content | 62 } // namespace content |
58 | 63 |
59 #endif // CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ | 64 #endif // CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ |
OLD | NEW |