diff options
author | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-24 01:06:23 +0000 |
---|---|---|
committer | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-24 01:06:23 +0000 |
commit | 561438abdac577d9a3663567425104c60a07a7bf (patch) | |
tree | fd8cbea6a003c3e8a87186e1005b27ff8b458fb7 | |
parent | 048e8a8379ac9c34bca6261e7564c3d6c0272585 (diff) | |
download | chromium_src-561438abdac577d9a3663567425104c60a07a7bf.zip chromium_src-561438abdac577d9a3663567425104c60a07a7bf.tar.gz chromium_src-561438abdac577d9a3663567425104c60a07a7bf.tar.bz2 |
Ensure swap is performed before informing compositor.
This can prevent a possible race condition. This can cause an issue for NaCl where the command buffer swap will occur even if the callback returns an error, but that just matches the normal pepper proxy's behavior, and shouldn't really cause any issues in practice.
BUG=99643
TEST=
Review URL: http://codereview.chromium.org/8678028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111465 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc | 3 | ||||
-rw-r--r-- | ppapi/proxy/ppb_graphics_3d_proxy.cc | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc index 8b71506..14e3f15 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc @@ -238,11 +238,11 @@ bool PluginGraphics3D::InitFromBrowserResource(PP_Resource res) { int32_t PluginGraphics3D::SwapBuffers(PP_Resource graphics3d_id, struct PP_CompletionCallback callback) { - int32_t callback_id = CompletionCallbackTable::Get()->AddCallback(callback); if (callback_id == 0) // Just like Chrome, for now disallow blocking calls. return PP_ERROR_BLOCKS_MAIN_THREAD; + impl()->SwapBuffers(); int32_t pp_error; NaClSrpcError retval = PpbGraphics3DRpcClient::PPB_Graphics3D_SwapBuffers( @@ -256,7 +256,6 @@ int32_t PluginGraphics3D::SwapBuffers(PP_Resource graphics3d_id, if ((PP_OK_COMPLETIONPENDING != pp_error) && (PP_OK != pp_error)) return pp_error; - impl()->SwapBuffers(); return PP_OK_COMPLETIONPENDING; } diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc index 0bb7440..2104cd8 100644 --- a/ppapi/proxy/ppb_graphics_3d_proxy.cc +++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc @@ -382,12 +382,12 @@ gpu::CommandBuffer* Graphics3D::GetCommandBuffer() { } int32 Graphics3D::DoSwapBuffers() { + gles2_impl()->SwapBuffers(); IPC::Message* msg = new PpapiHostMsg_PPBGraphics3D_SwapBuffers( API_ID_PPB_GRAPHICS_3D, host_resource()); msg->set_unblock(true); PluginDispatcher::GetForResource(this)->Send(msg); - gles2_impl()->SwapBuffers(); return PP_OK_COMPLETIONPENDING; } |