| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 10 #include "ppapi/c/ppp_graphics_3d.h" | 10 #include "ppapi/c/ppp_graphics_3d.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 s.put_offset, | 46 s.put_offset, |
| 47 s.token, | 47 s.token, |
| 48 static_cast<PPB_Graphics3DTrustedError>(s.error), | 48 static_cast<PPB_Graphics3DTrustedError>(s.error), |
| 49 s.generation | 49 s.generation |
| 50 }; | 50 }; |
| 51 return state; | 51 return state; |
| 52 } | 52 } |
| 53 } // namespace. | 53 } // namespace. |
| 54 | 54 |
| 55 PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance) | 55 PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance) |
| 56 : Resource(instance), | 56 : PPB_Graphics3D_Shared(instance), |
| 57 bound_to_instance_(false), | 57 bound_to_instance_(false), |
| 58 commit_pending_(false), | 58 commit_pending_(false), |
| 59 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 59 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 60 } | 60 } |
| 61 | 61 |
| 62 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { | 62 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { |
| 63 DestroyGLES2Impl(); | 63 DestroyGLES2Impl(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // static | 66 // static |
| (...skipping 10 matching lines...) Expand all Loading... |
| 77 PP_Resource PPB_Graphics3D_Impl::CreateRaw(PP_Instance instance, | 77 PP_Resource PPB_Graphics3D_Impl::CreateRaw(PP_Instance instance, |
| 78 PP_Resource share_context, | 78 PP_Resource share_context, |
| 79 const int32_t* attrib_list) { | 79 const int32_t* attrib_list) { |
| 80 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( | 80 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( |
| 81 new PPB_Graphics3D_Impl(instance)); | 81 new PPB_Graphics3D_Impl(instance)); |
| 82 if (!graphics_3d->InitRaw(share_context, attrib_list)) | 82 if (!graphics_3d->InitRaw(share_context, attrib_list)) |
| 83 return 0; | 83 return 0; |
| 84 return graphics_3d->GetReference(); | 84 return graphics_3d->GetReference(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() { | |
| 88 return this; | |
| 89 } | |
| 90 | |
| 91 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer() { | 87 PP_Bool PPB_Graphics3D_Impl::InitCommandBuffer() { |
| 92 return PP_FromBool(GetCommandBuffer()->Initialize()); | 88 return PP_FromBool(GetCommandBuffer()->Initialize()); |
| 93 } | 89 } |
| 94 | 90 |
| 95 PP_Bool PPB_Graphics3D_Impl::SetGetBuffer(int32_t transfer_buffer_id) { | 91 PP_Bool PPB_Graphics3D_Impl::SetGetBuffer(int32_t transfer_buffer_id) { |
| 96 GetCommandBuffer()->SetGetBuffer(transfer_buffer_id); | 92 GetCommandBuffer()->SetGetBuffer(transfer_buffer_id); |
| 97 return PP_TRUE; | 93 return PP_TRUE; |
| 98 } | 94 } |
| 99 | 95 |
| 100 PP_Graphics3DTrustedState PPB_Graphics3D_Impl::GetState() { | 96 PP_Graphics3DTrustedState PPB_Graphics3D_Impl::GetState() { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 const PPP_Graphics3D* ppp_graphics_3d = | 249 const PPP_Graphics3D* ppp_graphics_3d = |
| 254 static_cast<const PPP_Graphics3D*>( | 250 static_cast<const PPP_Graphics3D*>( |
| 255 instance->module()->GetPluginInterface( | 251 instance->module()->GetPluginInterface( |
| 256 PPP_GRAPHICS_3D_INTERFACE)); | 252 PPP_GRAPHICS_3D_INTERFACE)); |
| 257 if (ppp_graphics_3d) | 253 if (ppp_graphics_3d) |
| 258 ppp_graphics_3d->Graphics3DContextLost(pp_instance()); | 254 ppp_graphics_3d->Graphics3DContextLost(pp_instance()); |
| 259 } | 255 } |
| 260 | 256 |
| 261 } // namespace ppapi | 257 } // namespace ppapi |
| 262 } // namespace webkit | 258 } // namespace webkit |
| OLD | NEW |