diff options
author | lhchavez <lhchavez@chromium.org> | 2016-01-21 15:27:25 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-21 23:30:17 +0000 |
commit | 811769ba67bef5ff1e0a120146c0d593a6ebe5db (patch) | |
tree | 8b6350309843da6c9209af01abf1a186e6572f38 /components/arc/arc_service.h | |
parent | a1b6ab993b5e0570d251198085002bb04e735015 (diff) | |
download | chromium_src-811769ba67bef5ff1e0a120146c0d593a6ebe5db.zip chromium_src-811769ba67bef5ff1e0a120146c0d593a6ebe5db.tar.gz chromium_src-811769ba67bef5ff1e0a120146c0d593a6ebe5db.tar.bz2 |
arc-bridge: Introduce the ArcService class
Several services managed by ARC were introducing empty, opaque classes
just to be able to be constructed outside of components/. This was
becoming ugly, so introduce just one interface that all services must
implement and whose lifecycle will be managed by ArcServiceManager.
BUG=None
TEST=trybots
Review URL: https://codereview.chromium.org/1596663002
Cr-Commit-Position: refs/heads/master@{#370825}
Diffstat (limited to 'components/arc/arc_service.h')
-rw-r--r-- | components/arc/arc_service.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/components/arc/arc_service.h b/components/arc/arc_service.h new file mode 100644 index 0000000..d952417 --- /dev/null +++ b/components/arc/arc_service.h @@ -0,0 +1,35 @@ +// 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. + +#ifndef COMPONENTS_ARC_ARC_SERVICE_H_ +#define COMPONENTS_ARC_ARC_SERVICE_H_ + +#include "base/macros.h" + +namespace arc { + +class ArcBridgeService; + +// Abstract class whose lifecycle will be managed by the ArcServiceManager. It +// is guaranteed that once the ownership of an ArcService has been transferred +// to ArcServiceManager, it will outlive the ArcBridgeService, so it is safe to +// keep a weak reference to it. +class ArcService { + public: + virtual ~ArcService(); + + ArcBridgeService* arc_bridge_service() const { return arc_bridge_service_; } + + protected: + explicit ArcService(ArcBridgeService* arc_bridge_service); + + private: + ArcBridgeService* const arc_bridge_service_; // owned by ArcServiceManager. + + DISALLOW_COPY_AND_ASSIGN(ArcService); +}; + +} // namespace arc + +#endif // COMPONENTS_ARC_ARC_SERVICE_H_ |