blob: 46657e6067f4ffd5b238fd39feaf93fada1c9e85 (
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
35
36
37
38
39
40
41
42
|
// Copyright 2013 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/system/platform_channel.h"
#include "base/logging.h"
namespace mojo {
namespace system {
PlatformChannel::~PlatformChannel() {
handle_.CloseIfNecessary();
}
PlatformChannelHandle PlatformChannel::PassHandle() {
DCHECK(is_valid());
PlatformChannelHandle rv = handle_;
handle_ = PlatformChannelHandle();
return rv;
}
PlatformChannel::PlatformChannel() {
}
PlatformServerChannel::PlatformServerChannel(const std::string& name)
: name_(name) {
DCHECK(!name_.empty());
}
// Static factory method.
// static
scoped_ptr<PlatformClientChannel> PlatformClientChannel::CreateFromHandle(
const PlatformChannelHandle& handle) {
DCHECK(handle.is_valid());
scoped_ptr<PlatformClientChannel> rv(new PlatformClientChannel());
*rv->mutable_handle() = handle;
return rv.Pass();
}
} // namespace system
} // namespace mojo
|