OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "mojo/system/platform_channel.h" | |
6 | |
7 #include "base/logging.h" | |
8 | |
9 namespace mojo { | |
10 namespace system { | |
11 | |
12 PlatformChannel::~PlatformChannel() { | |
13 handle_.CloseIfNecessary(); | |
14 } | |
15 | |
16 // static | |
17 scoped_ptr<PlatformChannel> PlatformChannel::CreateFromHandle( | |
18 const PlatformChannelHandle& handle) { | |
19 DCHECK(handle.is_valid()); | |
20 scoped_ptr<PlatformChannel> rv(new PlatformChannel()); | |
21 *rv->mutable_handle() = handle; | |
22 return rv.Pass(); | |
23 } | |
24 | |
25 PlatformChannelHandle PlatformChannel::PassHandle() { | |
26 DCHECK(is_valid()); | |
27 PlatformChannelHandle rv = handle_; | |
28 handle_ = PlatformChannelHandle(); | |
29 return rv; | |
30 } | |
31 | |
32 PlatformChannel::PlatformChannel() { | |
33 } | |
34 | |
35 } // namespace system | |
36 } // namespace mojo | |
OLD | NEW |