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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 synchronized (mLock) { | 110 synchronized (mLock) { |
111 assert !mPrepareLibraryLoadCalled; | 111 assert !mPrepareLibraryLoadCalled; |
112 ensureInitializedLocked(); | 112 ensureInitializedLocked(); |
113 | 113 |
114 // If in the browser, generate a random base load address for servic
e processes | 114 // If in the browser, generate a random base load address for servic
e processes |
115 // and create an empty shared RELROs map. For service processes, the
shared | 115 // and create an empty shared RELROs map. For service processes, the
shared |
116 // RELROs map must remain null until set by useSharedRelros(). | 116 // RELROs map must remain null until set by useSharedRelros(). |
117 if (mInBrowserProcess) { | 117 if (mInBrowserProcess) { |
118 setupBaseLoadAddressLocked(); | 118 setupBaseLoadAddressLocked(); |
119 mSharedRelros = new HashMap<String, LibInfo>(); | 119 mSharedRelros = new HashMap<String, LibInfo>(); |
| 120 // Retrieve the data directory from base. |
| 121 mDataDirectory = PathUtils.getDataDirectory(null); |
120 } | 122 } |
121 | 123 |
122 // Create an empty loaded libraries map. | 124 // Create an empty loaded libraries map. |
123 mLoadedLibraries = new HashMap<String, LibInfo>(); | 125 mLoadedLibraries = new HashMap<String, LibInfo>(); |
124 | 126 |
125 // Retrieve the data directory from base. | |
126 mDataDirectory = PathUtils.getDataDirectory(null); | |
127 | |
128 // Start the current load address at the base load address. | 127 // Start the current load address at the base load address. |
129 mCurrentLoadAddress = mBaseLoadAddress; | 128 mCurrentLoadAddress = mBaseLoadAddress; |
130 | 129 |
131 mPrepareLibraryLoadCalled = true; | 130 mPrepareLibraryLoadCalled = true; |
132 } | 131 } |
133 } | 132 } |
134 | 133 |
135 /** | 134 /** |
136 * Call this method just after loading all native shared libraries in this p
rocess. | 135 * Call this method just after loading all native shared libraries in this p
rocess. |
137 * If not in the browser, closes the LibInfo entries used for RELRO sharing. | 136 * If not in the browser, closes the LibInfo entries used for RELRO sharing. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 * @param relroPath Path to the shared RELRO file for this library. | 485 * @param relroPath Path to the shared RELRO file for this library. |
487 * @param libInfo libInfo instance. On success, the mRelroStart, mRelroSize | 486 * @param libInfo libInfo instance. On success, the mRelroStart, mRelroSize |
488 * and mRelroFd will be set. | 487 * and mRelroFd will be set. |
489 * @return true on success, false otherwise. | 488 * @return true on success, false otherwise. |
490 */ | 489 */ |
491 private static native boolean nativeCreateSharedRelro(String dlopenExtPath, | 490 private static native boolean nativeCreateSharedRelro(String dlopenExtPath, |
492 long loadAddress, | 491 long loadAddress, |
493 String relroPath, | 492 String relroPath, |
494 LibInfo libInfo); | 493 LibInfo libInfo); |
495 } | 494 } |
OLD | NEW |