| OLD | NEW |
| 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 "ppapi/proxy/ppb_surface_3d_proxy.h" | 5 #include "ppapi/proxy/ppb_surface_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/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
| 10 #include "ppapi/c/dev/ppb_surface_3d_dev.h" | 10 #include "ppapi/c/dev/ppb_surface_3d_dev.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true); | 171 EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true); |
| 172 if (enter.succeeded()) { | 172 if (enter.succeeded()) { |
| 173 result->SetHostResource( | 173 result->SetHostResource( |
| 174 instance, | 174 instance, |
| 175 enter.functions()->CreateSurface3D(instance, config, &attribs.front())); | 175 enter.functions()->CreateSurface3D(instance, config, &attribs.front())); |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 void PPB_Surface3D_Proxy::OnMsgSwapBuffers(const HostResource& surface_3d) { | 179 void PPB_Surface3D_Proxy::OnMsgSwapBuffers(const HostResource& surface_3d) { |
| 180 CompletionCallback callback = callback_factory_.NewCallback( | 180 CompletionCallback callback = callback_factory_.NewOptionalCallback( |
| 181 &PPB_Surface3D_Proxy::SendSwapBuffersACKToPlugin, surface_3d); | 181 &PPB_Surface3D_Proxy::SendSwapBuffersACKToPlugin, surface_3d); |
| 182 | 182 |
| 183 EnterHostFromHostResource<PPB_Surface3D_API> enter(surface_3d); | 183 EnterHostFromHostResource<PPB_Surface3D_API> enter(surface_3d); |
| 184 int32_t result = PP_ERROR_BADRESOURCE; | 184 int32_t result = PP_ERROR_BADRESOURCE; |
| 185 if (enter.succeeded()) | 185 if (enter.succeeded()) |
| 186 result = enter.object()->SwapBuffers(callback.pp_completion_callback()); | 186 result = enter.object()->SwapBuffers(callback.pp_completion_callback()); |
| 187 if (result != PP_OK_COMPLETIONPENDING) { | 187 if (result != PP_OK_COMPLETIONPENDING) { |
| 188 // There was some error, so we won't get a flush callback. We need to now | 188 // There was some error, so we won't get a flush callback. We need to now |
| 189 // issue the ACK to the plugin hears about the error. This will also clean | 189 // issue the ACK to the plugin hears about the error. This will also clean |
| 190 // up the data associated with the callback. | 190 // up the data associated with the callback. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 201 | 201 |
| 202 void PPB_Surface3D_Proxy::SendSwapBuffersACKToPlugin( | 202 void PPB_Surface3D_Proxy::SendSwapBuffersACKToPlugin( |
| 203 int32_t result, | 203 int32_t result, |
| 204 const HostResource& surface_3d) { | 204 const HostResource& surface_3d) { |
| 205 dispatcher()->Send(new PpapiMsg_PPBSurface3D_SwapBuffersACK( | 205 dispatcher()->Send(new PpapiMsg_PPBSurface3D_SwapBuffersACK( |
| 206 INTERFACE_ID_PPB_SURFACE_3D, surface_3d, result)); | 206 INTERFACE_ID_PPB_SURFACE_3D, surface_3d, result)); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace proxy | 209 } // namespace proxy |
| 210 } // namespace pp | 210 } // namespace pp |
| OLD | NEW |