OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 package org.chromium.content.app; | 5 package org.chromium.base.library_loader; |
6 | 6 |
7 public class NativeLibraries { | 7 public class NativeLibraries { |
8 /** | 8 /** |
9 * IMPORTANT NOTE: The variables defined here must _not_ be 'final'. | 9 * IMPORTANT NOTE: The variables defined here must _not_ be 'final'. |
10 * | 10 * |
11 * The reason for this is very subtle: | 11 * The reason for this is very subtle: |
12 * | 12 * |
13 * - This template is used to generate several distinct, but similar | 13 * - This template is used to generate several distinct, but similar |
14 * files used in different contexts: | 14 * files used in different contexts: |
15 * | 15 * |
16 * o .../gen/templates/org/chromium/content/app/NativeLibraries.java | 16 * o .../gen/templates/org/chromium/base/library_loader/NativeLibraries.ja
va |
17 * | 17 * |
18 * This file is used to build content.jar, which is the library | 18 * This file is used to build base.jar, which is the library |
19 * jar used by several content-based projects. However, the | 19 * jar used by chromium projects. However, the |
20 * corresponding NativeLibraries.class file will _not_ be part | 20 * corresponding NativeLibraries.class file will _not_ be part |
21 * of the final content.jar. | 21 * of the final base.jar. |
22 * | 22 * |
23 * o .../$PROJECT/native_libraries_java/NativeLibraries.java | 23 * o .../$PROJECT/native_libraries_java/NativeLibraries.java |
24 * | 24 * |
25 * This file is used to build a content-based APK (e.g. $PROJECT | 25 * This file is used to build an APK (e.g. $PROJECT |
26 * could be 'content_shell_apk'). Its content will depend on | 26 * could be 'content_shell_apk'). Its content will depend on |
27 * this target's specific build configuration, and differ from | 27 * this target's specific build configuration, and differ from |
28 * the source file above. | 28 * the source file above. |
29 * | 29 * |
30 * - During the final link, all .jar files are linked together into | 30 * - During the final link, all .jar files are linked together into |
31 * a single .dex file, and the second version of NativeLibraries.class | 31 * a single .dex file, and the second version of NativeLibraries.class |
32 * will be put into the final output file, and used at runtime. | 32 * will be put into the final output file, and used at runtime. |
33 * | 33 * |
34 * - If the variables were defined as 'final', their value would be | 34 * - If the variables were defined as 'final', their value would be |
35 * optimized out inside of 'content.jar', and could not be specialized | 35 * optimized out inside of 'base.jar', and could not be specialized |
36 * for every content-based program. | 36 * for every chromium program. This, however, doesn't apply to arrays of |
| 37 * strings, which can be defined as final. |
37 * | 38 * |
38 * This exotic scheme is used to avoid injecting project-specific, or | 39 * This exotic scheme is used to avoid injecting project-specific, or |
39 * even build-specific, values into the content layer. E.g. this is | 40 * even build-specific, values into the base layer. E.g. this is |
40 * how the component build is supported on Android without modifying | 41 * how the component build is supported on Android without modifying |
41 * the sources of each and every Chromium-based target. | 42 * the sources of each and every Chromium-based target. |
42 */ | 43 */ |
43 // Set to true to enable the use of the content Linker. | 44 // Set to true to enable the use of the Chromium Linker. |
44 #if defined(ENABLE_CONTENT_LINKER) | 45 #if defined(ENABLE_CHROMIUM_LINKER) |
45 public static boolean USE_LINKER = true; | 46 public static boolean USE_LINKER = true; |
46 #else | 47 #else |
47 public static boolean USE_LINKER = false; | 48 public static boolean USE_LINKER = false; |
48 #endif | 49 #endif |
49 | 50 |
50 #if defined(ENABLE_CONTENT_LINKER_TESTS) | 51 #if defined(ENABLE_CHROMIUM_LINKER_TESTS) |
51 public static boolean ENABLE_LINKER_TESTS = true; | 52 public static boolean ENABLE_LINKER_TESTS = true; |
52 #else | 53 #else |
53 public static boolean ENABLE_LINKER_TESTS = false; | 54 public static boolean ENABLE_LINKER_TESTS = false; |
54 #endif | 55 #endif |
55 | 56 |
56 // This is the list of native libraries to be loaded (in the correct order) | 57 // This is the list of native libraries to be loaded (in the correct order) |
57 // by LibraryLoader.java. The content java library is compiled with no | 58 // by LibraryLoader.java. The base java library is compiled with no |
58 // array defined, and then the build system creates a version of the file | 59 // array defined, and then the build system creates a version of the file |
59 // with the real list of libraries required (which changes based upon which | 60 // with the real list of libraries required (which changes based upon which |
60 // .apk is being built). | 61 // .apk is being built). |
61 // TODO(cjhopman): This is public since it is referenced by ChromeNativeTest
Activity.java | 62 // TODO(cjhopman): This is public since it is referenced by ChromeNativeTest
Activity.java |
62 // directly. The two ways of library loading should be refactored into one. | 63 // directly. The two ways of library loading should be refactored into one. |
63 public static final String[] LIBRARIES | 64 public static final String[] LIBRARIES |
64 #include <native_libraries_array.h> | 65 #include <native_libraries_array.h> |
65 ; | 66 ; |
66 // This is the expected version of the 'main' native library, which is the o
ne that | 67 // This is the expected version of the 'main' native library, which is the o
ne that |
67 // implements the initial set of content JNI functions including | 68 // implements the initial set of base JNI functions including |
68 // content::nativeGetVersionName() | 69 // base::android::nativeGetVersionName() |
69 // Note(aberent): This is logically final, but making it final breaks the bu
ild, since it | |
70 // lets other Java components read its value at compile time rather than at
run time, hence | |
71 // reading it from the wrong class file. | |
72 static String VERSION_NUMBER | 70 static String VERSION_NUMBER |
73 #include <native_libraries_version.h> | 71 #include <native_libraries_version.h> |
74 ; | 72 ; |
75 } | 73 } |
OLD | NEW |