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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 scoped_refptr<Graphics3D> graphics_3d(new Graphics3D(result)); | 336 scoped_refptr<Graphics3D> graphics_3d(new Graphics3D(result)); |
337 if (!graphics_3d->Init(share_gles2)) | 337 if (!graphics_3d->Init(share_gles2)) |
338 return 0; | 338 return 0; |
339 return graphics_3d->GetReference(); | 339 return graphics_3d->GetReference(); |
340 } | 340 } |
341 | 341 |
342 bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { | 342 bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { |
343 bool handled = true; | 343 bool handled = true; |
344 IPC_BEGIN_MESSAGE_MAP(PPB_Graphics3D_Proxy, msg) | 344 IPC_BEGIN_MESSAGE_MAP(PPB_Graphics3D_Proxy, msg) |
| 345 #if !defined(OS_NACL) |
345 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Create, | 346 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Create, |
346 OnMsgCreate) | 347 OnMsgCreate) |
347 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_InitCommandBuffer, | 348 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_InitCommandBuffer, |
348 OnMsgInitCommandBuffer) | 349 OnMsgInitCommandBuffer) |
349 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SetGetBuffer, | 350 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SetGetBuffer, |
350 OnMsgSetGetBuffer) | 351 OnMsgSetGetBuffer) |
351 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetState, | 352 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetState, |
352 OnMsgGetState) | 353 OnMsgGetState) |
353 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Flush, | 354 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Flush, |
354 OnMsgFlush) | 355 OnMsgFlush) |
355 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush, | 356 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush, |
356 OnMsgAsyncFlush) | 357 OnMsgAsyncFlush) |
357 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer, | 358 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer, |
358 OnMsgCreateTransferBuffer) | 359 OnMsgCreateTransferBuffer) |
359 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer, | 360 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer, |
360 OnMsgDestroyTransferBuffer) | 361 OnMsgDestroyTransferBuffer) |
361 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer, | 362 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer, |
362 OnMsgGetTransferBuffer) | 363 OnMsgGetTransferBuffer) |
363 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers, | 364 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers, |
364 OnMsgSwapBuffers) | 365 OnMsgSwapBuffers) |
| 366 #endif // !defined(OS_NACL) |
365 | 367 |
366 IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK, | 368 IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK, |
367 OnMsgSwapBuffersACK) | 369 OnMsgSwapBuffersACK) |
368 IPC_MESSAGE_UNHANDLED(handled = false) | 370 IPC_MESSAGE_UNHANDLED(handled = false) |
369 | 371 |
370 IPC_END_MESSAGE_MAP() | 372 IPC_END_MESSAGE_MAP() |
371 // FIXME(brettw) handle bad messages! | 373 // FIXME(brettw) handle bad messages! |
372 return handled; | 374 return handled; |
373 } | 375 } |
374 | 376 |
| 377 #if !defined(OS_NACL) |
375 void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance, | 378 void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance, |
376 HostResource share_context, | 379 HostResource share_context, |
377 const std::vector<int32_t>& attribs, | 380 const std::vector<int32_t>& attribs, |
378 HostResource* result) { | 381 HostResource* result) { |
379 if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE) | 382 if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE) |
380 return; // Bad message. | 383 return; // Bad message. |
381 | 384 |
382 thunk::EnterResourceCreation enter(instance); | 385 thunk::EnterResourceCreation enter(instance); |
383 | 386 |
384 if (enter.succeeded()) { | 387 if (enter.succeeded()) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 483 } |
481 } | 484 } |
482 | 485 |
483 void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) { | 486 void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) { |
484 EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter( | 487 EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter( |
485 context, callback_factory_, | 488 context, callback_factory_, |
486 &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context); | 489 &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context); |
487 if (enter.succeeded()) | 490 if (enter.succeeded()) |
488 enter.SetResult(enter.object()->SwapBuffers(enter.callback())); | 491 enter.SetResult(enter.object()->SwapBuffers(enter.callback())); |
489 } | 492 } |
| 493 #endif // !defined(OS_NACL) |
490 | 494 |
491 void PPB_Graphics3D_Proxy::OnMsgSwapBuffersACK(const HostResource& resource, | 495 void PPB_Graphics3D_Proxy::OnMsgSwapBuffersACK(const HostResource& resource, |
492 int32_t pp_error) { | 496 int32_t pp_error) { |
493 EnterPluginFromHostResource<PPB_Graphics3D_API> enter(resource); | 497 EnterPluginFromHostResource<PPB_Graphics3D_API> enter(resource); |
494 if (enter.succeeded()) | 498 if (enter.succeeded()) |
495 static_cast<Graphics3D*>(enter.object())->SwapBuffersACK(pp_error); | 499 static_cast<Graphics3D*>(enter.object())->SwapBuffersACK(pp_error); |
496 } | 500 } |
497 | 501 |
| 502 #if !defined(OS_NACL) |
498 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( | 503 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( |
499 int32_t result, | 504 int32_t result, |
500 const HostResource& context) { | 505 const HostResource& context) { |
501 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( | 506 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( |
502 API_ID_PPB_GRAPHICS_3D, context, result)); | 507 API_ID_PPB_GRAPHICS_3D, context, result)); |
503 } | 508 } |
| 509 #endif // !defined(OS_NACL) |
504 | 510 |
505 } // namespace proxy | 511 } // namespace proxy |
506 } // namespace ppapi | 512 } // namespace ppapi |
507 | 513 |
OLD | NEW |