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 PPAPI_PROXY_PROXY_CHANNEL_H_ | 5 #ifndef PPAPI_PROXY_PROXY_CHANNEL_H_ |
6 #define PPAPI_PROXY_PROXY_CHANNEL_H_ | 6 #define PPAPI_PROXY_PROXY_CHANNEL_H_ |
7 | 7 |
8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // on the other side of the channel. This is part of the delegate interface | 45 // on the other side of the channel. This is part of the delegate interface |
46 // because both sides of the channel may not have sufficient permission to | 46 // because both sides of the channel may not have sufficient permission to |
47 // duplicate handles directly. The implementation must provide the same | 47 // duplicate handles directly. The implementation must provide the same |
48 // guarantees as ProxyChannel::ShareHandleWithRemote below. | 48 // guarantees as ProxyChannel::ShareHandleWithRemote below. |
49 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( | 49 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( |
50 base::PlatformFile handle, | 50 base::PlatformFile handle, |
51 base::ProcessId remote_pid, | 51 base::ProcessId remote_pid, |
52 bool should_close_source) = 0; | 52 bool should_close_source) = 0; |
53 }; | 53 }; |
54 | 54 |
55 virtual ~ProxyChannel(); | 55 ~ProxyChannel() override; |
56 | 56 |
57 // Alternative to InitWithChannel() for unit tests that want to send all | 57 // Alternative to InitWithChannel() for unit tests that want to send all |
58 // messages sent via this channel to the given test sink. The test sink | 58 // messages sent via this channel to the given test sink. The test sink |
59 // must outlive this class. In this case, the peer PID will be the current | 59 // must outlive this class. In this case, the peer PID will be the current |
60 // process ID. | 60 // process ID. |
61 void InitWithTestSink(IPC::TestSink* test_sink); | 61 void InitWithTestSink(IPC::TestSink* test_sink); |
62 | 62 |
63 // Shares a file handle (HANDLE / file descriptor) with the remote side. It | 63 // Shares a file handle (HANDLE / file descriptor) with the remote side. It |
64 // returns a handle that should be sent in exactly one IPC message. Upon | 64 // returns a handle that should be sent in exactly one IPC message. Upon |
65 // receipt, the remote side then owns that handle. Note: if sending the | 65 // receipt, the remote side then owns that handle. Note: if sending the |
66 // message fails, the returned handle is properly closed by the IPC system. If | 66 // message fails, the returned handle is properly closed by the IPC system. If |
67 // should_close_source is set to true, the original handle is closed by this | 67 // should_close_source is set to true, the original handle is closed by this |
68 // operation and should not be used again. | 68 // operation and should not be used again. |
69 IPC::PlatformFileForTransit ShareHandleWithRemote( | 69 IPC::PlatformFileForTransit ShareHandleWithRemote( |
70 base::PlatformFile handle, | 70 base::PlatformFile handle, |
71 bool should_close_source); | 71 bool should_close_source); |
72 | 72 |
73 // IPC::Sender implementation. | 73 // IPC::Sender implementation. |
74 virtual bool Send(IPC::Message* msg) override; | 74 bool Send(IPC::Message* msg) override; |
75 | 75 |
76 // IPC::Listener implementation. | 76 // IPC::Listener implementation. |
77 virtual void OnChannelError() override; | 77 void OnChannelError() override; |
78 | 78 |
79 // Will be NULL in some unit tests and if the remote side has crashed. | 79 // Will be NULL in some unit tests and if the remote side has crashed. |
80 IPC::SyncChannel* channel() const { | 80 IPC::SyncChannel* channel() const { |
81 return channel_.get(); | 81 return channel_.get(); |
82 } | 82 } |
83 | 83 |
84 #if defined(OS_POSIX) && !defined(OS_NACL) | 84 #if defined(OS_POSIX) && !defined(OS_NACL) |
85 base::ScopedFD TakeRendererFD(); | 85 base::ScopedFD TakeRendererFD(); |
86 #endif | 86 #endif |
87 | 87 |
(...skipping 30 matching lines...) Expand all Loading... |
118 // remote side has crashed. | 118 // remote side has crashed. |
119 scoped_ptr<IPC::SyncChannel> channel_; | 119 scoped_ptr<IPC::SyncChannel> channel_; |
120 | 120 |
121 DISALLOW_COPY_AND_ASSIGN(ProxyChannel); | 121 DISALLOW_COPY_AND_ASSIGN(ProxyChannel); |
122 }; | 122 }; |
123 | 123 |
124 } // namespace proxy | 124 } // namespace proxy |
125 } // namespace ppapi | 125 } // namespace ppapi |
126 | 126 |
127 #endif // PPAPI_PROXY_PROXY_CHANNEL_H_ | 127 #endif // PPAPI_PROXY_PROXY_CHANNEL_H_ |
OLD | NEW |