OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
7 #include "chrome/common/command_buffer_messages.h" | 7 #include "chrome/common/command_buffer_messages.h" |
8 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.h" |
9 #include "chrome/renderer/command_buffer_proxy.h" | 9 #include "chrome/renderer/command_buffer_proxy.h" |
10 #include "chrome/renderer/plugin_channel_host.h" | 10 #include "chrome/renderer/plugin_channel_host.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 base::SharedMemoryHandle handle; | 146 base::SharedMemoryHandle handle; |
147 size_t size; | 147 size_t size; |
148 if (!Send(new CommandBufferMsg_GetTransferBuffer(route_id_, | 148 if (!Send(new CommandBufferMsg_GetTransferBuffer(route_id_, |
149 id, | 149 id, |
150 &handle, | 150 &handle, |
151 &size))) { | 151 &size))) { |
152 return Buffer(); | 152 return Buffer(); |
153 } | 153 } |
154 | 154 |
155 // Cache the transfer buffer shared memory object client side. | 155 // Cache the transfer buffer shared memory object client side. |
| 156 #if defined(OS_WIN) |
| 157 // TODO(piman): Does Windows needs this version of the constructor ? It |
| 158 // duplicates the handle, but I'm not sure why it is necessary - it was |
| 159 // already duped by the CommandBufferStub. |
156 base::SharedMemory* shared_memory = | 160 base::SharedMemory* shared_memory = |
157 new base::SharedMemory(handle, false, base::GetCurrentProcessHandle()); | 161 new base::SharedMemory(handle, false, base::GetCurrentProcessHandle()); |
| 162 #else |
| 163 base::SharedMemory* shared_memory = |
| 164 new base::SharedMemory(handle, false); |
| 165 #endif |
158 | 166 |
159 // Map the shared memory on demand. | 167 // Map the shared memory on demand. |
160 if (!shared_memory->memory()) { | 168 if (!shared_memory->memory()) { |
161 if (!shared_memory->Map(shared_memory->max_size())) { | 169 if (!shared_memory->Map(size)) { |
162 delete shared_memory; | 170 delete shared_memory; |
163 return Buffer(); | 171 return Buffer(); |
164 } | 172 } |
165 } | 173 } |
166 | 174 |
167 Buffer buffer; | 175 Buffer buffer; |
168 buffer.ptr = shared_memory->memory(); | 176 buffer.ptr = shared_memory->memory(); |
169 buffer.size = size; | 177 buffer.size = size; |
170 buffer.shared_memory = shared_memory; | 178 buffer.shared_memory = shared_memory; |
171 transfer_buffers_[id] = buffer; | 179 transfer_buffers_[id] = buffer; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 if (Send(new CommandBufferMsg_GetErrorStatus(route_id_, &status))) | 212 if (Send(new CommandBufferMsg_GetErrorStatus(route_id_, &status))) |
205 return status; | 213 return status; |
206 | 214 |
207 return true; | 215 return true; |
208 } | 216 } |
209 | 217 |
210 void CommandBufferProxy::RaiseErrorStatus() { | 218 void CommandBufferProxy::RaiseErrorStatus() { |
211 // Not implemented in proxy. | 219 // Not implemented in proxy. |
212 NOTREACHED(); | 220 NOTREACHED(); |
213 } | 221 } |
OLD | NEW |