Chromium Code Reviews| Index: runtime/bin/extensions.cc |
| diff --git a/runtime/bin/extensions.cc b/runtime/bin/extensions.cc |
| index 7b7f33ba0ba8eb11abaf1e5e19e9be6958127093..dae47e88f2db8b4c9b1ce194e19158052c0cb739 100644 |
| --- a/runtime/bin/extensions.cc |
| +++ b/runtime/bin/extensions.cc |
| @@ -16,34 +16,15 @@ |
| namespace dart { |
| namespace bin { |
| -Dart_Handle Extensions::LoadExtension(const char* extension_path, |
| +Dart_Handle Extensions::LoadExtension(const char* extension_directory, |
| + const char* extension_file, |
| + const char* extension_name, |
| Dart_Handle parent_library) { |
|
Søren Gjesse
2014/03/04 13:09:02
extension_directory can be a http/https URI :-)
Bill Hesse
2014/03/04 14:36:31
Added back the check for http, added https.
Done.
|
| - if (strncmp(extension_path, "http://", 7) == 0) { |
| - return Dart_NewApiError("Cannot load native extensions over http:"); |
| - } |
| - |
| - char* library_path = strdup(extension_path); |
| - |
| - if (library_path == NULL) { |
| - return Dart_NewApiError("Out of memory in LoadExtension"); |
| - } |
| - |
| - // Extract the directory and the extension name from the path. |
| - char* last_path_separator = strrchr(library_path, '/'); |
| - if (last_path_separator == NULL) { |
| - last_path_separator = strrchr(library_path, '\\'); |
| - } |
| - if (last_path_separator == NULL) { |
| - free(library_path); |
| - return Dart_NewApiError("Cannot find extension library directory"); |
| - } |
| - char* extension_name = last_path_separator + 1; |
| - |
| - *last_path_separator = '\0'; // Terminate library_path at last separator. |
| - |
| - void* library_handle = LoadExtensionLibrary(library_path, extension_name); |
| + const char* library_strings[] = { extension_directory, extension_file, NULL }; |
| + char* library_file = Concatenate(library_strings); |
| + void* library_handle = LoadExtensionLibrary(library_file); |
| + free(library_file); |
| if (library_handle == NULL) { |
| - free(library_path); |
| return Dart_NewApiError("Cannot find extension library"); |
| } |
| @@ -53,7 +34,6 @@ Dart_Handle Extensions::LoadExtension(const char* extension_path, |
| InitFunctionType fn = reinterpret_cast<InitFunctionType>( |
| ResolveSymbol(library_handle, init_function_name)); |
| free(init_function_name); |
| - free(library_path); |
| if (fn == NULL) { |
| return Dart_NewApiError("Cannot find initialization function in extension"); |