Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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_client_registry.h" | |
| 6 | |
| 7 namespace base { | |
| 8 | |
| 9 // static | |
| 10 MemoryCoordinatorClientRegistry* | |
| 11 MemoryCoordinatorClientRegistry::GetInstance() { | |
| 12 return Singleton< | |
| 13 MemoryCoordinatorClientRegistry, | |
| 14 LeakySingletonTraits<MemoryCoordinatorClientRegistry>>::get(); | |
| 15 } | |
| 16 | |
| 17 MemoryCoordinatorClientRegistry::MemoryCoordinatorClientRegistry() | |
| 18 : clients_(new ClientList) {} | |
|
dcheng
2016/09/08 21:28:26
Why do we need to store this in a scoped_refptr?
bashi
2016/09/08 23:00:08
ObserverListThreadSafe is RefCountedThreadSafe. Ca
dcheng
2016/09/09 03:02:04
Ah, I see... it's thread-safe so it can PostTask a
| |
| 19 | |
| 20 MemoryCoordinatorClientRegistry::~MemoryCoordinatorClientRegistry() {} | |
| 21 | |
| 22 void MemoryCoordinatorClientRegistry::Register( | |
| 23 MemoryCoordinatorClient* client) { | |
| 24 clients_->AddObserver(client); | |
| 25 } | |
| 26 | |
| 27 void MemoryCoordinatorClientRegistry::Unregister( | |
| 28 MemoryCoordinatorClient* client) { | |
| 29 clients_->RemoveObserver(client); | |
| 30 } | |
| 31 | |
| 32 } // namespace base | |
| OLD | NEW |