Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: content/common/host_discardable_shared_memory_manager.h

Issue 807303002: base: Add free list implementation to browser-wide discardable memory system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@discardable-shared-memory-ashmem
Patch Set: rebase Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <vector> 8 #include <vector>
9 9
10 #include "base/memory/discardable_memory_shmem_allocator.h" 10 #include "base/memory/discardable_memory_shmem_allocator.h"
(...skipping 15 matching lines...) Expand all
26 class CONTENT_EXPORT HostDiscardableSharedMemoryManager 26 class CONTENT_EXPORT HostDiscardableSharedMemoryManager
27 : public base::DiscardableMemoryShmemAllocator { 27 : public base::DiscardableMemoryShmemAllocator {
28 public: 28 public:
29 HostDiscardableSharedMemoryManager(); 29 HostDiscardableSharedMemoryManager();
30 ~HostDiscardableSharedMemoryManager() override; 30 ~HostDiscardableSharedMemoryManager() override;
31 31
32 // Returns a singleton instance. 32 // Returns a singleton instance.
33 static HostDiscardableSharedMemoryManager* current(); 33 static HostDiscardableSharedMemoryManager* current();
34 34
35 // Overridden from base::DiscardableMemoryShmemAllocator: 35 // Overridden from base::DiscardableMemoryShmemAllocator:
36 scoped_ptr<base::DiscardableSharedMemory> 36 scoped_ptr<base::DiscardableMemoryShmemChunk> AllocateLockedDiscardableMemory(
37 AllocateLockedDiscardableSharedMemory(size_t size) override; 37 size_t size) override;
38 38
39 // This allocates a discardable memory segment for |process_handle|. 39 // This allocates a discardable memory segment for |process_handle|.
40 // A valid shared memory handle is returned on success. 40 // A valid shared memory handle is returned on success.
41 void AllocateLockedDiscardableSharedMemoryForChild( 41 void AllocateLockedDiscardableSharedMemoryForChild(
42 base::ProcessHandle process_handle, 42 base::ProcessHandle process_handle,
43 size_t size, 43 size_t size,
44 base::SharedMemoryHandle* shared_memory_handle); 44 base::SharedMemoryHandle* shared_memory_handle);
45 45
46 // Call this to notify the manager that child process associated with 46 // Call this to notify the manager that child process associated with
47 // |process_handle| has been removed. The manager will use this to release 47 // |process_handle| has been removed. The manager will use this to release
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; 91 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_;
92 bool enforce_memory_policy_pending_; 92 bool enforce_memory_policy_pending_;
93 base::WeakPtrFactory<HostDiscardableSharedMemoryManager> weak_ptr_factory_; 93 base::WeakPtrFactory<HostDiscardableSharedMemoryManager> weak_ptr_factory_;
94 94
95 DISALLOW_COPY_AND_ASSIGN(HostDiscardableSharedMemoryManager); 95 DISALLOW_COPY_AND_ASSIGN(HostDiscardableSharedMemoryManager);
96 }; 96 };
97 97
98 } // namespace content 98 } // namespace content
99 99
100 #endif // CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_ 100 #endif // CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
OLDNEW
« no previous file with comments | « content/common/discardable_shared_memory_heap_unittest.cc ('k') | content/common/host_discardable_shared_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698