| 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 #include "ppapi/proxy/ppapi_command_buffer_proxy.h" | 5 #include "ppapi/proxy/ppapi_command_buffer_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/proxy/ppapi_messages.h" | 7 #include "ppapi/proxy/ppapi_messages.h" |
| 8 #include "ppapi/proxy/proxy_channel.h" | 8 #include "ppapi/proxy/proxy_channel.h" |
| 9 #include "ppapi/shared_impl/api_id.h" | 9 #include "ppapi/shared_impl/api_id.h" |
| 10 #include "ppapi/shared_impl/host_resource.h" | 10 #include "ppapi/shared_impl/host_resource.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 scoped_ptr<base::SharedMemory> shared_memory( | 129 scoped_ptr<base::SharedMemory> shared_memory( |
| 130 new base::SharedMemory(handle.shmem(), false)); | 130 new base::SharedMemory(handle.shmem(), false)); |
| 131 | 131 |
| 132 // Map the shared memory on demand. | 132 // Map the shared memory on demand. |
| 133 if (!shared_memory->memory()) { | 133 if (!shared_memory->memory()) { |
| 134 if (!shared_memory->Map(handle.size())) { | 134 if (!shared_memory->Map(handle.size())) { |
| 135 return NULL; | 135 return NULL; |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 scoped_refptr<gpu::Buffer> buffer = | 139 return gpu::MakeBufferFromSharedMemory(shared_memory.Pass(), handle.size()); |
| 140 new gpu::Buffer(shared_memory.Pass(), handle.size()); | |
| 141 return buffer; | |
| 142 } | 140 } |
| 143 | 141 |
| 144 void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) { | 142 void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) { |
| 145 if (last_state_.error != gpu::error::kNoError) | 143 if (last_state_.error != gpu::error::kNoError) |
| 146 return; | 144 return; |
| 147 | 145 |
| 148 Send(new PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer( | 146 Send(new PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer( |
| 149 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id)); | 147 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id)); |
| 150 } | 148 } |
| 151 | 149 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 last_state_ = state; | 223 last_state_ = state; |
| 226 } | 224 } |
| 227 } else { | 225 } else { |
| 228 last_state_.error = gpu::error::kLostContext; | 226 last_state_.error = gpu::error::kLostContext; |
| 229 ++last_state_.generation; | 227 ++last_state_.generation; |
| 230 } | 228 } |
| 231 } | 229 } |
| 232 | 230 |
| 233 } // namespace proxy | 231 } // namespace proxy |
| 234 } // namespace ppapi | 232 } // namespace ppapi |
| OLD | NEW |