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" |
18 #include "base/task_runner.h" | 19 #include "base/task_runner.h" |
19 #include "ipc/ipc_channel.h" | 20 #include "ipc/ipc_channel.h" |
20 #include "ipc/ipc_message.h" | 21 #include "ipc/ipc_message.h" |
| 22 #include "ipc/ipc_sync_message.h" |
21 | 23 |
22 struct NaClDesc; | 24 struct NaClDesc; |
23 struct NaClImcTypedMsgHdr; | 25 struct NaClImcTypedMsgHdr; |
24 struct PP_Size; | 26 struct PP_Size; |
25 | 27 |
26 namespace IPC { | 28 namespace IPC { |
27 class Message; | 29 class Message; |
28 } | 30 } |
29 | 31 |
30 namespace nacl { | 32 namespace nacl { |
(...skipping 79 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 | 112 // This is the data that must only be accessed inside the lock. This struct |
111 // just separates it so it's easier to see. | 113 // just separates it so it's easier to see. |
112 struct LockedData { | 114 struct LockedData { |
113 LockedData(); | 115 LockedData(); |
114 ~LockedData(); | 116 ~LockedData(); |
115 | 117 |
116 // Messages that we have read off of the Chrome IPC channel that are waiting | 118 // Messages that we have read off of the Chrome IPC channel that are waiting |
117 // to be received by the plugin. | 119 // to be received by the plugin. |
118 std::queue< scoped_refptr<RewrittenMessage> > to_be_received_; | 120 std::queue< scoped_refptr<RewrittenMessage> > to_be_received_; |
119 | 121 |
| 122 // This is a cheap and dirty hack to save off the size (and make sure we |
| 123 // read the right replies). |
| 124 typedef std::map<int, uint32_t> PendingImageDataMsgMap; |
| 125 PendingImageDataMsgMap pending_image_data_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 // Wrapped descriptors and handles for transfer to untrusted code. | 136 // Wrapped descriptors and handles for transfer to untrusted code. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // To be accessed inside of lock_ only. | 177 // To be accessed inside of lock_ only. |
171 LockedData locked_data_; | 178 LockedData locked_data_; |
172 | 179 |
173 // To be accessed on the I/O thread (via task runner) only. | 180 // To be accessed on the I/O thread (via task runner) only. |
174 IOThreadData io_thread_data_; | 181 IOThreadData io_thread_data_; |
175 | 182 |
176 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); | 183 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); |
177 }; | 184 }; |
178 | 185 |
179 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ | 186 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ |
OLD | NEW |