Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: ppapi/proxy/ppb_graphics_3d_proxy.cc

Issue 7457027: Various fixes to Graphics3D proxy to make it work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/dispatcher.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/proxy/enter_proxy.h" 9 #include "ppapi/proxy/enter_proxy.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 Graphics3D::~Graphics3D() { 329 Graphics3D::~Graphics3D() {
330 DestroyGLES2Impl(); 330 DestroyGLES2Impl();
331 } 331 }
332 332
333 bool Graphics3D::Init() { 333 bool Graphics3D::Init() {
334 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance()); 334 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance());
335 if (!dispatcher) 335 if (!dispatcher)
336 return false; 336 return false;
337 337
338 command_buffer_.reset(new CommandBuffer(host_resource(), dispatcher)); 338 command_buffer_.reset(new CommandBuffer(host_resource(), dispatcher));
339 if (!command_buffer_->Initialize(kCommandBufferSize))
340 return false;
339 341
340 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize); 342 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize);
341 } 343 }
342 344
343 PP_Bool Graphics3D::InitCommandBuffer(int32_t size) { 345 PP_Bool Graphics3D::InitCommandBuffer(int32_t size) {
344 return PP_FALSE; 346 return PP_FALSE;
345 } 347 }
346 348
347 PP_Bool Graphics3D::GetRingBuffer(int* shm_handle, uint32_t* shm_size) { 349 PP_Bool Graphics3D::GetRingBuffer(int* shm_handle, uint32_t* shm_size) {
348 return PP_FALSE; 350 return PP_FALSE;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 INTERFACE_ID_PPB_GRAPHICS_3D, host_resource()); 390 INTERFACE_ID_PPB_GRAPHICS_3D, host_resource());
389 msg->set_unblock(true); 391 msg->set_unblock(true);
390 GetDispatcher()->Send(msg); 392 GetDispatcher()->Send(msg);
391 393
392 gles2_impl()->SwapBuffers(); 394 gles2_impl()->SwapBuffers();
393 return PP_OK_COMPLETIONPENDING; 395 return PP_OK_COMPLETIONPENDING;
394 } 396 }
395 397
396 PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher, 398 PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher,
397 const void* target_interface) 399 const void* target_interface)
398 : InterfaceProxy(dispatcher, target_interface) { 400 : InterfaceProxy(dispatcher, target_interface),
401 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
399 } 402 }
400 403
401 PPB_Graphics3D_Proxy::~PPB_Graphics3D_Proxy() { 404 PPB_Graphics3D_Proxy::~PPB_Graphics3D_Proxy() {
402 } 405 }
403 406
404 // static 407 // static
405 const InterfaceProxy::Info* PPB_Graphics3D_Proxy::GetInfo() { 408 const InterfaceProxy::Info* PPB_Graphics3D_Proxy::GetInfo() {
406 static const Info info = { 409 static const Info info = {
407 ::ppapi::thunk::GetPPB_Graphics3D_Thunk(), 410 ::ppapi::thunk::GetPPB_Graphics3D_Thunk(),
408 PPB_GRAPHICS_3D_DEV_INTERFACE, 411 PPB_GRAPHICS_3D_DEV_INTERFACE,
(...skipping 15 matching lines...) Expand all
424 return PP_ERROR_BADARGUMENT; 427 return PP_ERROR_BADARGUMENT;
425 428
426 // TODO(alokp): Support shared context. 429 // TODO(alokp): Support shared context.
427 DCHECK_EQ(0, share_context); 430 DCHECK_EQ(0, share_context);
428 if (share_context != 0) 431 if (share_context != 0)
429 return 0; 432 return 0;
430 433
431 std::vector<int32_t> attribs; 434 std::vector<int32_t> attribs;
432 if (attrib_list) { 435 if (attrib_list) {
433 for (const int32_t* attr = attrib_list; 436 for (const int32_t* attr = attrib_list;
434 *attr != PP_GRAPHICS3DATTRIB_NONE; 437 attr[0] != PP_GRAPHICS3DATTRIB_NONE;
435 ++attr) { 438 attr += 2) {
436 attribs.push_back(*attr); 439 attribs.push_back(attr[0]);
440 attribs.push_back(attr[1]);
437 } 441 }
438 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE);
439 } 442 }
443 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE);
440 444
441 HostResource result; 445 HostResource result;
442 dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create( 446 dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create(
443 INTERFACE_ID_PPB_GRAPHICS_3D, instance, config, attribs, &result)); 447 INTERFACE_ID_PPB_GRAPHICS_3D, instance, config, attribs, &result));
444 if (result.is_null()) 448 if (result.is_null())
445 return 0; 449 return 0;
446 450
447 linked_ptr<Graphics3D> graphics_3d(new Graphics3D(result)); 451 linked_ptr<Graphics3D> graphics_3d(new Graphics3D(result));
448 if (!graphics_3d->Init()) 452 if (!graphics_3d->Init())
449 return 0; 453 return 0;
(...skipping 29 matching lines...) Expand all
479 483
480 IPC_END_MESSAGE_MAP() 484 IPC_END_MESSAGE_MAP()
481 // FIXME(brettw) handle bad messages! 485 // FIXME(brettw) handle bad messages!
482 return handled; 486 return handled;
483 } 487 }
484 488
485 void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance, 489 void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance,
486 PP_Config3D_Dev config, 490 PP_Config3D_Dev config,
487 const std::vector<int32_t>& attribs, 491 const std::vector<int32_t>& attribs,
488 HostResource* result) { 492 HostResource* result) {
489 if (attribs.empty() || attribs.back() != 0) 493 if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE)
490 return; // Bad message. 494 return; // Bad message.
491 495
492 EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true); 496 EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
493 if (enter.succeeded()) { 497 if (enter.succeeded()) {
494 result->SetHostResource( 498 result->SetHostResource(
495 instance, 499 instance,
496 enter.functions()->CreateGraphics3DRaw(instance, config, 0, 500 enter.functions()->CreateGraphics3DRaw(instance, config, 0,
497 &attribs.front())); 501 &attribs.front()));
498 } 502 }
499 } 503 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( 612 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin(
609 int32_t result, 613 int32_t result,
610 const HostResource& context) { 614 const HostResource& context) {
611 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( 615 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK(
612 INTERFACE_ID_PPB_GRAPHICS_3D, context, result)); 616 INTERFACE_ID_PPB_GRAPHICS_3D, context, result));
613 } 617 }
614 618
615 } // namespace proxy 619 } // namespace proxy
616 } // namespace pp 620 } // namespace pp
617 621
OLDNEW
« no previous file with comments | « ppapi/proxy/dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698