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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { | 59 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { |
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_Resource share_context, | 65 PP_Resource share_context, |
66 const int32_t* attrib_list) { | 66 const int32_t* attrib_list) { |
67 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( | 67 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( |
68 new PPB_Graphics3D_Impl(instance)); | 68 new PPB_Graphics3D_Impl(instance)); |
69 | |
70 if (!graphics_3d->Init(share_context, attrib_list)) | 69 if (!graphics_3d->Init(share_context, attrib_list)) |
71 return 0; | 70 return 0; |
72 | |
73 return graphics_3d->GetReference(); | 71 return graphics_3d->GetReference(); |
74 } | 72 } |
75 | 73 |
76 PP_Resource PPB_Graphics3D_Impl::CreateRaw(PluginInstance* instance, | 74 PP_Resource PPB_Graphics3D_Impl::CreateRaw(PluginInstance* instance, |
77 PP_Resource share_context, | 75 PP_Resource share_context, |
78 const int32_t* attrib_list) { | 76 const int32_t* attrib_list) { |
79 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( | 77 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( |
80 new PPB_Graphics3D_Impl(instance)); | 78 new PPB_Graphics3D_Impl(instance)); |
81 | |
82 if (!graphics_3d->InitRaw(share_context, attrib_list)) | 79 if (!graphics_3d->InitRaw(share_context, attrib_list)) |
83 return 0; | 80 return 0; |
84 | |
85 return graphics_3d->GetReference(); | 81 return graphics_3d->GetReference(); |
86 } | 82 } |
87 | 83 |
88 PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() { | 84 PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() { |
89 return this; | 85 return this; |
90 } | 86 } |
91 | 87 |
92 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer(int32_t size) { | 88 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer(int32_t size) { |
93 return PP_FromBool(GetCommandBuffer()->Initialize(size)); | 89 return PP_FromBool(GetCommandBuffer()->Initialize(size)); |
94 } | 90 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 const PPP_Graphics3D_Dev* ppp_graphics_3d = | 235 const PPP_Graphics3D_Dev* ppp_graphics_3d = |
240 static_cast<const PPP_Graphics3D_Dev*>( | 236 static_cast<const PPP_Graphics3D_Dev*>( |
241 instance()->module()->GetPluginInterface( | 237 instance()->module()->GetPluginInterface( |
242 PPP_GRAPHICS_3D_DEV_INTERFACE)); | 238 PPP_GRAPHICS_3D_DEV_INTERFACE)); |
243 if (ppp_graphics_3d) | 239 if (ppp_graphics_3d) |
244 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); | 240 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); |
245 } | 241 } |
246 | 242 |
247 } // namespace ppapi | 243 } // namespace ppapi |
248 } // namespace webkit | 244 } // namespace webkit |
OLD | NEW |