summaryrefslogtreecommitdiff
path: root/mojo/public/cpp/bindings/lib/associated_group.cc
blob: 3e95eeb0276807de1a3c2469fbaca8826def3324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2015 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.

#include "mojo/public/cpp/bindings/associated_group.h"

#include "mojo/public/cpp/bindings/associated_group_controller.h"

namespace mojo {

AssociatedGroup::AssociatedGroup() = default;

AssociatedGroup::AssociatedGroup(
    scoped_refptr<AssociatedGroupController> controller)
    : controller_(std::move(controller)) {}

AssociatedGroup::AssociatedGroup(const ScopedInterfaceEndpointHandle& handle)
    : controller_getter_(handle.CreateGroupControllerGetter()) {}

AssociatedGroup::AssociatedGroup(const AssociatedGroup& other) = default;

AssociatedGroup::~AssociatedGroup() = default;

AssociatedGroup& AssociatedGroup::operator=(const AssociatedGroup& other) =
    default;

AssociatedGroupController* AssociatedGroup::GetController() {
  if (controller_)
    return controller_.get();

  return controller_getter_.Run();
}

}  // namespace mojo