| 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.Parcel; | 8 import android.os.Parcel; |
| 9 | 9 |
| 10 import org.chromium.base.Log; | 10 import org.chromium.base.Log; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 * for Android. | 31 * for Android. |
| 32 * | 32 * |
| 33 * For more on the operations performed by the Linker, see {@link Linker}. | 33 * For more on the operations performed by the Linker, see {@link Linker}. |
| 34 */ | 34 */ |
| 35 @MainDex | 35 @MainDex |
| 36 class LegacyLinker extends Linker { | 36 class LegacyLinker extends Linker { |
| 37 // Log tag for this class. | 37 // Log tag for this class. |
| 38 private static final String TAG = "LibraryLoader"; | 38 private static final String TAG = "LibraryLoader"; |
| 39 | 39 |
| 40 // Becomes true after linker initialization. | 40 // Becomes true after linker initialization. |
| 41 private boolean mInitialized = false; | 41 private boolean mInitialized; |
| 42 | 42 |
| 43 // Set to true if this runs in the browser process. Disabled by initServiceP
rocess(). | 43 // Set to true if this runs in the browser process. Disabled by initServiceP
rocess(). |
| 44 private boolean mInBrowserProcess = true; | 44 private boolean mInBrowserProcess = true; |
| 45 | 45 |
| 46 // Becomes true to indicate this process needs to wait for a shared RELRO in | 46 // Becomes true to indicate this process needs to wait for a shared RELRO in |
| 47 // finishLibraryLoad(). | 47 // finishLibraryLoad(). |
| 48 private boolean mWaitForSharedRelros = false; | 48 private boolean mWaitForSharedRelros; |
| 49 | 49 |
| 50 // Becomes true when initialization determines that the browser process can
use the | 50 // Becomes true when initialization determines that the browser process can
use the |
| 51 // shared RELRO. | 51 // shared RELRO. |
| 52 private boolean mBrowserUsesSharedRelro = false; | 52 private boolean mBrowserUsesSharedRelro; |
| 53 | 53 |
| 54 // The map of all RELRO sections either created or used in this process. | 54 // The map of all RELRO sections either created or used in this process. |
| 55 private Bundle mSharedRelros = null; | 55 private Bundle mSharedRelros; |
| 56 | 56 |
| 57 // Current common random base load address. A value of -1 indicates not yet
initialized. | 57 // Current common random base load address. A value of -1 indicates not yet
initialized. |
| 58 private long mBaseLoadAddress = -1; | 58 private long mBaseLoadAddress = -1; |
| 59 | 59 |
| 60 // Current fixed-location load address for the next library called by loadLi
brary(). | 60 // Current fixed-location load address for the next library called by loadLi
brary(). |
| 61 // A value of -1 indicates not yet initialized. | 61 // A value of -1 indicates not yet initialized. |
| 62 private long mCurrentLoadAddress = -1; | 62 private long mCurrentLoadAddress = -1; |
| 63 | 63 |
| 64 // Becomes true once prepareLibraryLoad() has been called. | 64 // Becomes true once prepareLibraryLoad() has been called. |
| 65 private boolean mPrepareLibraryLoadCalled = false; | 65 private boolean mPrepareLibraryLoadCalled; |
| 66 | 66 |
| 67 // The map of libraries that are currently loaded in this process. | 67 // The map of libraries that are currently loaded in this process. |
| 68 private HashMap<String, LibInfo> mLoadedLibraries = null; | 68 private HashMap<String, LibInfo> mLoadedLibraries; |
| 69 | 69 |
| 70 // Private singleton constructor, and singleton factory method. | 70 // Private singleton constructor, and singleton factory method. |
| 71 private LegacyLinker() { } | 71 private LegacyLinker() { } |
| 72 static Linker create() { | 72 static Linker create() { |
| 73 return new LegacyLinker(); | 73 return new LegacyLinker(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Used internally to initialize the linker's data. Assumes lock is held. | 76 // Used internally to initialize the linker's data. Assumes lock is held. |
| 77 // Loads JNI, and sets mMemoryDeviceConfig and mBrowserUsesSharedRelro. | 77 // Loads JNI, and sets mMemoryDeviceConfig and mBrowserUsesSharedRelro. |
| 78 private void ensureInitializedLocked() { | 78 private void ensureInitializedLocked() { |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 /** | 630 /** |
| 631 * Native method used to use a shared RELRO section. | 631 * Native method used to use a shared RELRO section. |
| 632 * | 632 * |
| 633 * @param library Library name. | 633 * @param library Library name. |
| 634 * @param libInfo A LibInfo instance containing valid RELRO information | 634 * @param libInfo A LibInfo instance containing valid RELRO information |
| 635 * @return true on success. | 635 * @return true on success. |
| 636 */ | 636 */ |
| 637 private static native boolean nativeUseSharedRelro(String library, | 637 private static native boolean nativeUseSharedRelro(String library, |
| 638 LibInfo libInfo); | 638 LibInfo libInfo); |
| 639 } | 639 } |
| OLD | NEW |