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 #ifndef MOJO_SYSTEM_PLATFORM_CHANNEL_H_ | |
6 #define MOJO_SYSTEM_PLATFORM_CHANNEL_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "mojo/system/platform_channel_handle.h" | |
11 #include "mojo/system/system_impl_export.h" | |
12 | |
13 namespace mojo { | |
14 namespace system { | |
15 | |
16 class MOJO_SYSTEM_IMPL_EXPORT PlatformChannel { | |
17 public: | |
18 virtual ~PlatformChannel(); | |
19 | |
20 // Creates a channel if you already have the underlying handle for it, taking | |
21 // ownership of |handle|. | |
22 static scoped_ptr<PlatformChannel> CreateFromHandle( | |
23 const PlatformChannelHandle& handle); | |
24 | |
25 // Returns the channel's handle, passing ownership. | |
26 PlatformChannelHandle PassHandle(); | |
27 | |
28 bool is_valid() const { return handle_.is_valid(); } | |
29 | |
30 protected: | |
31 PlatformChannel(); | |
32 | |
33 PlatformChannelHandle* mutable_handle() { return &handle_; } | |
34 | |
35 private: | |
36 PlatformChannelHandle handle_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(PlatformChannel); | |
39 }; | |
40 | |
41 } // namespace system | |
42 } // namespace mojo | |
43 | |
44 #endif // MOJO_SYSTEM_PLATFORM_CHANNEL_H_ | |
OLD | NEW |