| 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_graphics_3d_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_graphics_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 "webkit/plugins/ppapi/plugin_module.h" | 9 #include "webkit/plugins/ppapi/plugin_module.h" |
| 10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 DestroyGLES2Impl(); | 60 DestroyGLES2Impl(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // static | 63 // static |
| 64 PP_Resource PPB_Graphics3D_Impl::Create(PluginInstance* instance, | 64 PP_Resource PPB_Graphics3D_Impl::Create(PluginInstance* instance, |
| 65 PP_Config3D_Dev config, | 65 PP_Config3D_Dev config, |
| 66 PP_Resource share_context, | 66 PP_Resource share_context, |
| 67 const int32_t* attrib_list) { | 67 const int32_t* attrib_list) { |
| 68 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( | 68 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( |
| 69 new PPB_Graphics3D_Impl(instance)); | 69 new PPB_Graphics3D_Impl(instance)); |
| 70 | |
| 71 if (!graphics_3d->Init(config, share_context, attrib_list)) | 70 if (!graphics_3d->Init(config, share_context, attrib_list)) |
| 72 return 0; | 71 return 0; |
| 73 | |
| 74 return graphics_3d->GetReference(); | 72 return graphics_3d->GetReference(); |
| 75 } | 73 } |
| 76 | 74 |
| 77 PP_Resource PPB_Graphics3D_Impl::CreateRaw(PluginInstance* instance, | 75 PP_Resource PPB_Graphics3D_Impl::CreateRaw(PluginInstance* instance, |
| 78 PP_Config3D_Dev config, | 76 PP_Config3D_Dev config, |
| 79 PP_Resource share_context, | 77 PP_Resource share_context, |
| 80 const int32_t* attrib_list) { | 78 const int32_t* attrib_list) { |
| 81 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( | 79 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( |
| 82 new PPB_Graphics3D_Impl(instance)); | 80 new PPB_Graphics3D_Impl(instance)); |
| 83 | |
| 84 if (!graphics_3d->InitRaw(config, share_context, attrib_list)) | 81 if (!graphics_3d->InitRaw(config, share_context, attrib_list)) |
| 85 return 0; | 82 return 0; |
| 86 | |
| 87 return graphics_3d->GetReference(); | 83 return graphics_3d->GetReference(); |
| 88 } | 84 } |
| 89 | 85 |
| 90 PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() { | 86 PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() { |
| 91 return this; | 87 return this; |
| 92 } | 88 } |
| 93 | 89 |
| 94 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer(int32_t size) { | 90 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer(int32_t size) { |
| 95 return PP_FromBool(GetCommandBuffer()->Initialize(size)); | 91 return PP_FromBool(GetCommandBuffer()->Initialize(size)); |
| 96 } | 92 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 const PPP_Graphics3D_Dev* ppp_graphics_3d = | 239 const PPP_Graphics3D_Dev* ppp_graphics_3d = |
| 244 static_cast<const PPP_Graphics3D_Dev*>( | 240 static_cast<const PPP_Graphics3D_Dev*>( |
| 245 instance()->module()->GetPluginInterface( | 241 instance()->module()->GetPluginInterface( |
| 246 PPP_GRAPHICS_3D_DEV_INTERFACE)); | 242 PPP_GRAPHICS_3D_DEV_INTERFACE)); |
| 247 if (ppp_graphics_3d) | 243 if (ppp_graphics_3d) |
| 248 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); | 244 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); |
| 249 } | 245 } |
| 250 | 246 |
| 251 } // namespace ppapi | 247 } // namespace ppapi |
| 252 } // namespace webkit | 248 } // namespace webkit |
| OLD | NEW |