OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ | 5 #ifndef MOJO_EDK_PLATFORM_PLATFORM_HANDLE_H_ |
6 #define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ | 6 #define MOJO_EDK_PLATFORM_PLATFORM_HANDLE_H_ |
7 | 7 |
8 namespace mojo { | 8 namespace mojo { |
9 namespace embedder { | 9 namespace platform { |
10 | 10 |
11 // A |PlatformHandle| is just a file descriptor on POSIX. | 11 // A |PlatformHandle| is just a file descriptor on POSIX. |
12 struct PlatformHandle { | 12 struct PlatformHandle { |
13 PlatformHandle() : fd(-1) {} | 13 PlatformHandle() : fd(-1) {} |
14 explicit PlatformHandle(int fd) : fd(fd) {} | 14 explicit PlatformHandle(int fd) : fd(fd) {} |
15 | 15 |
16 void CloseIfNecessary(); | 16 void CloseIfNecessary(); |
17 | 17 |
18 bool is_valid() const { return fd != -1; } | 18 bool is_valid() const { return fd != -1; } |
19 | 19 |
20 int fd; | 20 int fd; |
21 }; | 21 }; |
22 | 22 |
23 } // namespace embedder | 23 } // namespace platform |
24 } // namespace mojo | 24 } // namespace mojo |
25 | 25 |
26 #endif // MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ | 26 #endif // MOJO_EDK_PLATFORM_PLATFORM_HANDLE_H_ |
OLD | NEW |