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 16 matching lines...) Expand all Loading... |
27 * This Linker implementation uses the Android M and later system linker to map
and then | 27 * This Linker implementation uses the Android M and later system linker to map
and then |
28 * run Chrome for Android. | 28 * run Chrome for Android. |
29 * | 29 * |
30 * For more on the operations performed by the Linker, see {@link Linker}. | 30 * For more on the operations performed by the Linker, see {@link Linker}. |
31 */ | 31 */ |
32 class ModernLinker extends Linker { | 32 class ModernLinker extends Linker { |
33 // Log tag for this class. | 33 // Log tag for this class. |
34 private static final String TAG = "LibraryLoader"; | 34 private static final String TAG = "LibraryLoader"; |
35 | 35 |
36 // Becomes true after linker initialization. | 36 // Becomes true after linker initialization. |
37 private boolean mInitialized = false; | 37 private boolean mInitialized; |
38 | 38 |
39 // Becomes true to indicate this process needs to wait for a shared RELRO in
LibraryLoad(). | 39 // Becomes true to indicate this process needs to wait for a shared RELRO in
LibraryLoad(). |
40 private boolean mWaitForSharedRelros = false; | 40 private boolean mWaitForSharedRelros; |
41 | 41 |
42 // The map of all RELRO sections either created or used in this process. | 42 // The map of all RELRO sections either created or used in this process. |
43 private HashMap<String, LibInfo> mSharedRelros = null; | 43 private HashMap<String, LibInfo> mSharedRelros; |
44 | 44 |
45 // Cached Bundle representation of the RELRO sections map for transfer acros
s processes. | 45 // Cached Bundle representation of the RELRO sections map for transfer acros
s processes. |
46 private Bundle mSharedRelrosBundle = null; | 46 private Bundle mSharedRelrosBundle; |
47 | 47 |
48 // Set to true if this runs in the browser process. Disabled by initServiceP
rocess(). | 48 // Set to true if this runs in the browser process. Disabled by initServiceP
rocess(). |
49 private boolean mInBrowserProcess = true; | 49 private boolean mInBrowserProcess = true; |
50 | 50 |
51 // Current common random base load address. A value of -1 indicates not yet
initialized. | 51 // Current common random base load address. A value of -1 indicates not yet
initialized. |
52 private long mBaseLoadAddress = -1; | 52 private long mBaseLoadAddress = -1; |
53 | 53 |
54 // Current fixed-location load address for the next library called by loadLi
brary(). | 54 // Current fixed-location load address for the next library called by loadLi
brary(). |
55 // Initialized to mBaseLoadAddress in prepareLibraryLoad(), and then adjuste
d as each | 55 // Initialized to mBaseLoadAddress in prepareLibraryLoad(), and then adjuste
d as each |
56 // library is loaded by loadLibrary(). | 56 // library is loaded by loadLibrary(). |
57 private long mCurrentLoadAddress = -1; | 57 private long mCurrentLoadAddress = -1; |
58 | 58 |
59 // Becomes true once prepareLibraryLoad() has been called. | 59 // Becomes true once prepareLibraryLoad() has been called. |
60 private boolean mPrepareLibraryLoadCalled = false; | 60 private boolean mPrepareLibraryLoadCalled; |
61 | 61 |
62 // The map of libraries that are currently loaded in this process. | 62 // The map of libraries that are currently loaded in this process. |
63 private HashMap<String, LibInfo> mLoadedLibraries = null; | 63 private HashMap<String, LibInfo> mLoadedLibraries; |
64 | 64 |
65 // Private singleton constructor, and singleton factory method. | 65 // Private singleton constructor, and singleton factory method. |
66 private ModernLinker() { } | 66 private ModernLinker() { } |
67 static Linker create() { | 67 static Linker create() { |
68 return new ModernLinker(); | 68 return new ModernLinker(); |
69 } | 69 } |
70 | 70 |
71 // Used internally to initialize the linker's data. Assumes lock is held. | 71 // Used internally to initialize the linker's data. Assumes lock is held. |
72 private void ensureInitializedLocked() { | 72 private void ensureInitializedLocked() { |
73 assert Thread.holdsLock(mLock); | 73 assert Thread.holdsLock(mLock); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 * @param relroPath Path to the shared RELRO file for this library. | 480 * @param relroPath Path to the shared RELRO file for this library. |
481 * @param libInfo libInfo instance. On success, the mRelroStart, mRelroSize | 481 * @param libInfo libInfo instance. On success, the mRelroStart, mRelroSize |
482 * and mRelroFd will be set. | 482 * and mRelroFd will be set. |
483 * @return true on success, false otherwise. | 483 * @return true on success, false otherwise. |
484 */ | 484 */ |
485 private static native boolean nativeCreateSharedRelro(String dlopenExtPath, | 485 private static native boolean nativeCreateSharedRelro(String dlopenExtPath, |
486 long loadAddress, | 486 long loadAddress, |
487 String relroPath, | 487 String relroPath, |
488 LibInfo libInfo); | 488 LibInfo libInfo); |
489 } | 489 } |
OLD | NEW |