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

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

Issue 61893008: Support linking skia statically on Android (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/local/tmp"; 64 const char* appLocation = "/data/local/tmp";
65 if (!file_exists(appLocation)) { 65 if (!file_exists(appLocation)) {
66 printf("ERROR: Unable to find /data/local/tmp 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 void* skiaLibrary;
71
72 #if defined(SKIA_DLL)
70 // load the local skia shared library 73 // load the local skia shared library
71 void* skiaLibrary = load_library(appLocation, "skia_android"); 74 skiaLibrary = load_library(appLocation, "skia_android");
72 if (NULL == skiaLibrary) 75 if (NULL == skiaLibrary)
73 { 76 {
74 return -1; 77 return -1;
75 } 78 }
79 #endif
76 80
77 // load the appropriate library 81 // load the appropriate library
78 void* appLibrary = load_library(appLocation, argv[1]); 82 void* appLibrary = load_library(appLocation, argv[1]);
79 if (NULL == appLibrary) { 83 if (NULL == appLibrary) {
80 return -1; 84 return -1;
81 } 85 }
82 86
87 #if !defined(SKIA_DLL)
88 skiaLibrary = appLibrary;
89 #endif
90
83 // find the address of the main function 91 // find the address of the main function
84 int (*app_main)(int, const char**); 92 int (*app_main)(int, const char**);
85 *(void **) (&app_main) = dlsym(appLibrary, "main"); 93 *(void **) (&app_main) = dlsym(appLibrary, "main");
86 94
87 if (!app_main) { 95 if (!app_main) {
88 printf("ERROR: Unable to load the main function of the selected program. \n"); 96 printf("ERROR: Unable to load the main function of the selected program. \n");
89 printf("ERROR: %s\n", dlerror()); 97 printf("ERROR: %s\n", dlerror());
90 return -1; 98 return -1;
91 } 99 }
92 100
93 // find the address of the SkPrintToConsole function 101 // find the address of the SkPrintToConsole function
94 void (*app_SkDebugToStdOut)(bool); 102 void (*app_SkDebugToStdOut)(bool);
95 *(void **) (&app_SkDebugToStdOut) = dlsym(skiaLibrary, "AndroidSkDebugToStdO ut"); 103 *(void **) (&app_SkDebugToStdOut) = dlsym(skiaLibrary, "AndroidSkDebugToStdO ut");
96 104
97 if (app_SkDebugToStdOut) { 105 if (app_SkDebugToStdOut) {
98 (*app_SkDebugToStdOut)(true); 106 (*app_SkDebugToStdOut)(true);
99 } else { 107 } else {
100 printf("WARNING: Unable to redirect output to the console.\n"); 108 printf("WARNING: Unable to redirect output to the console.\n");
101 printf("WARNING: %s\n", dlerror()); 109 printf("WARNING: %s\n", dlerror());
102 } 110 }
103 111
104 // pass all additional arguments to the main function 112 // pass all additional arguments to the main function
105 return launch_app(app_main, argc - 1, ++argv); 113 return launch_app(app_main, argc - 1, ++argv);
106 } 114 }
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