OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 IPC_IPC_CHANNEL_HANDLE_H_ | 5 #ifndef IPC_IPC_CHANNEL_HANDLE_H_ |
6 #define IPC_IPC_CHANNEL_HANDLE_H_ | 6 #define IPC_IPC_CHANNEL_HANDLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "mojo/public/cpp/system/message_pipe.h" |
11 | 12 |
12 #if defined(OS_POSIX) | 13 #if defined(OS_POSIX) |
13 #include "base/file_descriptor_posix.h" | 14 #include "base/file_descriptor_posix.h" |
14 #elif defined(OS_WIN) | 15 #elif defined(OS_WIN) |
15 #include <windows.h> | 16 #include <windows.h> |
16 #endif // defined (OS_WIN) | 17 #endif // defined (OS_WIN) |
17 | 18 |
18 // On Windows, any process can create an IPC channel and others can fetch | 19 // On Windows, any process can create an IPC channel and others can fetch |
19 // it by name. We pass around the channel names over IPC. | 20 // it by name. We pass around the channel names over IPC. |
20 // On Windows the initialization of ChannelHandle with an existing pipe | 21 // On Windows the initialization of ChannelHandle with an existing pipe |
(...skipping 19 matching lines...) Expand all Loading... |
40 // Otherwise there may be a problem in IPC communication between | 41 // Otherwise there may be a problem in IPC communication between |
41 // processes with different working directories. | 42 // processes with different working directories. |
42 ChannelHandle(const std::string& n) : name(n) {} | 43 ChannelHandle(const std::string& n) : name(n) {} |
43 ChannelHandle(const char* n) : name(n) {} | 44 ChannelHandle(const char* n) : name(n) {} |
44 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
45 explicit ChannelHandle(HANDLE h) : pipe(h) {} | 46 explicit ChannelHandle(HANDLE h) : pipe(h) {} |
46 #elif defined(OS_POSIX) | 47 #elif defined(OS_POSIX) |
47 ChannelHandle(const std::string& n, const base::FileDescriptor& s) | 48 ChannelHandle(const std::string& n, const base::FileDescriptor& s) |
48 : name(n), socket(s) {} | 49 : name(n), socket(s) {} |
49 #endif // defined(OS_POSIX) | 50 #endif // defined(OS_POSIX) |
| 51 ChannelHandle(mojo::MessagePipeHandle h) : mojo_handle(h) {} |
50 | 52 |
51 std::string name; | 53 std::string name; |
52 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
53 base::FileDescriptor socket; | 55 base::FileDescriptor socket; |
54 #elif defined(OS_WIN) | 56 #elif defined(OS_WIN) |
55 // A simple container to automatically initialize pipe handle | 57 // A simple container to automatically initialize pipe handle |
56 struct PipeHandle { | 58 struct PipeHandle { |
57 PipeHandle() : handle(NULL) {} | 59 PipeHandle() : handle(NULL) {} |
58 PipeHandle(HANDLE h) : handle(h) {} | 60 PipeHandle(HANDLE h) : handle(h) {} |
59 HANDLE handle; | 61 HANDLE handle; |
60 }; | 62 }; |
61 PipeHandle pipe; | 63 PipeHandle pipe; |
62 #endif // defined (OS_WIN) | 64 #endif // defined (OS_WIN) |
| 65 mojo::MessagePipeHandle mojo_handle; |
63 }; | 66 }; |
64 | 67 |
65 } // namespace IPC | 68 } // namespace IPC |
66 | 69 |
67 #endif // IPC_IPC_CHANNEL_HANDLE_H_ | 70 #endif // IPC_IPC_CHANNEL_HANDLE_H_ |
OLD | NEW |