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

Side by Side Diff: services/resource_coordinator/public/cpp/resource_coordinator_interface.h

Issue 2798713002: Global Resource Coordinator: Basic service internals (Closed)
Patch Set: Review fixes Created 3 years, 8 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
(Empty)
1 // Copyright 2017 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 #ifndef SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_RESOURCE_COORDINATOR_INTERFACE_ H_
6 #define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_RESOURCE_COORDINATOR_INTERFACE_ H_
7
8 #include <stdint.h>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h"
13 #include "services/resource_coordinator/public/interfaces/coordination_unit.mojo m.h"
14
15 namespace service_manager {
16 class Connector;
17 }
18
19 namespace resource_coordinator {
20
21 class ResourceCoordinatorInterface {
22 public:
23 ResourceCoordinatorInterface(service_manager::Connector* connector,
24 const CoordinationUnitType& type);
25 ~ResourceCoordinatorInterface();
26
27 const mojom::CoordinationUnitPtr& service() const { return service_; }
28
29 void SendEvent(const EventType& event_type);
30 void AddChild(const ResourceCoordinatorInterface& child);
31
32 private:
33 void ConnectToService(service_manager::Connector* connector,
34 const CoordinationUnitType& type,
35 const std::string& id);
36 void AddChildByID(const CoordinationUnitID& child_id);
37
38 mojom::CoordinationUnitPtr service_;
39
40 base::ThreadChecker thread_checker_;
41
42 // The WeakPtrFactory should come last so the weak ptrs are invalidated
Primiano Tucci (use gerrit) 2017/04/11 18:04:52 isn't this the other way round (fiedls in the bott
oystein (OOO til 10th of July) 2017/04/12 19:15:31 I mixed up the wording; the WeakPtrs should be des
43 // after the rest of the member variables.
44 base::WeakPtrFactory<ResourceCoordinatorInterface> weak_ptr_factory_;
45
46 DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorInterface);
47 };
48
49 } // namespace resource_coordinator
50
51 #endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_RESOURCE_COORDINATOR_INTERFA CE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698