forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemory_coordinator_client_registry.cc
37 lines (28 loc) · 1.07 KB
/
memory_coordinator_client_registry.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/memory/memory_coordinator_client_registry.h"
namespace base {
// static
MemoryCoordinatorClientRegistry*
MemoryCoordinatorClientRegistry::GetInstance() {
return Singleton<
MemoryCoordinatorClientRegistry,
LeakySingletonTraits<MemoryCoordinatorClientRegistry>>::get();
}
MemoryCoordinatorClientRegistry::MemoryCoordinatorClientRegistry()
: clients_(new ClientList) {}
MemoryCoordinatorClientRegistry::~MemoryCoordinatorClientRegistry() {}
void MemoryCoordinatorClientRegistry::Register(
MemoryCoordinatorClient* client) {
clients_->AddObserver(client);
}
void MemoryCoordinatorClientRegistry::Unregister(
MemoryCoordinatorClient* client) {
clients_->RemoveObserver(client);
}
void MemoryCoordinatorClientRegistry::Notify(MemoryState state) {
clients_->Notify(FROM_HERE,
&base::MemoryCoordinatorClient::OnMemoryStateChange, state);
}
} // namespace base