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 "components/memory_coordinator/common/client_registry.h" | 5 #include "components/memory_coordinator/common/client_registry.h" |
6 | 6 |
7 namespace memory_coordinator { | 7 namespace memory_coordinator { |
8 | 8 |
| 9 ClientRegistry* ClientRegistry::instance_ = nullptr; |
| 10 |
9 ClientRegistry::ClientRegistry() : clients_(new ClientList) {} | 11 ClientRegistry::ClientRegistry() : clients_(new ClientList) {} |
10 | 12 |
11 ClientRegistry::~ClientRegistry() {} | 13 ClientRegistry::~ClientRegistry() {} |
12 | 14 |
13 void ClientRegistry::RegisterClient(MemoryCoordinatorClient* client) { | 15 void ClientRegistry::RegisterClient(MemoryCoordinatorClient* client) { |
14 clients_->AddObserver(client); | 16 clients_->AddObserver(client); |
15 } | 17 } |
16 | 18 |
17 void ClientRegistry::UnregisterClient(MemoryCoordinatorClient* client) { | 19 void ClientRegistry::UnregisterClient(MemoryCoordinatorClient* client) { |
18 clients_->RemoveObserver(client); | 20 clients_->RemoveObserver(client); |
19 } | 21 } |
20 | 22 |
| 23 ClientRegistry* ClientRegistry::GetInstance() { |
| 24 return instance_; |
| 25 } |
| 26 |
| 27 void ClientRegistry::SetInstance(ClientRegistry* instance) { |
| 28 instance_ = instance; |
| 29 } |
| 30 |
21 } // namespace memory_coordinator | 31 } // namespace memory_coordinator |
OLD | NEW |