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_COORDINATOR_PROXY_H_ | 5 #ifndef BASE_MEMORY_MEMORY_COORDINATOR_PROXY_H_ |
6 #define BASE_MEMORY_MEMORY_COORDINATOR_PROXY_H_ | 6 #define BASE_MEMORY_MEMORY_COORDINATOR_PROXY_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/memory_coordinator_client.h" | 10 #include "base/memory/memory_coordinator_client.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // in content/browser e.g. net. | 26 // in content/browser e.g. net. |
27 class BASE_EXPORT MemoryCoordinatorProxy { | 27 class BASE_EXPORT MemoryCoordinatorProxy { |
28 public: | 28 public: |
29 static MemoryCoordinatorProxy* GetInstance(); | 29 static MemoryCoordinatorProxy* GetInstance(); |
30 | 30 |
31 // Sets an implementation of MemoryCoordinator. MemoryCoordinatorProxy doesn't | 31 // Sets an implementation of MemoryCoordinator. MemoryCoordinatorProxy doesn't |
32 // take the ownership of |coordinator|. It must outlive this proxy. | 32 // take the ownership of |coordinator|. It must outlive this proxy. |
33 // This should be called before any components starts using this proxy. | 33 // This should be called before any components starts using this proxy. |
34 static void SetMemoryCoordinator(MemoryCoordinator* coordinator); | 34 static void SetMemoryCoordinator(MemoryCoordinator* coordinator); |
35 | 35 |
| 36 // Reset globals. Used in tests to clean up globals to prevent leaking to the |
| 37 // next test. |
| 38 static void ResetGlobals(); |
| 39 |
36 // Returns the current memory state. | 40 // Returns the current memory state. |
37 MemoryState GetCurrentMemoryState() const; | 41 MemoryState GetCurrentMemoryState() const; |
38 | 42 |
39 // Sets the current memory state. This function is for testing only. | 43 // Sets the current memory state. This function is for testing only. |
40 void SetCurrentMemoryStateForTesting(MemoryState memory_state); | 44 void SetCurrentMemoryStateForTesting(MemoryState memory_state); |
41 | 45 |
42 private: | 46 private: |
43 friend struct base::DefaultSingletonTraits<MemoryCoordinatorProxy>; | 47 friend struct base::DefaultSingletonTraits<MemoryCoordinatorProxy>; |
44 | 48 |
45 MemoryCoordinatorProxy(); | 49 MemoryCoordinatorProxy(); |
46 virtual ~MemoryCoordinatorProxy(); | 50 virtual ~MemoryCoordinatorProxy(); |
47 | 51 |
48 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinatorProxy); | 52 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinatorProxy); |
49 }; | 53 }; |
50 | 54 |
51 } // namespace base | 55 } // namespace base |
52 | 56 |
53 #endif // BASE_MEMORY_MEMORY_COORDINATOR_PROXY_H_ | 57 #endif // BASE_MEMORY_MEMORY_COORDINATOR_PROXY_H_ |
OLD | NEW |