| 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. | |
| 160 base::SharedMemory* shared_memory = | 156 base::SharedMemory* shared_memory = |
| 161 new base::SharedMemory(handle, false, base::GetCurrentProcessHandle()); | 157 new base::SharedMemory(handle, false, base::GetCurrentProcessHandle()); |
| 162 #else | |
| 163 base::SharedMemory* shared_memory = | |
| 164 new base::SharedMemory(handle, false); | |
| 165 #endif | |
| 166 | 158 |
| 167 // Map the shared memory on demand. | 159 // Map the shared memory on demand. |
| 168 if (!shared_memory->memory()) { | 160 if (!shared_memory->memory()) { |
| 169 if (!shared_memory->Map(size)) { | 161 if (!shared_memory->Map(shared_memory->max_size())) { |
| 170 delete shared_memory; | 162 delete shared_memory; |
| 171 return Buffer(); | 163 return Buffer(); |
| 172 } | 164 } |
| 173 } | 165 } |
| 174 | 166 |
| 175 Buffer buffer; | 167 Buffer buffer; |
| 176 buffer.ptr = shared_memory->memory(); | 168 buffer.ptr = shared_memory->memory(); |
| 177 buffer.size = size; | 169 buffer.size = size; |
| 178 buffer.shared_memory = shared_memory; | 170 buffer.shared_memory = shared_memory; |
| 179 transfer_buffers_[id] = buffer; | 171 transfer_buffers_[id] = buffer; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 if (Send(new CommandBufferMsg_GetErrorStatus(route_id_, &status))) | 204 if (Send(new CommandBufferMsg_GetErrorStatus(route_id_, &status))) |
| 213 return status; | 205 return status; |
| 214 | 206 |
| 215 return true; | 207 return true; |
| 216 } | 208 } |
| 217 | 209 |
| 218 void CommandBufferProxy::RaiseErrorStatus() { | 210 void CommandBufferProxy::RaiseErrorStatus() { |
| 219 // Not implemented in proxy. | 211 // Not implemented in proxy. |
| 220 NOTREACHED(); | 212 NOTREACHED(); |
| 221 } | 213 } |
| OLD | NEW |