Chromium Code Reviews| Index: services/resource_coordinator/public/cpp/resource_coordinator_interface.h |
| diff --git a/services/resource_coordinator/public/cpp/resource_coordinator_interface.h b/services/resource_coordinator/public/cpp/resource_coordinator_interface.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..96522b64392a2a79e4f2892695273c304e4b8270 |
| --- /dev/null |
| +++ b/services/resource_coordinator/public/cpp/resource_coordinator_interface.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2017 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. |
| + |
| +#ifndef SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_RESOURCE_COORDINATOR_INTERFACE_H_ |
| +#define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_RESOURCE_COORDINATOR_INTERFACE_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/threading/thread_checker.h" |
| +#include "services/resource_coordinator/public/interfaces/coordination_unit.mojom.h" |
| + |
| +namespace service_manager { |
| +class Connector; |
| +} |
| + |
| +namespace resource_coordinator { |
| + |
| +class ResourceCoordinatorInterface { |
| + public: |
| + ResourceCoordinatorInterface(service_manager::Connector* connector, |
| + const CoordinationUnitType& type); |
| + ~ResourceCoordinatorInterface(); |
| + |
| + const mojom::CoordinationUnitPtr& service() const { return service_; } |
| + |
| + void SendEvent(const EventType& event_type); |
| + void AddChild(const ResourceCoordinatorInterface& child); |
| + |
| + private: |
| + void ConnectToService(service_manager::Connector* connector, |
| + const CoordinationUnitType& type, |
| + const std::string& id); |
| + void AddChildByID(const CoordinationUnitID& child_id); |
| + |
| + mojom::CoordinationUnitPtr service_; |
| + |
| + base::ThreadChecker thread_checker_; |
| + |
| + // 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
|
| + // after the rest of the member variables. |
| + base::WeakPtrFactory<ResourceCoordinatorInterface> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorInterface); |
| +}; |
| + |
| +} // namespace resource_coordinator |
| + |
| +#endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_RESOURCE_COORDINATOR_INTERFACE_H_ |