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

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

Issue 10386145: Add the necessary plumbing mechanisms to ensure proper WebGL support inside the <browser> tag, whic… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 attr[0] != PP_GRAPHICS3DATTRIB_NONE; 163 attr[0] != PP_GRAPHICS3DATTRIB_NONE;
164 attr += 2) { 164 attr += 2) {
165 attribs.push_back(attr[0]); 165 attribs.push_back(attr[0]);
166 attribs.push_back(attr[1]); 166 attribs.push_back(attr[1]);
167 } 167 }
168 } 168 }
169 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); 169 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE);
170 170
171 HostResource result; 171 HostResource result;
172 dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create( 172 dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create(
173 API_ID_PPB_GRAPHICS_3D, instance, attribs, &result)); 173 API_ID_PPB_GRAPHICS_3D,
174 instance,
175 ppapi::HostResource(),
piman 2012/05/15 20:59:17 I don't understand, don't you want to pass the sha
(scshunt) 2012/05/16 16:39:43 I haven't touched this method. Possibly yes; this
Fady Samuel 2012/05/16 16:43:50 Yup, this was some stuff I changed when I started
piman 2012/05/16 17:12:00 Note: it's not trivially creating a HostResource(i
176 attribs,
177 &result));
174 if (result.is_null()) 178 if (result.is_null())
175 return 0; 179 return 0;
176 180
177 scoped_refptr<Graphics3D> graphics_3d(new Graphics3D(result)); 181 scoped_refptr<Graphics3D> graphics_3d(new Graphics3D(result));
178 if (!graphics_3d->Init()) 182 if (!graphics_3d->Init())
179 return 0; 183 return 0;
180 return graphics_3d->GetReference(); 184 return graphics_3d->GetReference();
181 } 185 }
182 186
183 bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { 187 bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
(...skipping 23 matching lines...) Expand all
207 IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK, 211 IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK,
208 OnMsgSwapBuffersACK) 212 OnMsgSwapBuffersACK)
209 IPC_MESSAGE_UNHANDLED(handled = false) 213 IPC_MESSAGE_UNHANDLED(handled = false)
210 214
211 IPC_END_MESSAGE_MAP() 215 IPC_END_MESSAGE_MAP()
212 // FIXME(brettw) handle bad messages! 216 // FIXME(brettw) handle bad messages!
213 return handled; 217 return handled;
214 } 218 }
215 219
216 void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance, 220 void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance,
221 HostResource shared_context,
217 const std::vector<int32_t>& attribs, 222 const std::vector<int32_t>& attribs,
218 HostResource* result) { 223 HostResource* result) {
219 if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE) 224 if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE)
220 return; // Bad message. 225 return; // Bad message.
221 226
222 thunk::EnterResourceCreation enter(instance); 227 thunk::EnterResourceCreation enter(instance);
223 if (enter.succeeded()) { 228 if (enter.succeeded()) {
229 PP_Resource context = shared_context.host_resource();
224 result->SetHostResource( 230 result->SetHostResource(
225 instance, 231 instance,
226 enter.functions()->CreateGraphics3DRaw(instance, 0, &attribs.front())); 232 enter.functions()->CreateGraphics3DRaw(instance, context,
233 &attribs.front()));
227 } 234 }
228 } 235 }
229 236
230 void PPB_Graphics3D_Proxy::OnMsgInitCommandBuffer( 237 void PPB_Graphics3D_Proxy::OnMsgInitCommandBuffer(
231 const HostResource& context) { 238 const HostResource& context) {
232 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); 239 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
233 if (enter.failed()) 240 if (enter.failed())
234 return; 241 return;
235 242
236 if (!enter.object()->InitCommandBuffer()) 243 if (!enter.object()->InitCommandBuffer())
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( 335 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin(
329 int32_t result, 336 int32_t result,
330 const HostResource& context) { 337 const HostResource& context) {
331 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( 338 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK(
332 API_ID_PPB_GRAPHICS_3D, context, result)); 339 API_ID_PPB_GRAPHICS_3D, context, result));
333 } 340 }
334 341
335 } // namespace proxy 342 } // namespace proxy
336 } // namespace ppapi 343 } // namespace ppapi
337 344
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698