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

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

Issue 6286070: Remove all uses of the global Dispatcher Get function. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 Surface3D* draw_surface = object->get_draw_surface(); 117 Surface3D* draw_surface = object->get_draw_surface();
118 Surface3D* read_surface = object->get_read_surface(); 118 Surface3D* read_surface = object->get_read_surface();
119 119
120 *draw = draw_surface ? draw_surface->resource() : 0; 120 *draw = draw_surface ? draw_surface->resource() : 0;
121 *read = read_surface ? read_surface->resource() : 0; 121 *read = read_surface ? read_surface->resource() : 0;
122 return PP_OK; 122 return PP_OK;
123 } 123 }
124 124
125 125
126 const PPB_Context3D_Dev ppb_context_3d = { 126 const PPB_Context3D_Dev context_3d_interface = {
127 &Create, 127 &Create,
128 &IsContext3D, 128 &IsContext3D,
129 &GetAttrib, 129 &GetAttrib,
130 &BindSurfaces, 130 &BindSurfaces,
131 &GetBoundSurfaces, 131 &GetBoundSurfaces,
132 }; 132 };
133 133
134 base::SharedMemoryHandle SHMHandleFromInt(int shm_handle) { 134 base::SharedMemoryHandle SHMHandleFromInt(int shm_handle) {
135 #if defined(OS_POSIX) 135 #if defined(OS_POSIX)
136 return base::FileDescriptor(shm_handle, true); 136 return base::FileDescriptor(shm_handle, true);
(...skipping 12 matching lines...) Expand all
149 state.put_offset = s.put_offset; 149 state.put_offset = s.put_offset;
150 state.token = s.token; 150 state.token = s.token;
151 state.error = static_cast<gpu::error::Error>(s.error); 151 state.error = static_cast<gpu::error::Error>(s.error);
152 return state; 152 return state;
153 } 153 }
154 154
155 // Size of the transfer buffer. 155 // Size of the transfer buffer.
156 const int32 kCommandBufferSize = 1024 * 1024; 156 const int32 kCommandBufferSize = 1024 * 1024;
157 const int32 kTransferBufferSize = 1024 * 1024; 157 const int32 kTransferBufferSize = 1024 * 1024;
158 158
159 InterfaceProxy* CreateContext3DProxy(Dispatcher* dispatcher,
160 const void* target_interface) {
161 return new PPB_Context3D_Proxy(dispatcher, target_interface);
162 }
163
159 } // namespace 164 } // namespace
160 165
161 class PepperCommandBuffer : public gpu::CommandBuffer { 166 class PepperCommandBuffer : public gpu::CommandBuffer {
162 public: 167 public:
163 PepperCommandBuffer(const HostResource& resource, 168 PepperCommandBuffer(const HostResource& resource,
164 PluginDispatcher* dispatcher); 169 PluginDispatcher* dispatcher);
165 virtual ~PepperCommandBuffer(); 170 virtual ~PepperCommandBuffer();
166 171
167 // CommandBuffer implementation: 172 // CommandBuffer implementation:
168 virtual bool Initialize(int32 size); 173 virtual bool Initialize(int32 size);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 444 }
440 445
441 PPB_Context3D_Proxy::PPB_Context3D_Proxy(Dispatcher* dispatcher, 446 PPB_Context3D_Proxy::PPB_Context3D_Proxy(Dispatcher* dispatcher,
442 const void* target_interface) 447 const void* target_interface)
443 : InterfaceProxy(dispatcher, target_interface) { 448 : InterfaceProxy(dispatcher, target_interface) {
444 } 449 }
445 450
446 PPB_Context3D_Proxy::~PPB_Context3D_Proxy() { 451 PPB_Context3D_Proxy::~PPB_Context3D_Proxy() {
447 } 452 }
448 453
454 // static
455 const InterfaceProxy::Info* PPB_Context3D_Proxy::GetInfo() {
456 static const Info info = {
457 &context_3d_interface,
458 PPB_CONTEXT_3D_DEV_INTERFACE,
459 INTERFACE_ID_PPB_CONTEXT_3D,
460 false,
461 &CreateContext3DProxy,
462 };
463 return &info;
464 }
465
449 const PPB_Context3DTrusted_Dev* 466 const PPB_Context3DTrusted_Dev*
450 PPB_Context3D_Proxy::ppb_context_3d_trusted() const { 467 PPB_Context3D_Proxy::ppb_context_3d_trusted() const {
451 return static_cast<const PPB_Context3DTrusted_Dev*>( 468 return static_cast<const PPB_Context3DTrusted_Dev*>(
452 dispatcher()->GetLocalInterface( 469 dispatcher()->GetLocalInterface(
453 PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE)); 470 PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE));
454 } 471 }
455 472
456 const void* PPB_Context3D_Proxy::GetSourceInterface() const {
457 return &ppb_context_3d;
458 }
459
460 InterfaceID PPB_Context3D_Proxy::GetInterfaceId() const {
461 return INTERFACE_ID_PPB_CONTEXT_3D;
462 }
463
464 bool PPB_Context3D_Proxy::OnMessageReceived(const IPC::Message& msg) { 473 bool PPB_Context3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
465 bool handled = true; 474 bool handled = true;
466 IPC_BEGIN_MESSAGE_MAP(PPB_Context3D_Proxy, msg) 475 IPC_BEGIN_MESSAGE_MAP(PPB_Context3D_Proxy, msg)
467 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_Create, 476 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_Create,
468 OnMsgCreate) 477 OnMsgCreate)
469 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_BindSurfaces, 478 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_BindSurfaces,
470 OnMsgBindSurfaces) 479 OnMsgBindSurfaces)
471 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_Initialize, 480 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_Initialize,
472 OnMsgInitialize) 481 OnMsgInitialize)
473 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_GetState, 482 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_GetState,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 &shm_handle, 584 &shm_handle,
576 &shm_size)) { 585 &shm_size)) {
577 return; 586 return;
578 } 587 }
579 *transfer_buffer = SHMHandleFromInt(shm_handle); 588 *transfer_buffer = SHMHandleFromInt(shm_handle);
580 *size = shm_size; 589 *size = shm_size;
581 } 590 }
582 591
583 } // namespace proxy 592 } // namespace proxy
584 } // namespace pp 593 } // namespace pp
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