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

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

Issue 2094583002: Add MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 #ifndef COMPONENTS_MEMORY_COORDINATOR_CHILD_CHILD_MEMORY_COORDINATOR_IMPL_H_ 5 #ifndef COMPONENTS_MEMORY_COORDINATOR_CHILD_CHILD_MEMORY_COORDINATOR_IMPL_H_
6 #define COMPONENTS_MEMORY_COORDINATOR_CHILD_CHILD_MEMORY_COORDINATOR_IMPL_H_ 6 #define COMPONENTS_MEMORY_COORDINATOR_CHILD_CHILD_MEMORY_COORDINATOR_IMPL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/observer_list_threadsafe.h" 9 #include "base/observer_list_threadsafe.h"
10 #include "components/memory_coordinator/common/memory_coordinator_client.h" 10 #include "components/memory_coordinator/common/memory_coordinator_client.h"
11 #include "components/memory_coordinator/common/memory_coordinator_features.h"
11 #include "components/memory_coordinator/public/interfaces/child_memory_coordinat or.mojom.h" 12 #include "components/memory_coordinator/public/interfaces/child_memory_coordinat or.mojom.h"
12 #include "mojo/public/cpp/bindings/strong_binding.h" 13 #include "components/memory_coordinator/public/interfaces/memory_coordinator.moj om.h"
14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "services/shell/public/cpp/interface_provider.h"
13 16
14 namespace memory_coordinator { 17 namespace memory_coordinator {
15 18
16 // ChildMemoryCoordinatorImpl is the implementation of ChildMemoryCoordinator. 19 // ChildMemoryCoordinatorImpl is the implementation of ChildMemoryCoordinator.
17 // It lives in child processes and is responsible for dispatching memory events 20 // It lives in child processes and is responsible for dispatching memory events
18 // to its clients. 21 // to its clients.
19 class ChildMemoryCoordinatorImpl 22 class ChildMemoryCoordinatorImpl
20 : NON_EXPORTED_BASE(public mojom::ChildMemoryCoordinator) { 23 : NON_EXPORTED_BASE(public mojom::ChildMemoryCoordinator) {
21 public: 24 public:
22 using ClientList = base::ObserverListThreadSafe<MemoryCoordinatorClient>; 25 ChildMemoryCoordinatorImpl(shell::InterfaceProvider* remote_interfaces);
23 ChildMemoryCoordinatorImpl(
24 mojo::InterfaceRequest<mojom::ChildMemoryCoordinator> request,
25 scoped_refptr<ClientList> clients);
26 ~ChildMemoryCoordinatorImpl() override; 26 ~ChildMemoryCoordinatorImpl() override;
27 27
28 // Registers/unregisters a client. Does not take ownership of client.
29 void RegisterClient(MemoryCoordinatorClient* client);
30 void UnregisterClient(MemoryCoordinatorClient* client);
31
28 // mojom::ChildMemoryCoordinator implementations: 32 // mojom::ChildMemoryCoordinator implementations:
29 void OnStateChange(mojom::MemoryState state) override; 33 void OnStateChange(mojom::MemoryState state) override;
30 34
31 private: 35 private:
32 mojo::StrongBinding<mojom::ChildMemoryCoordinator> binding_; 36 friend class ChildMemoryCoordinatorImplTest;
37
38 mojo::Binding<mojom::ChildMemoryCoordinator> binding_;
39 using ClientList = base::ObserverListThreadSafe<MemoryCoordinatorClient>;
33 scoped_refptr<ClientList> clients_; 40 scoped_refptr<ClientList> clients_;
41 mojom::MemoryCoordinatorHandlePtr parent_;
34 42
35 DISALLOW_COPY_AND_ASSIGN(ChildMemoryCoordinatorImpl); 43 DISALLOW_COPY_AND_ASSIGN(ChildMemoryCoordinatorImpl);
36 }; 44 };
37 45
38 } // namespace content 46 } // namespace content
39 47
40 #endif // COMPONENTS_MEMORY_COORDINATOR_CHILD_CHILD_MEMORY_COORDINATOR_IMPL_H_ 48 #endif // COMPONENTS_MEMORY_COORDINATOR_CHILD_CHILD_MEMORY_COORDINATOR_IMPL_H_
OLDNEW
« no previous file with comments | « components/memory_coordinator/child/BUILD.gn ('k') | components/memory_coordinator/child/child_memory_coordinator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698