| 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 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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/pickle.h" | 16 #include "base/pickle.h" |
| 17 #include "base/shared_memory.h" | 17 #include "base/shared_memory.h" |
| 18 #include "base/synchronization/condition_variable.h" | 18 #include "base/synchronization/condition_variable.h" |
| 19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
| 20 #include "base/task_runner.h" | 20 #include "base/task_runner.h" |
| 21 #include "ipc/ipc_listener.h" | 21 #include "ipc/ipc_listener.h" |
| 22 #include "ppapi/proxy/handle_converter.h" |
| 22 | 23 |
| 23 struct NaClDesc; | 24 struct NaClDesc; |
| 24 struct NaClImcTypedMsgHdr; | 25 struct NaClImcTypedMsgHdr; |
| 25 struct PP_Size; | 26 struct PP_Size; |
| 26 | 27 |
| 27 namespace IPC { | 28 namespace IPC { |
| 28 class Channel; | 29 class Channel; |
| 29 struct ChannelHandle; | 30 struct ChannelHandle; |
| 30 } | 31 } |
| 31 | 32 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // This is the data that must only be accessed inside the lock. This struct | 122 // This is the data that must only be accessed inside the lock. This struct |
| 122 // just separates it so it's easier to see. | 123 // just separates it so it's easier to see. |
| 123 struct LockedData { | 124 struct LockedData { |
| 124 LockedData(); | 125 LockedData(); |
| 125 ~LockedData(); | 126 ~LockedData(); |
| 126 | 127 |
| 127 // Messages that we have read off of the Chrome IPC channel that are waiting | 128 // Messages that we have read off of the Chrome IPC channel that are waiting |
| 128 // to be received by the plugin. | 129 // to be received by the plugin. |
| 129 std::queue< scoped_refptr<RewrittenMessage> > to_be_received_; | 130 std::queue< scoped_refptr<RewrittenMessage> > to_be_received_; |
| 130 | 131 |
| 131 // When we send a synchronous message (from untrusted to trusted), we store | 132 ppapi::proxy::HandleConverter handle_converter_; |
| 132 // its type here, so that later we can associate the reply with its type | |
| 133 // and potentially translate handles in the message. | |
| 134 typedef std::map<int, uint32> PendingSyncMsgMap; | |
| 135 PendingSyncMsgMap pending_sync_msgs_; | |
| 136 | 133 |
| 137 // Data that we've queued from the plugin to send, but doesn't consist of a | 134 // Data that we've queued from the plugin to send, but doesn't consist of a |
| 138 // full message yet. The calling code can break apart the message into | 135 // full message yet. The calling code can break apart the message into |
| 139 // smaller pieces, and we need to send the message to the other process in | 136 // smaller pieces, and we need to send the message to the other process in |
| 140 // one chunk. | 137 // one chunk. |
| 141 // | 138 // |
| 142 // The IPC channel always starts a new send() at the beginning of each | 139 // The IPC channel always starts a new send() at the beginning of each |
| 143 // message, so we don't need to worry about arbitrary message boundaries. | 140 // message, so we don't need to worry about arbitrary message boundaries. |
| 144 std::string to_be_sent_; | 141 std::string to_be_sent_; |
| 145 | 142 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // To be accessed inside of lock_ only. | 182 // To be accessed inside of lock_ only. |
| 186 LockedData locked_data_; | 183 LockedData locked_data_; |
| 187 | 184 |
| 188 // To be accessed on the I/O thread (via task runner) only. | 185 // To be accessed on the I/O thread (via task runner) only. |
| 189 IOThreadData io_thread_data_; | 186 IOThreadData io_thread_data_; |
| 190 | 187 |
| 191 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); | 188 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); |
| 192 }; | 189 }; |
| 193 | 190 |
| 194 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ | 191 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ |
| OLD | NEW |