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 3 // found in the LICENSE file. 4 5 #include "base/memory/memory_coordinator_proxy.h" 6 7 namespace base { 8 9 namespace { 10 11 MemoryCoordinator* g_memory_coordinator = nullptr; 12 13 } // namespace 14 15 MemoryCoordinatorProxy::MemoryCoordinatorProxy() = default; 16 17 MemoryCoordinatorProxy::~MemoryCoordinatorProxy() = default; 18 19 // static GetInstance()20MemoryCoordinatorProxy* MemoryCoordinatorProxy::GetInstance() { 21 return Singleton<base::MemoryCoordinatorProxy>::get(); 22 } 23 24 // static SetMemoryCoordinator(MemoryCoordinator * coordinator)25void MemoryCoordinatorProxy::SetMemoryCoordinator( 26 MemoryCoordinator* coordinator) { 27 DCHECK(!g_memory_coordinator || !coordinator); 28 g_memory_coordinator = coordinator; 29 } 30 GetCurrentMemoryState() const31MemoryState MemoryCoordinatorProxy::GetCurrentMemoryState() const { 32 if (!g_memory_coordinator) 33 return MemoryState::NORMAL; 34 return g_memory_coordinator->GetCurrentMemoryState(); 35 } 36 37 } // namespace base 38