| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 bool LockSpan(DiscardableSharedMemoryHeap::Span* span); | 42 bool LockSpan(DiscardableSharedMemoryHeap::Span* span); |
| 43 void UnlockSpan(DiscardableSharedMemoryHeap::Span* span); | 43 void UnlockSpan(DiscardableSharedMemoryHeap::Span* span); |
| 44 void ReleaseSpan(std::unique_ptr<DiscardableSharedMemoryHeap::Span> span); | 44 void ReleaseSpan(std::unique_ptr<DiscardableSharedMemoryHeap::Span> span); |
| 45 | 45 |
| 46 base::trace_event::MemoryAllocatorDump* CreateMemoryAllocatorDump( | 46 base::trace_event::MemoryAllocatorDump* CreateMemoryAllocatorDump( |
| 47 DiscardableSharedMemoryHeap::Span* span, | 47 DiscardableSharedMemoryHeap::Span* span, |
| 48 const char* name, | 48 const char* name, |
| 49 base::trace_event::ProcessMemoryDump* pmd) const; | 49 base::trace_event::ProcessMemoryDump* pmd) const; |
| 50 | 50 |
| 51 struct Statistics { |
| 52 size_t total_size; |
| 53 size_t freelist_size; |
| 54 }; |
| 55 |
| 56 Statistics GetStatistics() const; |
| 57 |
| 51 private: | 58 private: |
| 52 std::unique_ptr<base::DiscardableSharedMemory> | 59 std::unique_ptr<base::DiscardableSharedMemory> |
| 53 AllocateLockedDiscardableSharedMemory(size_t size, | 60 AllocateLockedDiscardableSharedMemory(size_t size, |
| 54 DiscardableSharedMemoryId id); | 61 DiscardableSharedMemoryId id); |
| 55 void MemoryUsageChanged(size_t new_bytes_allocated, | 62 void MemoryUsageChanged(size_t new_bytes_allocated, |
| 56 size_t new_bytes_free) const; | 63 size_t new_bytes_free) const; |
| 57 | 64 |
| 58 mutable base::Lock lock_; | 65 mutable base::Lock lock_; |
| 59 DiscardableSharedMemoryHeap heap_; | 66 DiscardableSharedMemoryHeap heap_; |
| 60 scoped_refptr<ThreadSafeSender> sender_; | 67 scoped_refptr<ThreadSafeSender> sender_; |
| 61 | 68 |
| 62 DISALLOW_COPY_AND_ASSIGN(ChildDiscardableSharedMemoryManager); | 69 DISALLOW_COPY_AND_ASSIGN(ChildDiscardableSharedMemoryManager); |
| 63 }; | 70 }; |
| 64 | 71 |
| 65 } // namespace content | 72 } // namespace content |
| 66 | 73 |
| 67 #endif // CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ | 74 #endif // CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ |
| OLD | NEW |