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

Side by Side Diff: webkit/plugins/ppapi/ppb_graphics_3d_impl.cc

Issue 8566059: Add CommandBuffer::SetGetBuffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: etc Created 9 years, 1 month 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
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 "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" 5 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "gpu/command_buffer/client/gles2_implementation.h" 9 #include "gpu/command_buffer/client/gles2_implementation.h"
10 #include "webkit/plugins/ppapi/plugin_module.h" 10 #include "webkit/plugins/ppapi/plugin_module.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 new PPB_Graphics3D_Impl(instance)); 80 new PPB_Graphics3D_Impl(instance));
81 if (!graphics_3d->InitRaw(share_context, attrib_list)) 81 if (!graphics_3d->InitRaw(share_context, attrib_list))
82 return 0; 82 return 0;
83 return graphics_3d->GetReference(); 83 return graphics_3d->GetReference();
84 } 84 }
85 85
86 PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() { 86 PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() {
87 return this; 87 return this;
88 } 88 }
89 89
90 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer(int32_t size) { 90 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer() {
91 return PP_FromBool(GetCommandBuffer()->Initialize(size)); 91 return PP_FromBool(GetCommandBuffer()->Initialize());
92 } 92 }
93 93
94 PP_Bool PPB_Graphics3D_Impl::GetRingBuffer(int* shm_handle, 94 PP_Bool PPB_Graphics3D_Impl::SetGetBuffer(int32_t shm_id) {
95 uint32_t* shm_size) { 95 GetCommandBuffer()->SetGetBuffer(shm_id);
96 gpu::Buffer buffer = GetCommandBuffer()->GetRingBuffer(); 96 return PP_TRUE;
97 return ShmToHandle(buffer.shared_memory, buffer.size, shm_handle, shm_size);
98 } 97 }
99 98
100 PP_Graphics3DTrustedState PPB_Graphics3D_Impl::GetState() { 99 PP_Graphics3DTrustedState PPB_Graphics3D_Impl::GetState() {
101 return PPStateFromGPUState(GetCommandBuffer()->GetState()); 100 return PPStateFromGPUState(GetCommandBuffer()->GetState());
102 } 101 }
103 102
104 int32_t PPB_Graphics3D_Impl::CreateTransferBuffer(uint32_t size) { 103 int32_t PPB_Graphics3D_Impl::CreateTransferBuffer(uint32_t size) {
105 return GetCommandBuffer()->CreateTransferBuffer(size, -1); 104 return GetCommandBuffer()->CreateTransferBuffer(size, -1);
106 } 105 }
107 106
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 169
171 return PP_OK_COMPLETIONPENDING; 170 return PP_OK_COMPLETIONPENDING;
172 } 171 }
173 172
174 bool PPB_Graphics3D_Impl::Init(PP_Resource share_context, 173 bool PPB_Graphics3D_Impl::Init(PP_Resource share_context,
175 const int32_t* attrib_list) { 174 const int32_t* attrib_list) {
176 if (!InitRaw(share_context, attrib_list)) 175 if (!InitRaw(share_context, attrib_list))
177 return false; 176 return false;
178 177
179 gpu::CommandBuffer* command_buffer = GetCommandBuffer(); 178 gpu::CommandBuffer* command_buffer = GetCommandBuffer();
180 if (!command_buffer->Initialize(kCommandBufferSize)) 179 if (!command_buffer->Initialize())
181 return false; 180 return false;
182 181
183 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize); 182 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize);
184 } 183 }
185 184
186 bool PPB_Graphics3D_Impl::InitRaw(PP_Resource share_context, 185 bool PPB_Graphics3D_Impl::InitRaw(PP_Resource share_context,
187 const int32_t* attrib_list) { 186 const int32_t* attrib_list) {
188 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); 187 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
189 if (!plugin_instance) 188 if (!plugin_instance)
190 return false; 189 return false;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 const PPP_Graphics3D* ppp_graphics_3d = 248 const PPP_Graphics3D* ppp_graphics_3d =
250 static_cast<const PPP_Graphics3D*>( 249 static_cast<const PPP_Graphics3D*>(
251 instance->module()->GetPluginInterface( 250 instance->module()->GetPluginInterface(
252 PPP_GRAPHICS_3D_INTERFACE)); 251 PPP_GRAPHICS_3D_INTERFACE));
253 if (ppp_graphics_3d) 252 if (ppp_graphics_3d)
254 ppp_graphics_3d->Graphics3DContextLost(pp_instance()); 253 ppp_graphics_3d->Graphics3DContextLost(pp_instance());
255 } 254 }
256 255
257 } // namespace ppapi 256 } // namespace ppapi
258 } // namespace webkit 257 } // namespace webkit
OLDNEW
« ppapi/proxy/ppb_context_3d_proxy.cc ('K') | « webkit/plugins/ppapi/ppb_graphics_3d_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698