| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.os.AsyncTask; | 9 import android.os.AsyncTask; |
| 10 import android.os.SystemClock; | 10 import android.os.SystemClock; |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // This must happen after the code is loaded and after JNI is ready (since a
fter the | 350 // This must happen after the code is loaded and after JNI is ready (since a
fter the |
| 351 // switch the Java CommandLine will delegate all calls the native CommandLin
e). | 351 // switch the Java CommandLine will delegate all calls the native CommandLin
e). |
| 352 private void ensureCommandLineSwitchedAlreadyLocked() { | 352 private void ensureCommandLineSwitchedAlreadyLocked() { |
| 353 assert mLoaded; | 353 assert mLoaded; |
| 354 if (mCommandLineSwitched) { | 354 if (mCommandLineSwitched) { |
| 355 return; | 355 return; |
| 356 } | 356 } |
| 357 nativeInitCommandLine(CommandLine.getJavaSwitchesOrNull()); | 357 nativeInitCommandLine(CommandLine.getJavaSwitchesOrNull()); |
| 358 CommandLine.enableNativeProxy(); | 358 CommandLine.enableNativeProxy(); |
| 359 mCommandLineSwitched = true; | 359 mCommandLineSwitched = true; |
| 360 | |
| 361 // Ensure that native side application context is loaded and in sync wit
h java side. Must do | |
| 362 // this here so webview also gets its application context set before ful
ly initializing. | |
| 363 ContextUtils.initApplicationContextForNative(); | |
| 364 } | 360 } |
| 365 | 361 |
| 366 // Invoke base::android::LibraryLoaded in library_loader_hooks.cc | 362 // Invoke base::android::LibraryLoaded in library_loader_hooks.cc |
| 367 private void initializeAlreadyLocked() throws ProcessInitException { | 363 private void initializeAlreadyLocked() throws ProcessInitException { |
| 368 if (mInitialized) { | 364 if (mInitialized) { |
| 369 return; | 365 return; |
| 370 } | 366 } |
| 371 | 367 |
| 372 ensureCommandLineSwitchedAlreadyLocked(); | 368 ensureCommandLineSwitchedAlreadyLocked(); |
| 373 | 369 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 503 |
| 508 // Finds the ranges corresponding to the native library pages, forks a new | 504 // Finds the ranges corresponding to the native library pages, forks a new |
| 509 // process to prefetch these pages and waits for it. The new process then | 505 // process to prefetch these pages and waits for it. The new process then |
| 510 // terminates. This is blocking. | 506 // terminates. This is blocking. |
| 511 private static native boolean nativeForkAndPrefetchNativeLibrary(); | 507 private static native boolean nativeForkAndPrefetchNativeLibrary(); |
| 512 | 508 |
| 513 // Returns the percentage of the native library code page that are currently
reseident in | 509 // Returns the percentage of the native library code page that are currently
reseident in |
| 514 // memory. | 510 // memory. |
| 515 private static native int nativePercentageOfResidentNativeLibraryCode(); | 511 private static native int nativePercentageOfResidentNativeLibraryCode(); |
| 516 } | 512 } |
| OLD | NEW |