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 CHROME_NACL_NACL_IPC_ADAPTER_H_ | 5 #ifndef CHROME_NACL_NACL_IPC_ADAPTER_H_ |
6 #define CHROME_NACL_NACL_IPC_ADAPTER_H_ | 6 #define CHROME_NACL_NACL_IPC_ADAPTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 // Make a NaClDesc that refers to this NaClIPCAdapter. Note that the returned | 105 // Make a NaClDesc that refers to this NaClIPCAdapter. Note that the returned |
106 // NaClDesc is reference-counted, and a reference is returned. | 106 // NaClDesc is reference-counted, and a reference is returned. |
107 NaClDesc* MakeNaClDesc(); | 107 NaClDesc* MakeNaClDesc(); |
108 | 108 |
109 #if defined(OS_POSIX) | 109 #if defined(OS_POSIX) |
110 base::ScopedFD TakeClientFileDescriptor(); | 110 base::ScopedFD TakeClientFileDescriptor(); |
111 #endif | 111 #endif |
112 | 112 |
113 // Listener implementation. | 113 // Listener implementation. |
114 virtual bool OnMessageReceived(const IPC::Message& message) override; | 114 bool OnMessageReceived(const IPC::Message& message) override; |
115 virtual void OnChannelConnected(int32 peer_pid) override; | 115 void OnChannelConnected(int32 peer_pid) override; |
116 virtual void OnChannelError() override; | 116 void OnChannelError() override; |
117 | 117 |
118 typedef base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> | 118 typedef base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> |
119 ResolveFileTokenReplyCallback; | 119 ResolveFileTokenReplyCallback; |
120 | 120 |
121 typedef base::Callback<void(uint64_t, // file_token_lo | 121 typedef base::Callback<void(uint64_t, // file_token_lo |
122 uint64_t, // file_token_hi | 122 uint64_t, // file_token_hi |
123 ResolveFileTokenReplyCallback)> | 123 ResolveFileTokenReplyCallback)> |
124 ResolveFileTokenCallback; | 124 ResolveFileTokenCallback; |
125 | 125 |
126 // Sets a callback to be invoked for resolving file tokens received from the | 126 // Sets a callback to be invoked for resolving file tokens received from the |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 scoped_ptr<IPC::Channel> channel_; | 169 scoped_ptr<IPC::Channel> channel_; |
170 | 170 |
171 // When we send a synchronous message (from untrusted to trusted), we store | 171 // When we send a synchronous message (from untrusted to trusted), we store |
172 // its type here, so that later we can associate the reply with its type | 172 // its type here, so that later we can associate the reply with its type |
173 // for scanning. | 173 // for scanning. |
174 typedef std::map<int, uint32> PendingSyncMsgMap; | 174 typedef std::map<int, uint32> PendingSyncMsgMap; |
175 PendingSyncMsgMap pending_sync_msgs_; | 175 PendingSyncMsgMap pending_sync_msgs_; |
176 }; | 176 }; |
177 | 177 |
178 virtual ~NaClIPCAdapter(); | 178 ~NaClIPCAdapter() override; |
179 | 179 |
180 void OnFileTokenResolved(const IPC::Message& orig_msg, | 180 void OnFileTokenResolved(const IPC::Message& orig_msg, |
181 IPC::PlatformFileForTransit ipc_fd, | 181 IPC::PlatformFileForTransit ipc_fd, |
182 base::FilePath file_path); | 182 base::FilePath file_path); |
183 | 183 |
184 bool RewriteMessage(const IPC::Message& msg, uint32_t type); | 184 bool RewriteMessage(const IPC::Message& msg, uint32_t type); |
185 | 185 |
186 // Returns 0 if nothing is waiting. | 186 // Returns 0 if nothing is waiting. |
187 int LockedReceive(NaClImcTypedMsgHdr* msg); | 187 int LockedReceive(NaClImcTypedMsgHdr* msg); |
188 | 188 |
(...skipping 27 matching lines...) Expand all Loading... |
216 // To be accessed on the I/O thread (via task runner) only. | 216 // To be accessed on the I/O thread (via task runner) only. |
217 IOThreadData io_thread_data_; | 217 IOThreadData io_thread_data_; |
218 | 218 |
219 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); | 219 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); |
220 }; | 220 }; |
221 | 221 |
222 // Export TranslatePepperFileReadWriteOpenFlags for testing. | 222 // Export TranslatePepperFileReadWriteOpenFlags for testing. |
223 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags); | 223 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags); |
224 | 224 |
225 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ | 225 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ |
OLD | NEW |