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 #include "base/memory/memory_coordinator_proxy.h" | 5 #include "base/memory/memory_coordinator_proxy.h" |
6 | 6 |
7 namespace base { | 7 namespace base { |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 return Singleton<base::MemoryCoordinatorProxy>::get(); | 23 return Singleton<base::MemoryCoordinatorProxy>::get(); |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 void MemoryCoordinatorProxy::SetMemoryCoordinator( | 27 void MemoryCoordinatorProxy::SetMemoryCoordinator( |
28 MemoryCoordinator* coordinator) { | 28 MemoryCoordinator* coordinator) { |
29 DCHECK(!g_memory_coordinator); | 29 DCHECK(!g_memory_coordinator); |
30 g_memory_coordinator = coordinator; | 30 g_memory_coordinator = coordinator; |
31 } | 31 } |
32 | 32 |
| 33 // static |
| 34 void MemoryCoordinatorProxy::ResetGlobals() { |
| 35 g_memory_coordinator = nullptr; |
| 36 } |
| 37 |
33 MemoryState MemoryCoordinatorProxy::GetCurrentMemoryState() const { | 38 MemoryState MemoryCoordinatorProxy::GetCurrentMemoryState() const { |
34 if (!g_memory_coordinator) | 39 if (!g_memory_coordinator) |
35 return MemoryState::NORMAL; | 40 return MemoryState::NORMAL; |
36 return g_memory_coordinator->GetCurrentMemoryState(); | 41 return g_memory_coordinator->GetCurrentMemoryState(); |
37 } | 42 } |
38 | 43 |
39 void MemoryCoordinatorProxy::SetCurrentMemoryStateForTesting( | 44 void MemoryCoordinatorProxy::SetCurrentMemoryStateForTesting( |
40 MemoryState memory_state) { | 45 MemoryState memory_state) { |
41 DCHECK(g_memory_coordinator); | 46 DCHECK(g_memory_coordinator); |
42 g_memory_coordinator->SetCurrentMemoryStateForTesting(memory_state); | 47 g_memory_coordinator->SetCurrentMemoryStateForTesting(memory_state); |
43 } | 48 } |
44 | 49 |
45 } // namespace base | 50 } // namespace base |
OLD | NEW |