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

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

Issue 8919014: Revert "Revert 113479 - Revert "Revert 113250 - Add CommandBuffer::SetGetBuffer"" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « webkit/plugins/ppapi/ppb_graphics_3d_impl.h ('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 "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 "ppapi/c/ppp_graphics_3d.h" 10 #include "ppapi/c/ppp_graphics_3d.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 new PPB_Graphics3D_Impl(instance)); 81 new PPB_Graphics3D_Impl(instance));
82 if (!graphics_3d->InitRaw(share_context, attrib_list)) 82 if (!graphics_3d->InitRaw(share_context, attrib_list))
83 return 0; 83 return 0;
84 return graphics_3d->GetReference(); 84 return graphics_3d->GetReference();
85 } 85 }
86 86
87 PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() { 87 PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() {
88 return this; 88 return this;
89 } 89 }
90 90
91 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer(int32_t size) { 91 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer() {
92 return PP_FromBool(GetCommandBuffer()->Initialize(size)); 92 return PP_FromBool(GetCommandBuffer()->Initialize());
93 } 93 }
94 94
95 PP_Bool PPB_Graphics3D_Impl::GetRingBuffer(int* shm_handle, 95 PP_Bool PPB_Graphics3D_Impl::SetGetBuffer(int32_t transfer_buffer_id) {
96 uint32_t* shm_size) { 96 GetCommandBuffer()->SetGetBuffer(transfer_buffer_id);
97 gpu::Buffer buffer = GetCommandBuffer()->GetRingBuffer(); 97 return PP_TRUE;
98 return ShmToHandle(buffer.shared_memory, buffer.size, shm_handle, shm_size);
99 } 98 }
100 99
101 PP_Graphics3DTrustedState PPB_Graphics3D_Impl::GetState() { 100 PP_Graphics3DTrustedState PPB_Graphics3D_Impl::GetState() {
102 return PPStateFromGPUState(GetCommandBuffer()->GetState()); 101 return PPStateFromGPUState(GetCommandBuffer()->GetState());
103 } 102 }
104 103
105 int32_t PPB_Graphics3D_Impl::CreateTransferBuffer(uint32_t size) { 104 int32_t PPB_Graphics3D_Impl::CreateTransferBuffer(uint32_t size) {
106 return GetCommandBuffer()->CreateTransferBuffer(size, -1); 105 return GetCommandBuffer()->CreateTransferBuffer(size, -1);
107 } 106 }
108 107
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 184
186 return PP_OK_COMPLETIONPENDING; 185 return PP_OK_COMPLETIONPENDING;
187 } 186 }
188 187
189 bool PPB_Graphics3D_Impl::Init(PP_Resource share_context, 188 bool PPB_Graphics3D_Impl::Init(PP_Resource share_context,
190 const int32_t* attrib_list) { 189 const int32_t* attrib_list) {
191 if (!InitRaw(share_context, attrib_list)) 190 if (!InitRaw(share_context, attrib_list))
192 return false; 191 return false;
193 192
194 gpu::CommandBuffer* command_buffer = GetCommandBuffer(); 193 gpu::CommandBuffer* command_buffer = GetCommandBuffer();
195 if (!command_buffer->Initialize(kCommandBufferSize)) 194 if (!command_buffer->Initialize())
196 return false; 195 return false;
197 196
198 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize); 197 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize);
199 } 198 }
200 199
201 bool PPB_Graphics3D_Impl::InitRaw(PP_Resource share_context, 200 bool PPB_Graphics3D_Impl::InitRaw(PP_Resource share_context,
202 const int32_t* attrib_list) { 201 const int32_t* attrib_list) {
203 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); 202 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
204 if (!plugin_instance) 203 if (!plugin_instance)
205 return false; 204 return false;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 const PPP_Graphics3D* ppp_graphics_3d = 253 const PPP_Graphics3D* ppp_graphics_3d =
255 static_cast<const PPP_Graphics3D*>( 254 static_cast<const PPP_Graphics3D*>(
256 instance->module()->GetPluginInterface( 255 instance->module()->GetPluginInterface(
257 PPP_GRAPHICS_3D_INTERFACE)); 256 PPP_GRAPHICS_3D_INTERFACE));
258 if (ppp_graphics_3d) 257 if (ppp_graphics_3d)
259 ppp_graphics_3d->Graphics3DContextLost(pp_instance()); 258 ppp_graphics_3d->Graphics3DContextLost(pp_instance());
260 } 259 }
261 260
262 } // namespace ppapi 261 } // namespace ppapi
263 } // namespace webkit 262 } // namespace webkit
OLDNEW
« no previous file with comments | « 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