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

Side by Side Diff: platform_tools/android/launcher/skia_launcher.cpp

Issue 22617002: Update Skia Android tools. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: more fixes to make the bots happy Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « platform_tools/android/gyp/skia_android.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <dlfcn.h> 8 #include <dlfcn.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 10
(...skipping 14 matching lines...) Expand all
25 25
26 int launch_app(int (*app_main)(int, const char**), int argc, 26 int launch_app(int (*app_main)(int, const char**), int argc,
27 const char** argv) { 27 const char** argv) {
28 return (*app_main)(argc, argv); 28 return (*app_main)(argc, argv);
29 } 29 }
30 30
31 void* load_library(const char* appLocation, const char* libraryName) 31 void* load_library(const char* appLocation, const char* libraryName)
32 { 32 {
33 // attempt to lookup the location of the shared libraries 33 // attempt to lookup the location of the shared libraries
34 char libraryLocation[100]; 34 char libraryLocation[100];
35 sprintf(libraryLocation, "%s/lib/lib%s.so", appLocation, libraryName); 35 sprintf(libraryLocation, "%s/lib%s.so", appLocation, libraryName);
36 if (!file_exists(libraryLocation)) { 36 if (!file_exists(libraryLocation)) {
37 printf("ERROR: Unable to find the '%s' library in the Skia App.\n", libr aryName); 37 printf("ERROR: Unable to find the '%s' library in the Skia App.\n", libr aryName);
38 printf("ERROR: Did you provide the correct program_name?\n"); 38 printf("ERROR: Did you provide the correct program_name?\n");
39 usage(); 39 usage();
40 return NULL; 40 return NULL;
41 } 41 }
42 42
43 // load the appropriate library 43 // load the appropriate library
44 void* appLibrary = dlopen(libraryLocation, RTLD_LOCAL | RTLD_LAZY); 44 void* appLibrary = dlopen(libraryLocation, RTLD_LOCAL | RTLD_LAZY);
45 if (!appLibrary) { 45 if (!appLibrary) {
46 printf("ERROR: Unable to open the shared library.\n"); 46 printf("ERROR: Unable to open the shared library.\n");
47 printf("ERROR: %s", dlerror()); 47 printf("ERROR: %s", dlerror());
48 return NULL; 48 return NULL;
49 } 49 }
50 50
51 return appLibrary; 51 return appLibrary;
52 } 52 }
53 53
54 int main(int argc, const char** argv) { 54 int main(int argc, const char** argv) {
55 55
56 // check that the program name was specified 56 // check that the program name was specified
57 if (argc < 2) { 57 if (argc < 2) {
58 printf("ERROR: No program_name was specified\n"); 58 printf("ERROR: No program_name was specified\n");
59 usage(); 59 usage();
60 return -1; 60 return -1;
61 } 61 }
62 62
63 // attempt to lookup the location of the skia app 63 // attempt to lookup the location of the skia app
64 const char* appLocation = "/data/data/com.skia"; 64 const char* appLocation = "/data/local/tmp";
65 if (!file_exists(appLocation)) { 65 if (!file_exists(appLocation)) {
66 printf("ERROR: Unable to find the com.skia app on the device.\n"); 66 printf("ERROR: Unable to find /data/local/tmp on the device.\n");
67 return -1; 67 return -1;
68 } 68 }
69 69
70 // load the local skia shared library 70 // load the local skia shared library
71 void* skiaLibrary = load_library(appLocation, "skia_android"); 71 void* skiaLibrary = load_library(appLocation, "skia_android");
72 if (NULL == skiaLibrary) 72 if (NULL == skiaLibrary)
73 { 73 {
74 return -1; 74 return -1;
75 } 75 }
76 76
(...skipping 20 matching lines...) Expand all
97 if (app_SkDebugToStdOut) { 97 if (app_SkDebugToStdOut) {
98 (*app_SkDebugToStdOut)(true); 98 (*app_SkDebugToStdOut)(true);
99 } else { 99 } else {
100 printf("WARNING: Unable to redirect output to the console.\n"); 100 printf("WARNING: Unable to redirect output to the console.\n");
101 printf("WARNING: %s\n", dlerror()); 101 printf("WARNING: %s\n", dlerror());
102 } 102 }
103 103
104 // pass all additional arguments to the main function 104 // pass all additional arguments to the main function
105 return launch_app(app_main, argc - 1, ++argv); 105 return launch_app(app_main, argc - 1, ++argv);
106 } 106 }
OLDNEW
« no previous file with comments | « 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