OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/examples/pepper_container_app/plugin_module.h" | 5 #include "mojo/examples/pepper_container_app/plugin_module.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
63 static const wchar_t plugin_name[] = L"ppapi_example_gles2_spinning_cube.dll"; | 63 static const wchar_t plugin_name[] = L"ppapi_example_gles2_spinning_cube.dll"; |
64 #elif defined(OS_MACOSX) | 64 #elif defined(OS_MACOSX) |
65 static const char plugin_name[] = "ppapi_example_gles2_spinning_cube.plugin"; | 65 static const char plugin_name[] = "ppapi_example_gles2_spinning_cube.plugin"; |
66 #elif defined(OS_POSIX) | 66 #elif defined(OS_POSIX) |
67 static const char plugin_name[] = "libppapi_example_gles2_spinning_cube.so"; | 67 static const char plugin_name[] = "libppapi_example_gles2_spinning_cube.so"; |
68 #endif | 68 #endif |
69 | 69 |
70 base::FilePath plugin_path(plugin_name); | 70 base::FilePath plugin_path(plugin_name); |
71 | 71 |
72 std::string error; | 72 base::NativeLibraryLoadError error; |
73 plugin_module_.Reset( | 73 plugin_module_.Reset(base::LoadNativeLibrary(plugin_path, &error)); |
74 base::LoadNativeLibrary(plugin_path, &error)); | |
75 | 74 |
76 if (!plugin_module_.is_valid()) { | 75 if (!plugin_module_.is_valid()) { |
77 LOG(WARNING) << "Cannot load " << plugin_path.AsUTF8Unsafe() | 76 LOG(WARNING) << "Cannot load " << plugin_path.AsUTF8Unsafe() |
78 << ". Error: " << error; | 77 << ". Error: " << error.ToString(); |
79 return; | 78 return; |
80 } | 79 } |
81 | 80 |
82 entry_points_.get_interface = | 81 entry_points_.get_interface = |
83 reinterpret_cast<PP_GetInterface_Func>( | 82 reinterpret_cast<PP_GetInterface_Func>( |
84 plugin_module_.GetFunctionPointer("PPP_GetInterface")); | 83 plugin_module_.GetFunctionPointer("PPP_GetInterface")); |
85 if (!entry_points_.get_interface) { | 84 if (!entry_points_.get_interface) { |
86 LOG(WARNING) << "No PPP_GetInterface in plugin library"; | 85 LOG(WARNING) << "No PPP_GetInterface in plugin library"; |
87 return; | 86 return; |
88 } | 87 } |
(...skipping 13 matching lines...) Expand all Loading... |
102 plugin_module_.GetFunctionPointer("PPP_ShutdownModule")); | 101 plugin_module_.GetFunctionPointer("PPP_ShutdownModule")); |
103 | 102 |
104 int32_t result = entry_points_.initialize_module(pp_module(), | 103 int32_t result = entry_points_.initialize_module(pp_module(), |
105 &GetInterface); | 104 &GetInterface); |
106 if (result != PP_OK) | 105 if (result != PP_OK) |
107 LOG(WARNING) << "Initializing module failed with error " << result; | 106 LOG(WARNING) << "Initializing module failed with error " << result; |
108 } | 107 } |
109 | 108 |
110 } // namespace examples | 109 } // namespace examples |
111 } // namespace mojo | 110 } // namespace mojo |
OLD | NEW |