| 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 "webkit/plugins/ppapi/var.h" | 5 #include "webkit/plugins/ppapi/var.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 const PPP_Class_Deprecated* ppp_class, | 593 const PPP_Class_Deprecated* ppp_class, |
| 594 void** ppp_class_data) { | 594 void** ppp_class_data) { |
| 595 scoped_refptr<ObjectVar> object(ObjectVar::FromPPVar(var)); | 595 scoped_refptr<ObjectVar> object(ObjectVar::FromPPVar(var)); |
| 596 if (!object) | 596 if (!object) |
| 597 return false; // Not an object at all. | 597 return false; // Not an object at all. |
| 598 | 598 |
| 599 return PluginObject::IsInstanceOf(object->np_object(), | 599 return PluginObject::IsInstanceOf(object->np_object(), |
| 600 ppp_class, ppp_class_data); | 600 ppp_class, ppp_class_data); |
| 601 } | 601 } |
| 602 | 602 |
| 603 PP_Var CreateObjectDeprecated(PP_Module module_id, | 603 PP_Var CreateObjectDeprecated(PP_Instance instance_id, |
| 604 const PPP_Class_Deprecated* ppp_class, | 604 const PPP_Class_Deprecated* ppp_class, |
| 605 void* ppp_class_data) { | 605 void* ppp_class_data) { |
| 606 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
| 607 if (!instance) { |
| 608 DLOG(ERROR) << "Create object passed an invalid instance."; |
| 609 return PP_MakeNull(); |
| 610 } |
| 611 return PluginObject::Create(instance->module(), ppp_class, ppp_class_data); |
| 612 } |
| 613 |
| 614 PP_Var CreateObjectWithModuleDeprecated(PP_Module module_id, |
| 615 const PPP_Class_Deprecated* ppp_class, |
| 616 void* ppp_class_data) { |
| 606 PluginModule* module = ResourceTracker::Get()->GetModule(module_id); | 617 PluginModule* module = ResourceTracker::Get()->GetModule(module_id); |
| 607 if (!module) | 618 if (!module) |
| 608 return PP_MakeNull(); | 619 return PP_MakeNull(); |
| 609 return PluginObject::Create(module, ppp_class, ppp_class_data); | 620 return PluginObject::Create(module, ppp_class, ppp_class_data); |
| 610 } | 621 } |
| 611 | 622 |
| 612 const PPB_Var_Deprecated var_deprecated_interface = { | 623 const PPB_Var_Deprecated var_deprecated_interface = { |
| 613 &Var::PluginAddRefPPVar, | 624 &Var::PluginAddRefPPVar, |
| 614 &Var::PluginReleasePPVar, | 625 &Var::PluginReleasePPVar, |
| 615 &VarFromUtf8, | 626 &VarFromUtf8, |
| 616 &VarToUtf8, | 627 &VarToUtf8, |
| 617 &HasPropertyDeprecated, | 628 &HasPropertyDeprecated, |
| 618 &HasMethodDeprecated, | 629 &HasMethodDeprecated, |
| 619 &GetProperty, | 630 &GetProperty, |
| 620 &EnumerateProperties, | 631 &EnumerateProperties, |
| 621 &SetPropertyDeprecated, | 632 &SetPropertyDeprecated, |
| 622 &DeletePropertyDeprecated, | 633 &DeletePropertyDeprecated, |
| 623 &CallDeprecated, | 634 &CallDeprecated, |
| 624 &Construct, | 635 &Construct, |
| 625 &IsInstanceOfDeprecated, | 636 &IsInstanceOfDeprecated, |
| 626 &CreateObjectDeprecated | 637 &CreateObjectDeprecated, |
| 638 &CreateObjectWithModuleDeprecated, |
| 627 }; | 639 }; |
| 628 | 640 |
| 629 const PPB_Var var_interface = { | 641 const PPB_Var var_interface = { |
| 630 &Var::PluginAddRefPPVar, | 642 &Var::PluginAddRefPPVar, |
| 631 &Var::PluginReleasePPVar, | 643 &Var::PluginReleasePPVar, |
| 632 &VarFromUtf8, | 644 &VarFromUtf8, |
| 633 &VarToUtf8, | 645 &VarToUtf8, |
| 634 &ConvertType, | 646 &ConvertType, |
| 635 &DefineProperty, | 647 &DefineProperty, |
| 636 &HasProperty, | 648 &HasProperty, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 } | 875 } |
| 864 | 876 |
| 865 // static | 877 // static |
| 866 void TryCatch::Catch(void* self, const char* message) { | 878 void TryCatch::Catch(void* self, const char* message) { |
| 867 static_cast<TryCatch*>(self)->SetException(message); | 879 static_cast<TryCatch*>(self)->SetException(message); |
| 868 } | 880 } |
| 869 | 881 |
| 870 } // namespace ppapi | 882 } // namespace ppapi |
| 871 } // namespace webkit | 883 } // namespace webkit |
| 872 | 884 |
| OLD | NEW |