Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: platform_tools/android/launcher/skia_launcher.cpp

Issue 15855006: prepare skia for shared library build on android (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: platform_tools/android/launcher/skia_launcher.cpp
diff --git a/platform_tools/android/launcher/skia_launcher.cpp b/platform_tools/android/launcher/skia_launcher.cpp
index 972382dc16f325188ce3717e4e44e794056ffb1e..df2c25437f7199d0ebf5d23a2f7cff1380fa9023 100644
--- a/platform_tools/android/launcher/skia_launcher.cpp
+++ b/platform_tools/android/launcher/skia_launcher.cpp
@@ -28,6 +28,29 @@ int launch_app(int (*app_main)(int, const char**), int argc,
return (*app_main)(argc, argv);
}
+void* load_library(const char** argv, const char* libraryName)
+{
+ // attempt to lookup the location of the shared libraries
+ char libraryLocation[100];
+ sprintf(libraryLocation, "%s/lib/lib%s.so", argv[0], libraryName);
+ if (!file_exists(libraryLocation)) {
+ printf("ERROR: Unable to find the appropriate library in the Skia App.\n");
+ printf("ERROR: Did you provide the correct program_name?\n");
+ usage(argv[0]);
+ return NULL;
+ }
+
+ // load the appropriate library
+ void* appLibrary = dlopen(libraryLocation, RTLD_LOCAL | RTLD_LAZY);
+ if (!appLibrary) {
+ printf("ERROR: Unable to open the shared library.\n");
+ printf("ERROR: %s", dlerror());
+ return NULL;
+ }
+
+ return appLibrary;
+}
+
int main(int argc, const char** argv) {
// check that the program name was specified
@@ -44,21 +67,16 @@ int main(int argc, const char** argv) {
return -1;
}
- // attempt to lookup the location of the shared libraries
- char libraryLocation[100];
- sprintf(libraryLocation, "%s/lib/lib%s.so", appLocation, argv[1]);
- if (!file_exists(libraryLocation)) {
- printf("ERROR: Unable to find the appropriate library in the Skia App.\n");
- printf("ERROR: Did you provide the correct program_name?\n");
- usage(argv[0]);
+ // load the local skia shared library
+ void* skiaLibrary = load_library(argv, "libskia_local.so");
+ if (NULL == skiaLibrary)
+ {
return -1;
}
// load the appropriate library
- void* appLibrary = dlopen(libraryLocation, RTLD_LOCAL | RTLD_LAZY);
- if (!appLibrary) {
- printf("ERROR: Unable to open the shared library.\n");
- printf("ERROR: %s", dlerror());
+ void* appLibrary = load_library(argv, argv[1]);
+ if (NULL == appLibrary) {
return -1;
}
« platform_tools/android/gyp/skia_android.gypi ('K') | « platform_tools/android/gyp/skia_android.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698