| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.base.library_loader; | 5 package org.chromium.base.library_loader; |
| 6 | 6 |
| 7 import android.os.Bundle; | 7 import android.os.Bundle; |
| 8 import android.os.SystemClock; | 8 import android.os.SystemClock; |
| 9 | 9 |
| 10 import org.chromium.base.Log; | 10 import org.chromium.base.Log; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 synchronized (mLock) { | 363 synchronized (mLock) { |
| 364 assert mPrepareLibraryLoadCalled; | 364 assert mPrepareLibraryLoadCalled; |
| 365 | 365 |
| 366 String dlopenExtPath; | 366 String dlopenExtPath; |
| 367 if (zipFilePath != null) { | 367 if (zipFilePath != null) { |
| 368 // The android_dlopen_ext() function understands strings with th
e format | 368 // The android_dlopen_ext() function understands strings with th
e format |
| 369 // <zip_path>!/<file_path> to represent the file_path element wi
thin the zip | 369 // <zip_path>!/<file_path> to represent the file_path element wi
thin the zip |
| 370 // file at zip_path. This enables directly loading from APK. We
add the | 370 // file at zip_path. This enables directly loading from APK. We
add the |
| 371 // "crazy." prefix to the path in the zip file to prevent the An
droid package | 371 // "crazy." prefix to the path in the zip file to prevent the An
droid package |
| 372 // manager from seeing this as a library and so extracting it fr
om the APK. | 372 // manager from seeing this as a library and so extracting it fr
om the APK. |
| 373 String cpu_abi = nativeGetCpuAbi(); | 373 String cpuAbi = nativeGetCpuAbi(); |
| 374 dlopenExtPath = zipFilePath + "!/lib/" + cpu_abi + "/crazy." + l
ibFilePath; | 374 dlopenExtPath = zipFilePath + "!/lib/" + cpuAbi + "/crazy." + li
bFilePath; |
| 375 } else { | 375 } else { |
| 376 // Not loading from APK directly, so simply pass the library nam
e to | 376 // Not loading from APK directly, so simply pass the library nam
e to |
| 377 // android_dlopen_ext(). | 377 // android_dlopen_ext(). |
| 378 dlopenExtPath = libFilePath; | 378 dlopenExtPath = libFilePath; |
| 379 } | 379 } |
| 380 | 380 |
| 381 if (mLoadedLibraries.containsKey(dlopenExtPath)) { | 381 if (mLoadedLibraries.containsKey(dlopenExtPath)) { |
| 382 if (DEBUG) { | 382 if (DEBUG) { |
| 383 Log.i(TAG, "Not loading " + libFilePath + " twice"); | 383 Log.i(TAG, "Not loading " + libFilePath + " twice"); |
| 384 } | 384 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 * @param loadAddress load address, which can be different from the one | 495 * @param loadAddress load address, which can be different from the one |
| 496 * used to load the library in the current process! | 496 * used to load the library in the current process! |
| 497 * @param relroPath Path to the shared RELRO file for this library. | 497 * @param relroPath Path to the shared RELRO file for this library. |
| 498 * @param libInfo libInfo instance. On success, the mRelroStart, mRelroSize | 498 * @param libInfo libInfo instance. On success, the mRelroStart, mRelroSize |
| 499 * and mRelroFd will be set. | 499 * and mRelroFd will be set. |
| 500 * @return true on success, false otherwise. | 500 * @return true on success, false otherwise. |
| 501 */ | 501 */ |
| 502 private static native boolean nativeCreateSharedRelro( | 502 private static native boolean nativeCreateSharedRelro( |
| 503 String dlopenExtPath, long loadAddress, String relroPath, LibInfo li
bInfo); | 503 String dlopenExtPath, long loadAddress, String relroPath, LibInfo li
bInfo); |
| 504 } | 504 } |
| OLD | NEW |