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

Unified Diff: mojo/public/cpp/bindings/lib/associated_group.cc

Issue 2646853003: Mojo C++ bindings: Simplify associated interface API. (Closed)
Patch Set: . Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/lib/associated_group.cc
diff --git a/mojo/public/cpp/bindings/lib/associated_group.cc b/mojo/public/cpp/bindings/lib/associated_group.cc
index a9c53b5e86a8889bad3890e1119243fd5a721795..3e95eeb0276807de1a3c2469fbaca8826def3324 100644
--- a/mojo/public/cpp/bindings/lib/associated_group.cc
+++ b/mojo/public/cpp/bindings/lib/associated_group.cc
@@ -8,28 +8,27 @@
namespace mojo {
-AssociatedGroup::AssociatedGroup() {}
+AssociatedGroup::AssociatedGroup() = default;
-AssociatedGroup::AssociatedGroup(const AssociatedGroup& other)
- : controller_(other.controller_) {}
+AssociatedGroup::AssociatedGroup(
+ scoped_refptr<AssociatedGroupController> controller)
+ : controller_(std::move(controller)) {}
-AssociatedGroup::~AssociatedGroup() {}
+AssociatedGroup::AssociatedGroup(const ScopedInterfaceEndpointHandle& handle)
+ : controller_getter_(handle.CreateGroupControllerGetter()) {}
-AssociatedGroup& AssociatedGroup::operator=(const AssociatedGroup& other) {
- if (this == &other)
- return *this;
+AssociatedGroup::AssociatedGroup(const AssociatedGroup& other) = default;
- controller_ = other.controller_;
- return *this;
-}
+AssociatedGroup::~AssociatedGroup() = default;
+
+AssociatedGroup& AssociatedGroup::operator=(const AssociatedGroup& other) =
+ default;
-void AssociatedGroup::CreateEndpointHandlePair(
- ScopedInterfaceEndpointHandle* local_endpoint,
- ScopedInterfaceEndpointHandle* remote_endpoint) {
- if (!controller_)
- return;
+AssociatedGroupController* AssociatedGroup::GetController() {
+ if (controller_)
+ return controller_.get();
- controller_->CreateEndpointHandlePair(local_endpoint, remote_endpoint);
+ return controller_getter_.Run();
}
} // namespace mojo
« no previous file with comments | « mojo/public/cpp/bindings/lib/associated_binding.cc ('k') | mojo/public/cpp/bindings/lib/associated_group_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698