OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h" | 7 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h" |
8 | 8 |
9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
10 #include "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h" | 10 #include "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 transfer_buffer_id, | 231 transfer_buffer_id, |
232 false)); | 232 false)); |
233 return true; | 233 return true; |
234 } | 234 } |
235 } | 235 } |
236 return false; | 236 return false; |
237 } | 237 } |
238 | 238 |
239 int32_t PluginGraphics3D::SwapBuffers(PP_Resource graphics3d_id, | 239 int32_t PluginGraphics3D::SwapBuffers(PP_Resource graphics3d_id, |
240 struct PP_CompletionCallback callback) { | 240 struct PP_CompletionCallback callback) { |
241 | |
242 int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback); | 241 int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback); |
243 if (callback_id == 0) // Just like Chrome, for now disallow blocking calls. | 242 if (callback_id == 0) // Just like Chrome, for now disallow blocking calls. |
244 return PP_ERROR_BLOCKS_MAIN_THREAD; | 243 return PP_ERROR_BLOCKS_MAIN_THREAD; |
245 | 244 |
245 impl()->SwapBuffers(); | |
nfullagar
2011/11/23 22:51:18
what's going to happen if the NaClSrpcError retval
| |
246 int32_t pp_error; | 246 int32_t pp_error; |
247 NaClSrpcError retval = | 247 NaClSrpcError retval = |
248 PpbGraphics3DRpcClient::PPB_Graphics3D_SwapBuffers( | 248 PpbGraphics3DRpcClient::PPB_Graphics3D_SwapBuffers( |
249 GetMainSrpcChannel(), | 249 GetMainSrpcChannel(), |
250 graphics3d_id, | 250 graphics3d_id, |
251 callback_id, | 251 callback_id, |
252 &pp_error); | 252 &pp_error); |
253 if (retval != NACL_SRPC_RESULT_OK) | 253 if (retval != NACL_SRPC_RESULT_OK) |
254 return PP_ERROR_FAILED; | 254 return PP_ERROR_FAILED; |
255 | 255 |
256 if ((PP_OK_COMPLETIONPENDING != pp_error) && (PP_OK != pp_error)) | 256 if ((PP_OK_COMPLETIONPENDING != pp_error) && (PP_OK != pp_error)) |
257 return pp_error; | 257 return pp_error; |
258 | 258 |
259 impl()->SwapBuffers(); | |
260 return PP_OK_COMPLETIONPENDING; | 259 return PP_OK_COMPLETIONPENDING; |
261 } | 260 } |
262 | 261 |
263 | 262 |
264 // static | 263 // static |
265 const PPB_Graphics3D* PluginGraphics3D::GetInterface() { | 264 const PPB_Graphics3D* PluginGraphics3D::GetInterface() { |
266 static const PPB_Graphics3D intf = { | 265 static const PPB_Graphics3D intf = { |
267 &GetAttribMaxValue, | 266 &GetAttribMaxValue, |
268 &Create, | 267 &Create, |
269 &IsGraphics3D, | 268 &IsGraphics3D, |
270 &GetAttribs, | 269 &GetAttribs, |
271 &SetAttribs, | 270 &SetAttribs, |
272 &GetError, | 271 &GetError, |
273 &ResizeBuffers, | 272 &ResizeBuffers, |
274 &SwapBuffs, | 273 &SwapBuffs, |
275 }; | 274 }; |
276 return &intf; | 275 return &intf; |
277 } | 276 } |
278 | 277 |
279 } // namespace ppapi_proxy | 278 } // namespace ppapi_proxy |
280 | 279 |
OLD | NEW |