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 <queue> | 9 #include <queue> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
15 #include "base/shared_memory.h" | 16 #include "base/shared_memory.h" |
16 #include "base/synchronization/condition_variable.h" | 17 #include "base/synchronization/condition_variable.h" |
17 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // This is the data that must only be accessed inside the lock. This struct | 111 // This is the data that must only be accessed inside the lock. This struct |
111 // just separates it so it's easier to see. | 112 // just separates it so it's easier to see. |
112 struct LockedData { | 113 struct LockedData { |
113 LockedData(); | 114 LockedData(); |
114 ~LockedData(); | 115 ~LockedData(); |
115 | 116 |
116 // Messages that we have read off of the Chrome IPC channel that are waiting | 117 // Messages that we have read off of the Chrome IPC channel that are waiting |
117 // to be received by the plugin. | 118 // to be received by the plugin. |
118 std::queue< scoped_refptr<RewrittenMessage> > to_be_received_; | 119 std::queue< scoped_refptr<RewrittenMessage> > to_be_received_; |
119 | 120 |
| 121 // When we send a synchronous message (from untrusted to trusted), we store |
| 122 // its type here, so that later we can associate the reply with its type |
| 123 // and potentially translate handles in the message. |
| 124 typedef std::map<int, uint32> PendingSyncMsgMap; |
| 125 PendingSyncMsgMap pending_sync_msgs_; |
| 126 |
120 // Data that we've queued from the plugin to send, but doesn't consist of a | 127 // Data that we've queued from the plugin to send, but doesn't consist of a |
121 // full message yet. The calling code can break apart the message into | 128 // full message yet. The calling code can break apart the message into |
122 // smaller pieces, and we need to send the message to the other process in | 129 // smaller pieces, and we need to send the message to the other process in |
123 // one chunk. | 130 // one chunk. |
124 // | 131 // |
125 // The IPC channel always starts a new send() at the beginning of each | 132 // The IPC channel always starts a new send() at the beginning of each |
126 // message, so we don't need to worry about arbitrary message boundaries. | 133 // message, so we don't need to worry about arbitrary message boundaries. |
127 std::string to_be_sent_; | 134 std::string to_be_sent_; |
128 | 135 |
129 bool channel_closed_; | 136 bool channel_closed_; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // To be accessed inside of lock_ only. | 175 // To be accessed inside of lock_ only. |
169 LockedData locked_data_; | 176 LockedData locked_data_; |
170 | 177 |
171 // To be accessed on the I/O thread (via task runner) only. | 178 // To be accessed on the I/O thread (via task runner) only. |
172 IOThreadData io_thread_data_; | 179 IOThreadData io_thread_data_; |
173 | 180 |
174 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); | 181 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); |
175 }; | 182 }; |
176 | 183 |
177 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ | 184 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ |
OLD | NEW |