OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHANNEL_PAIR_H_ | 5 #ifndef MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_PAIR_H_ |
6 #define MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_PAIR_H_ | 6 #define MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_PAIR_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/process/launch.h" | 9 #include "base/process/launch.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // Note: |PlatformChannelPair()|, |PassClientHandleFromParentProcess()| and | 45 // Note: |PlatformChannelPair()|, |PassClientHandleFromParentProcess()| and |
46 // |PrepareToPassClientHandleToChildProcess()| have platform-specific | 46 // |PrepareToPassClientHandleToChildProcess()| have platform-specific |
47 // implementations. | 47 // implementations. |
48 // | 48 // |
49 // Note: On POSIX platforms, to write to the "pipe", use | 49 // Note: On POSIX platforms, to write to the "pipe", use |
50 // |PlatformChannel{Write,Writev}()| (from platform_channel_utils_posix.h) | 50 // |PlatformChannel{Write,Writev}()| (from platform_channel_utils_posix.h) |
51 // instead of |write()|, |writev()|, etc. Otherwise, you have to worry about | 51 // instead of |write()|, |writev()|, etc. Otherwise, you have to worry about |
52 // platform differences in suppressing |SIGPIPE|. | 52 // platform differences in suppressing |SIGPIPE|. |
53 class MOJO_SYSTEM_IMPL_EXPORT PlatformChannelPair { | 53 class MOJO_SYSTEM_IMPL_EXPORT PlatformChannelPair { |
54 public: | 54 public: |
| 55 static const char kMojoPlatformChannelHandleSwitch[]; |
| 56 |
55 // If |client_is_blocking| is true, then the client handle only supports | 57 // If |client_is_blocking| is true, then the client handle only supports |
56 // blocking reads and writes. The default is nonblocking. | 58 // blocking reads and writes. The default is nonblocking. |
57 PlatformChannelPair(bool client_is_blocking = false); | 59 PlatformChannelPair(bool client_is_blocking = false); |
58 ~PlatformChannelPair(); | 60 ~PlatformChannelPair(); |
59 | 61 |
60 ScopedPlatformHandle PassServerHandle(); | 62 ScopedPlatformHandle PassServerHandle(); |
61 | 63 |
62 // For in-process use (e.g., in tests or to pass over another channel). | 64 // For in-process use (e.g., in tests or to pass over another channel). |
63 ScopedPlatformHandle PassClientHandle(); | 65 ScopedPlatformHandle PassClientHandle(); |
64 | 66 |
65 // To be called in the child process, after the parent process called | 67 // To be called in the child process, after the parent process called |
66 // |PrepareToPassClientHandleToChildProcess()| and launched the child (using | 68 // |PrepareToPassClientHandleToChildProcess()| and launched the child (using |
(...skipping 16 matching lines...) Expand all Loading... |
83 | 85 |
84 // Like above, but returns a string instead of changing the command line. | 86 // Like above, but returns a string instead of changing the command line. |
85 std::string PrepareToPassClientHandleToChildProcessAsString( | 87 std::string PrepareToPassClientHandleToChildProcessAsString( |
86 HandlePassingInformation* handle_passing_info) const; | 88 HandlePassingInformation* handle_passing_info) const; |
87 | 89 |
88 // To be called once the child process has been successfully launched, to do | 90 // To be called once the child process has been successfully launched, to do |
89 // any cleanup necessary. | 91 // any cleanup necessary. |
90 void ChildProcessLaunched(); | 92 void ChildProcessLaunched(); |
91 | 93 |
92 private: | 94 private: |
93 static const char kMojoPlatformChannelHandleSwitch[]; | |
94 | |
95 ScopedPlatformHandle server_handle_; | 95 ScopedPlatformHandle server_handle_; |
96 ScopedPlatformHandle client_handle_; | 96 ScopedPlatformHandle client_handle_; |
97 | 97 |
98 MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformChannelPair); | 98 MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformChannelPair); |
99 }; | 99 }; |
100 | 100 |
101 } // namespace edk | 101 } // namespace edk |
102 } // namespace mojo | 102 } // namespace mojo |
103 | 103 |
104 #endif // MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_PAIR_H_ | 104 #endif // MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_PAIR_H_ |
OLD | NEW |