OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // | 23 // |
24 // In sum, when passing a handle to a channel over IPC, use this data structure | 24 // In sum, when passing a handle to a channel over IPC, use this data structure |
25 // to work on both Windows and POSIX. | 25 // to work on both Windows and POSIX. |
26 | 26 |
27 namespace IPC { | 27 namespace IPC { |
28 | 28 |
29 struct ChannelHandle { | 29 struct ChannelHandle { |
30 // Note that serialization for this object is defined in the ParamTraits | 30 // Note that serialization for this object is defined in the ParamTraits |
31 // template specialization in ipc_message_utils.h. | 31 // template specialization in ipc_message_utils.h. |
32 ChannelHandle() {} | 32 ChannelHandle() {} |
| 33 // The name that is passed in should be an absolute path for Posix. |
| 34 // Otherwise there may be a problem in IPC communication between |
| 35 // processes with different working directories. |
33 ChannelHandle(const std::string& n) : name(n) {} | 36 ChannelHandle(const std::string& n) : name(n) {} |
34 ChannelHandle(const char* n) : name(n) {} | 37 ChannelHandle(const char* n) : name(n) {} |
35 #if defined(OS_POSIX) | 38 #if defined(OS_POSIX) |
36 ChannelHandle(const std::string& n, const base::FileDescriptor& s) | 39 ChannelHandle(const std::string& n, const base::FileDescriptor& s) |
37 : name(n), socket(s) {} | 40 : name(n), socket(s) {} |
38 #endif // defined(OS_POSIX) | 41 #endif // defined(OS_POSIX) |
39 | 42 |
40 std::string name; | 43 std::string name; |
41 #if defined(OS_POSIX) | 44 #if defined(OS_POSIX) |
42 base::FileDescriptor socket; | 45 base::FileDescriptor socket; |
43 #endif // defined(OS_POSIX) | 46 #endif // defined(OS_POSIX) |
44 | 47 |
45 }; | 48 }; |
46 | 49 |
47 } // namespace IPC | 50 } // namespace IPC |
48 | 51 |
49 #endif // IPC_IPC_CHANNEL_HANDLE_H_ | 52 #endif // IPC_IPC_CHANNEL_HANDLE_H_ |
OLD | NEW |