| 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/ppb_graphics_3d_proxy.h" | 5 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 #include "gpu/command_buffer/common/command_buffer.h" | 8 #include "gpu/command_buffer/common/command_buffer.h" |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/proxy/enter_proxy.h" | 10 #include "ppapi/proxy/enter_proxy.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 new PpapiCommandBufferProxy(host_resource(), dispatcher)); | 61 new PpapiCommandBufferProxy(host_resource(), dispatcher)); |
| 62 | 62 |
| 63 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize, | 63 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize, |
| 64 share_gles2); | 64 share_gles2); |
| 65 } | 65 } |
| 66 | 66 |
| 67 PP_Bool Graphics3D::SetGetBuffer(int32_t /* transfer_buffer_id */) { | 67 PP_Bool Graphics3D::SetGetBuffer(int32_t /* transfer_buffer_id */) { |
| 68 return PP_FALSE; | 68 return PP_FALSE; |
| 69 } | 69 } |
| 70 | 70 |
| 71 gpu::CommandBuffer::State Graphics3D::GetState() { | |
| 72 return GetErrorState(); | |
| 73 } | |
| 74 | |
| 75 PP_Bool Graphics3D::Flush(int32_t put_offset) { | 71 PP_Bool Graphics3D::Flush(int32_t put_offset) { |
| 76 return PP_FALSE; | 72 return PP_FALSE; |
| 77 } | 73 } |
| 78 | 74 |
| 79 scoped_refptr<gpu::Buffer> Graphics3D::CreateTransferBuffer( | 75 scoped_refptr<gpu::Buffer> Graphics3D::CreateTransferBuffer( |
| 80 uint32_t size, | 76 uint32_t size, |
| 81 int32_t* id) { | 77 int32_t* id) { |
| 82 *id = -1; | 78 *id = -1; |
| 83 return NULL; | 79 return NULL; |
| 84 } | 80 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 170 } |
| 175 | 171 |
| 176 bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { | 172 bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 177 bool handled = true; | 173 bool handled = true; |
| 178 IPC_BEGIN_MESSAGE_MAP(PPB_Graphics3D_Proxy, msg) | 174 IPC_BEGIN_MESSAGE_MAP(PPB_Graphics3D_Proxy, msg) |
| 179 #if !defined(OS_NACL) | 175 #if !defined(OS_NACL) |
| 180 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Create, | 176 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Create, |
| 181 OnMsgCreate) | 177 OnMsgCreate) |
| 182 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SetGetBuffer, | 178 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SetGetBuffer, |
| 183 OnMsgSetGetBuffer) | 179 OnMsgSetGetBuffer) |
| 184 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetState, | |
| 185 OnMsgGetState) | |
| 186 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForTokenInRange, | 180 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForTokenInRange, |
| 187 OnMsgWaitForTokenInRange) | 181 OnMsgWaitForTokenInRange) |
| 188 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForGetOffsetInRange, | 182 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForGetOffsetInRange, |
| 189 OnMsgWaitForGetOffsetInRange) | 183 OnMsgWaitForGetOffsetInRange) |
| 190 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush, OnMsgAsyncFlush) | 184 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush, OnMsgAsyncFlush) |
| 191 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer, | 185 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer, |
| 192 OnMsgCreateTransferBuffer) | 186 OnMsgCreateTransferBuffer) |
| 193 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer, | 187 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer, |
| 194 OnMsgDestroyTransferBuffer) | 188 OnMsgDestroyTransferBuffer) |
| 195 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers, | 189 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 223 } |
| 230 | 224 |
| 231 void PPB_Graphics3D_Proxy::OnMsgSetGetBuffer( | 225 void PPB_Graphics3D_Proxy::OnMsgSetGetBuffer( |
| 232 const HostResource& context, | 226 const HostResource& context, |
| 233 int32 transfer_buffer_id) { | 227 int32 transfer_buffer_id) { |
| 234 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | 228 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); |
| 235 if (enter.succeeded()) | 229 if (enter.succeeded()) |
| 236 enter.object()->SetGetBuffer(transfer_buffer_id); | 230 enter.object()->SetGetBuffer(transfer_buffer_id); |
| 237 } | 231 } |
| 238 | 232 |
| 239 void PPB_Graphics3D_Proxy::OnMsgGetState(const HostResource& context, | |
| 240 gpu::CommandBuffer::State* state, | |
| 241 bool* success) { | |
| 242 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | |
| 243 if (enter.failed()) { | |
| 244 *success = false; | |
| 245 return; | |
| 246 } | |
| 247 *state = enter.object()->GetState(); | |
| 248 *success = true; | |
| 249 } | |
| 250 | |
| 251 void PPB_Graphics3D_Proxy::OnMsgWaitForTokenInRange( | 233 void PPB_Graphics3D_Proxy::OnMsgWaitForTokenInRange( |
| 252 const HostResource& context, | 234 const HostResource& context, |
| 253 int32 start, | 235 int32 start, |
| 254 int32 end, | 236 int32 end, |
| 255 gpu::CommandBuffer::State* state, | 237 gpu::CommandBuffer::State* state, |
| 256 bool* success) { | 238 bool* success) { |
| 257 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | 239 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); |
| 258 if (enter.failed()) { | 240 if (enter.failed()) { |
| 259 *success = false; | 241 *success = false; |
| 260 return; | 242 return; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 int32_t result, | 327 int32_t result, |
| 346 const HostResource& context) { | 328 const HostResource& context) { |
| 347 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( | 329 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( |
| 348 API_ID_PPB_GRAPHICS_3D, context, result)); | 330 API_ID_PPB_GRAPHICS_3D, context, result)); |
| 349 } | 331 } |
| 350 #endif // !defined(OS_NACL) | 332 #endif // !defined(OS_NACL) |
| 351 | 333 |
| 352 } // namespace proxy | 334 } // namespace proxy |
| 353 } // namespace ppapi | 335 } // namespace ppapi |
| 354 | 336 |
| OLD | NEW |