| 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 // Copy of the stub test from ppapi/examples/stub/stub.c | 5 // Copy of the stub test from ppapi/examples/stub/stub.c |
| 6 // This is the simplest possible C Pepper plugin that does nothing. If you're | 6 // This is the simplest possible C Pepper plugin that does nothing. If you're |
| 7 // using C++, you will want to look at stub.cc which uses the more convenient | 7 // using C++, you will want to look at stub.cc which uses the more convenient |
| 8 // C++ wrappers. | 8 // C++ wrappers. |
| 9 | 9 |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 NULL, | 651 NULL, |
| 652 NULL, | 652 NULL, |
| 653 }; | 653 }; |
| 654 | 654 |
| 655 // PPP_Instance functions. | 655 // PPP_Instance functions. |
| 656 | 656 |
| 657 PP_Bool DidCreate(PP_Instance instance, | 657 PP_Bool DidCreate(PP_Instance instance, |
| 658 uint32_t argc, | 658 uint32_t argc, |
| 659 const char* argn[], | 659 const char* argn[], |
| 660 const char* argv[]) { | 660 const char* argv[]) { |
| 661 printf("basic_object: DidCreate(%"NACL_PRIu64")\n", instance); | 661 printf("basic_object: DidCreate(%"NACL_PRIu32")\n", instance); |
| 662 for (uint32_t i = 0; i < argc; ++i) { | 662 for (uint32_t i = 0; i < argc; ++i) { |
| 663 printf(" arg[%"NACL_PRIu32"]: '%s' = '%s'\n", i, argn[i], argv[i]); | 663 printf(" arg[%"NACL_PRIu32"]: '%s' = '%s'\n", i, argn[i], argv[i]); |
| 664 } | 664 } |
| 665 return PP_TRUE; | 665 return PP_TRUE; |
| 666 } | 666 } |
| 667 | 667 |
| 668 void DidDestroy(PP_Instance instance) { | 668 void DidDestroy(PP_Instance instance) { |
| 669 printf("basic_object: DidDestroy(%"NACL_PRIu64")\n", instance); | 669 printf("basic_object: DidDestroy(%"NACL_PRIu32")\n", instance); |
| 670 } | 670 } |
| 671 | 671 |
| 672 PP_Var GetInstanceObject(PP_Instance instance) { | 672 PP_Var GetInstanceObject(PP_Instance instance) { |
| 673 printf("basic_object: GetInstanceObject(%"NACL_PRIu64")\n", instance); | 673 printf("basic_object: GetInstanceObject(%"NACL_PRIu32")\n", instance); |
| 674 printf(" g_var_interface = %p\n", | 674 printf(" g_var_interface = %p\n", |
| 675 reinterpret_cast<const void*>(g_var_interface)); | 675 reinterpret_cast<const void*>(g_var_interface)); |
| 676 PP_Var retval = | 676 PP_Var retval = |
| 677 g_var_interface->CreateObject(g_module_id, | 677 g_var_interface->CreateObject(g_module_id, |
| 678 &object_class, | 678 &object_class, |
| 679 static_cast<void*>(new TestObject)); | 679 static_cast<void*>(new TestObject)); |
| 680 return retval; | 680 return retval; |
| 681 } | 681 } |
| 682 | 682 |
| 683 static const void* GetInstanceInterface() { | 683 static const void* GetInstanceInterface() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 694 return reinterpret_cast<const void*>(&instance_class); | 694 return reinterpret_cast<const void*>(&instance_class); |
| 695 } | 695 } |
| 696 | 696 |
| 697 } // namespace | 697 } // namespace |
| 698 | 698 |
| 699 PP_EXPORT int32_t PPP_InitializeModule(PP_Module module_id, | 699 PP_EXPORT int32_t PPP_InitializeModule(PP_Module module_id, |
| 700 PPB_GetInterface get_browser_interface) { | 700 PPB_GetInterface get_browser_interface) { |
| 701 // Save the global module information for later. | 701 // Save the global module information for later. |
| 702 g_module_id = module_id; | 702 g_module_id = module_id; |
| 703 g_get_browser_interface = get_browser_interface; | 703 g_get_browser_interface = get_browser_interface; |
| 704 printf("basic_object: PPP_InitializeModule(%"NACL_PRId64", %p)\n", | 704 printf("basic_object: PPP_InitializeModule(%"NACL_PRId32", %p)\n", |
| 705 module_id, | 705 module_id, |
| 706 get_browser_interface); | 706 get_browser_interface); |
| 707 | 707 |
| 708 g_var_interface = | 708 g_var_interface = |
| 709 reinterpret_cast<const PPB_Var_Deprecated*>( | 709 reinterpret_cast<const PPB_Var_Deprecated*>( |
| 710 get_browser_interface(PPB_VAR_DEPRECATED_INTERFACE)); | 710 get_browser_interface(PPB_VAR_DEPRECATED_INTERFACE)); |
| 711 | 711 |
| 712 return PP_OK; | 712 return PP_OK; |
| 713 } | 713 } |
| 714 | 714 |
| 715 PP_EXPORT void PPP_ShutdownModule() { | 715 PP_EXPORT void PPP_ShutdownModule() { |
| 716 printf("basic_object: PPP_ShutdownModule()\n"); | 716 printf("basic_object: PPP_ShutdownModule()\n"); |
| 717 } | 717 } |
| 718 | 718 |
| 719 PP_EXPORT const void* PPP_GetInterface(const char* interface_name) { | 719 PP_EXPORT const void* PPP_GetInterface(const char* interface_name) { |
| 720 printf("basic_object: PPP_GetInterface('%s')\n", interface_name); | 720 printf("basic_object: PPP_GetInterface('%s')\n", interface_name); |
| 721 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) { | 721 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) { |
| 722 return GetInstanceInterface(); | 722 return GetInstanceInterface(); |
| 723 } | 723 } |
| 724 return NULL; | 724 return NULL; |
| 725 } | 725 } |
| OLD | NEW |