OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BASE_MEMORY_MEMORY_CLIENT_REGISTRY_H_ | 5 #ifndef BASE_MEMORY_MEMORY_CLIENT_REGISTRY_H_ |
6 #define BASE_MEMORY_MEMORY_CLIENT_REGISTRY_H_ | 6 #define BASE_MEMORY_MEMORY_CLIENT_REGISTRY_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/memory/memory_coordinator_client.h" | 9 #include "base/memory/memory_coordinator_client.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 ~MemoryCoordinatorClientRegistry(); | 33 ~MemoryCoordinatorClientRegistry(); |
34 | 34 |
35 // Registers/unregisters a client. Does not take ownership of client. | 35 // Registers/unregisters a client. Does not take ownership of client. |
36 void Register(MemoryCoordinatorClient* client); | 36 void Register(MemoryCoordinatorClient* client); |
37 void Unregister(MemoryCoordinatorClient* client); | 37 void Unregister(MemoryCoordinatorClient* client); |
38 | 38 |
39 // Notify clients of a memory state change. | 39 // Notify clients of a memory state change. |
40 void Notify(MemoryState state); | 40 void Notify(MemoryState state); |
41 | 41 |
| 42 // Requests purging memory. |
| 43 void PurgeMemory(); |
| 44 |
42 private: | 45 private: |
43 friend struct DefaultSingletonTraits<MemoryCoordinatorClientRegistry>; | 46 friend struct DefaultSingletonTraits<MemoryCoordinatorClientRegistry>; |
44 | 47 |
45 MemoryCoordinatorClientRegistry(); | 48 MemoryCoordinatorClientRegistry(); |
46 | 49 |
47 using ClientList = ObserverListThreadSafe<MemoryCoordinatorClient>; | 50 using ClientList = ObserverListThreadSafe<MemoryCoordinatorClient>; |
48 scoped_refptr<ClientList> clients_; | 51 scoped_refptr<ClientList> clients_; |
49 }; | 52 }; |
50 | 53 |
51 } // namespace base | 54 } // namespace base |
52 | 55 |
53 #endif // BASE_MEMORY_MEMORY_CLIENT_REGISTRY_H_ | 56 #endif // BASE_MEMORY_MEMORY_CLIENT_REGISTRY_H_ |
OLD | NEW |