| 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 "webkit/plugins/ppapi/ppb_surface_3d_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "gpu/command_buffer/client/gles2_implementation.h" | 8 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 9 #include "gpu/command_buffer/common/command_buffer.h" | 9 #include "gpu/command_buffer/common/command_buffer.h" |
| 10 #include "ppapi/c/dev/ppb_graphics_3d_dev.h" | 10 #include "ppapi/c/dev/ppb_graphics_3d_dev.h" |
| 11 #include "ppapi/c/dev/ppp_graphics_3d_dev.h" | 11 #include "ppapi/c/dev/ppp_graphics_3d_dev.h" |
| 12 #include "ppapi/thunk/common.h" |
| 12 #include "webkit/plugins/ppapi/common.h" | 13 #include "webkit/plugins/ppapi/common.h" |
| 13 #include "webkit/plugins/ppapi/plugin_module.h" | 14 #include "webkit/plugins/ppapi/plugin_module.h" |
| 14 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 15 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 15 #include "webkit/plugins/ppapi/ppb_context_3d_impl.h" | 16 #include "webkit/plugins/ppapi/ppb_context_3d_impl.h" |
| 16 | 17 |
| 18 using ppapi::thunk::MayForceCallback; |
| 19 |
| 17 namespace webkit { | 20 namespace webkit { |
| 18 namespace ppapi { | 21 namespace ppapi { |
| 19 | 22 |
| 20 namespace { | 23 namespace { |
| 21 | 24 |
| 22 PP_Resource Create(PP_Instance instance_id, | 25 PP_Resource Create(PP_Instance instance_id, |
| 23 PP_Config3D_Dev config, | 26 PP_Config3D_Dev config, |
| 24 const int32_t* attrib_list) { | 27 const int32_t* attrib_list) { |
| 25 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 28 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
| 26 if (!instance) | 29 if (!instance) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 49 int32_t attribute, | 52 int32_t attribute, |
| 50 int32_t* value) { | 53 int32_t* value) { |
| 51 // TODO(alokp): Implement me. | 54 // TODO(alokp): Implement me. |
| 52 return 0; | 55 return 0; |
| 53 } | 56 } |
| 54 | 57 |
| 55 int32_t SwapBuffers(PP_Resource surface_id, | 58 int32_t SwapBuffers(PP_Resource surface_id, |
| 56 PP_CompletionCallback callback) { | 59 PP_CompletionCallback callback) { |
| 57 scoped_refptr<PPB_Surface3D_Impl> surface( | 60 scoped_refptr<PPB_Surface3D_Impl> surface( |
| 58 Resource::GetAs<PPB_Surface3D_Impl>(surface_id)); | 61 Resource::GetAs<PPB_Surface3D_Impl>(surface_id)); |
| 59 return surface->SwapBuffers(callback); | 62 return MayForceCallback(callback, surface->SwapBuffers(callback)); |
| 60 } | 63 } |
| 61 | 64 |
| 62 const PPB_Surface3D_Dev ppb_surface3d = { | 65 const PPB_Surface3D_Dev ppb_surface3d = { |
| 63 &Create, | 66 &Create, |
| 64 &IsSurface3D, | 67 &IsSurface3D, |
| 65 &SetAttrib, | 68 &SetAttrib, |
| 66 &GetAttrib, | 69 &GetAttrib, |
| 67 &SwapBuffers | 70 &SwapBuffers |
| 68 }; | 71 }; |
| 69 | 72 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 const PPP_Graphics3D_Dev* ppp_graphics_3d = | 199 const PPP_Graphics3D_Dev* ppp_graphics_3d = |
| 197 static_cast<const PPP_Graphics3D_Dev*>( | 200 static_cast<const PPP_Graphics3D_Dev*>( |
| 198 instance()->module()->GetPluginInterface( | 201 instance()->module()->GetPluginInterface( |
| 199 PPP_GRAPHICS_3D_DEV_INTERFACE)); | 202 PPP_GRAPHICS_3D_DEV_INTERFACE)); |
| 200 if (ppp_graphics_3d) | 203 if (ppp_graphics_3d) |
| 201 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); | 204 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); |
| 202 } | 205 } |
| 203 | 206 |
| 204 } // namespace ppapi | 207 } // namespace ppapi |
| 205 } // namespace webkit | 208 } // namespace webkit |
| OLD | NEW |