Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: components/memory_coordinator/child/child_memory_coordinator_impl.cc

Issue 2143353004: Revert of Add MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/child/child_memory_coordinator_impl.h" 5 #include "components/memory_coordinator/child/child_memory_coordinator_impl.h"
6 6
7 namespace memory_coordinator { 7 namespace memory_coordinator {
8 8
9 ChildMemoryCoordinatorImpl::ChildMemoryCoordinatorImpl( 9 ChildMemoryCoordinatorImpl::ChildMemoryCoordinatorImpl(
10 shell::InterfaceProvider* remote_interfaces) 10 mojo::InterfaceRequest<mojom::ChildMemoryCoordinator> request,
11 : binding_(this), clients_(new ClientList) { 11 scoped_refptr<ClientList> clients)
12 if (remote_interfaces) { 12 : binding_(this, std::move(request)),
13 remote_interfaces->GetInterface(mojo::GetProxy(&parent_)); 13 clients_(clients) {}
14 parent_->AddChild(binding_.CreateInterfacePtrAndBind());
15 }
16 }
17 14
18 ChildMemoryCoordinatorImpl::~ChildMemoryCoordinatorImpl() { 15 ChildMemoryCoordinatorImpl::~ChildMemoryCoordinatorImpl() {}
19 }
20
21 void ChildMemoryCoordinatorImpl::RegisterClient(
22 MemoryCoordinatorClient* client) {
23 clients_->AddObserver(client);
24 }
25
26 void ChildMemoryCoordinatorImpl::UnregisterClient(
27 MemoryCoordinatorClient* client) {
28 clients_->RemoveObserver(client);
29 }
30 16
31 void ChildMemoryCoordinatorImpl::OnStateChange(mojom::MemoryState state) { 17 void ChildMemoryCoordinatorImpl::OnStateChange(mojom::MemoryState state) {
32 clients_->Notify(FROM_HERE, &MemoryCoordinatorClient::OnMemoryStateChange, 18 clients_->Notify(FROM_HERE, &MemoryCoordinatorClient::OnMemoryStateChange,
33 state); 19 state);
34 } 20 }
35 21
36 } // namespace memory_coordinator 22 } // namespace memory_coordinator
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698