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

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

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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/ppb_context_3d_proxy.h ('k') | ppapi/proxy/ppb_core_proxy.h » ('j') | 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_context_3d_proxy.h" 5 #include "ppapi/proxy/ppb_context_3d_proxy.h"
6 6
7 #include "base/hash_tables.h" 7 #include "base/hash_tables.h"
8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
9 #include "gpu/command_buffer/client/gles2_implementation.h" 9 #include "gpu/command_buffer/client/gles2_implementation.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 state.token = s.token; 61 state.token = s.token;
62 state.error = static_cast<gpu::error::Error>(s.error); 62 state.error = static_cast<gpu::error::Error>(s.error);
63 state.generation = s.generation; 63 state.generation = s.generation;
64 return state; 64 return state;
65 } 65 }
66 66
67 // Size of the transfer buffer. 67 // Size of the transfer buffer.
68 const int32 kCommandBufferSize = 1024 * 1024; 68 const int32 kCommandBufferSize = 1024 * 1024;
69 const int32 kTransferBufferSize = 1024 * 1024; 69 const int32 kTransferBufferSize = 1024 * 1024;
70 70
71 InterfaceProxy* CreateContext3DProxy(Dispatcher* dispatcher,
72 const void* target_interface) {
73 return new PPB_Context3D_Proxy(dispatcher, target_interface);
74 }
75
71 } // namespace 76 } // namespace
72 77
73 class PepperCommandBuffer : public gpu::CommandBuffer { 78 class PepperCommandBuffer : public gpu::CommandBuffer {
74 public: 79 public:
75 PepperCommandBuffer(const HostResource& resource, 80 PepperCommandBuffer(const HostResource& resource,
76 PluginDispatcher* dispatcher); 81 PluginDispatcher* dispatcher);
77 virtual ~PepperCommandBuffer(); 82 virtual ~PepperCommandBuffer();
78 83
79 // CommandBuffer implementation: 84 // CommandBuffer implementation:
80 virtual bool Initialize(int32 size); 85 virtual bool Initialize(int32 size);
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 void Context3D::UnmapTexSubImage2DCHROMIUM(const void* mem) { 514 void Context3D::UnmapTexSubImage2DCHROMIUM(const void* mem) {
510 gles2_impl_->UnmapTexSubImage2DCHROMIUM(mem); 515 gles2_impl_->UnmapTexSubImage2DCHROMIUM(mem);
511 } 516 }
512 517
513 gpu::gles2::GLES2Implementation* Context3D::GetGLES2Impl() { 518 gpu::gles2::GLES2Implementation* Context3D::GetGLES2Impl() {
514 return gles2_impl(); 519 return gles2_impl();
515 } 520 }
516 521
517 // PPB_Context3D_Proxy --------------------------------------------------------- 522 // PPB_Context3D_Proxy ---------------------------------------------------------
518 523
519 PPB_Context3D_Proxy::PPB_Context3D_Proxy(Dispatcher* dispatcher) 524 PPB_Context3D_Proxy::PPB_Context3D_Proxy(Dispatcher* dispatcher,
520 : InterfaceProxy(dispatcher) { 525 const void* target_interface)
526 : InterfaceProxy(dispatcher, target_interface) {
521 } 527 }
522 528
523 PPB_Context3D_Proxy::~PPB_Context3D_Proxy() { 529 PPB_Context3D_Proxy::~PPB_Context3D_Proxy() {
524 } 530 }
525 531
526 // static 532 // static
533 const InterfaceProxy::Info* PPB_Context3D_Proxy::GetInfo() {
534 static const Info info = {
535 thunk::GetPPB_Context3D_Thunk(),
536 PPB_CONTEXT_3D_DEV_INTERFACE,
537 INTERFACE_ID_PPB_CONTEXT_3D,
538 false,
539 &CreateContext3DProxy,
540 };
541 return &info;
542 }
543
544 // static
545 const InterfaceProxy::Info* PPB_Context3D_Proxy::GetTextureMappingInfo() {
546 static const Info info = {
547 thunk::GetPPB_GLESChromiumTextureMapping_Thunk(),
548 PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE,
549 INTERFACE_ID_NONE, // CONTEXT_3D is the canonical one.
550 false,
551 &CreateContext3DProxy,
552 };
553 return &info;
554 }
555
556 // static
527 PP_Resource PPB_Context3D_Proxy::Create(PP_Instance instance, 557 PP_Resource PPB_Context3D_Proxy::Create(PP_Instance instance,
528 PP_Config3D_Dev config, 558 PP_Config3D_Dev config,
529 PP_Resource share_context, 559 PP_Resource share_context,
530 const int32_t* attrib_list) { 560 const int32_t* attrib_list) {
531 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 561 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
532 if (!dispatcher) 562 if (!dispatcher)
533 return PP_ERROR_BADARGUMENT; 563 return PP_ERROR_BADARGUMENT;
534 564
535 // TODO(alokp): Support shared context. 565 // TODO(alokp): Support shared context.
536 DCHECK_EQ(0, share_context); 566 DCHECK_EQ(0, share_context);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 // FIXME(brettw) handle bad messages! 614 // FIXME(brettw) handle bad messages!
585 return handled; 615 return handled;
586 } 616 }
587 617
588 void PPB_Context3D_Proxy::OnMsgCreate(PP_Instance instance, 618 void PPB_Context3D_Proxy::OnMsgCreate(PP_Instance instance,
589 PP_Config3D_Dev config, 619 PP_Config3D_Dev config,
590 const std::vector<int32_t>& attribs, 620 const std::vector<int32_t>& attribs,
591 HostResource* result) { 621 HostResource* result) {
592 if (attribs.empty() || attribs.back() != 0) 622 if (attribs.empty() || attribs.back() != 0)
593 return; // Bad message. 623 return; // Bad message.
594 thunk::EnterResourceCreation enter(instance); 624 EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
595 if (enter.succeeded()) { 625 if (enter.succeeded()) {
596 result->SetHostResource( 626 result->SetHostResource(
597 instance, 627 instance,
598 enter.functions()->CreateContext3DRaw(instance, config, 0, 628 enter.functions()->CreateContext3DRaw(instance, config, 0,
599 &attribs.front())); 629 &attribs.front()));
600 } 630 }
601 } 631 }
602 632
603 void PPB_Context3D_Proxy::OnMsgBindSurfaces(const HostResource& context, 633 void PPB_Context3D_Proxy::OnMsgBindSurfaces(const HostResource& context,
604 const HostResource& draw, 634 const HostResource& draw,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 uint32_t shm_size = 0; 722 uint32_t shm_size = 0;
693 if (enter.succeeded() && 723 if (enter.succeeded() &&
694 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { 724 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) {
695 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); 725 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle);
696 *size = shm_size; 726 *size = shm_size;
697 } 727 }
698 } 728 }
699 729
700 } // namespace proxy 730 } // namespace proxy
701 } // namespace ppapi 731 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_context_3d_proxy.h ('k') | ppapi/proxy/ppb_core_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698