| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cpp/dev/graphics_3d_client_dev.h" | 5 #include "ppapi/cpp/graphics_3d_client.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppp_graphics_3d_dev.h" | 7 #include "ppapi/c/ppp_graphics_3d.h" |
| 8 #include "ppapi/cpp/instance.h" | 8 #include "ppapi/cpp/instance.h" |
| 9 #include "ppapi/cpp/module.h" | 9 #include "ppapi/cpp/module.h" |
| 10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
| 11 | 11 |
| 12 namespace pp { | 12 namespace pp { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 const char kPPPGraphics3DInterface[] = PPP_GRAPHICS_3D_DEV_INTERFACE; | 16 const char kPPPGraphics3DInterface[] = PPP_GRAPHICS_3D_INTERFACE; |
| 17 | 17 |
| 18 void Graphics3D_ContextLost(PP_Instance instance) { | 18 void Graphics3D_ContextLost(PP_Instance instance) { |
| 19 void* object = | 19 void* object = |
| 20 pp::Instance::GetPerInstanceObject(instance, kPPPGraphics3DInterface); | 20 pp::Instance::GetPerInstanceObject(instance, kPPPGraphics3DInterface); |
| 21 if (!object) | 21 if (!object) |
| 22 return; | 22 return; |
| 23 return static_cast<Graphics3DClient_Dev*>(object)->Graphics3DContextLost(); | 23 return static_cast<Graphics3DClient*>(object)->Graphics3DContextLost(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 static PPP_Graphics3D_Dev graphics3d_interface = { | 26 static PPP_Graphics3D graphics3d_interface = { |
| 27 &Graphics3D_ContextLost, | 27 &Graphics3D_ContextLost, |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 Graphics3DClient_Dev::Graphics3DClient_Dev(Instance* instance) | 32 Graphics3DClient::Graphics3DClient(Instance* instance) |
| 33 : associated_instance_(instance) { | 33 : associated_instance_(instance) { |
| 34 pp::Module::Get()->AddPluginInterface(kPPPGraphics3DInterface, | 34 pp::Module::Get()->AddPluginInterface(kPPPGraphics3DInterface, |
| 35 &graphics3d_interface); | 35 &graphics3d_interface); |
| 36 associated_instance_->AddPerInstanceObject(kPPPGraphics3DInterface, this); | 36 associated_instance_->AddPerInstanceObject(kPPPGraphics3DInterface, this); |
| 37 } | 37 } |
| 38 | 38 |
| 39 Graphics3DClient_Dev::~Graphics3DClient_Dev() { | 39 Graphics3DClient::~Graphics3DClient() { |
| 40 associated_instance_->RemovePerInstanceObject(kPPPGraphics3DInterface, this); | 40 associated_instance_->RemovePerInstanceObject(kPPPGraphics3DInterface, this); |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace pp | 43 } // namespace pp |
| OLD | NEW |