Index: base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
diff --git a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
similarity index 91% |
copy from content/public/android/java/src/org/chromium/content/app/LibraryLoader.java |
copy to base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
index 635a15335abe510b91e923fb682ffcc2b3ced06c..8a5766914e1c660e989020bb97eb1bbe57c9bb6d 100644 |
--- a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java |
+++ b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-package org.chromium.content.app; |
+package org.chromium.base.library_loader; |
import android.util.Log; |
@@ -10,8 +10,6 @@ import org.chromium.base.CommandLine; |
import org.chromium.base.JNINamespace; |
import org.chromium.base.SysUtils; |
import org.chromium.base.TraceEvent; |
-import org.chromium.content.common.ProcessInitException; |
-import org.chromium.content.common.ResultCodes; |
/** |
* This class provides functionality to load and register the native libraries. |
@@ -27,7 +25,7 @@ import org.chromium.content.common.ResultCodes; |
* See also content/app/android/library_loader_hooks.cc, which contains |
Yaron
2014/01/17 02:18:25
Tons of content references
aberent
2014/01/30 17:46:05
Done.
|
* the native counterpart to this class. |
*/ |
-@JNINamespace("content") |
+@JNINamespace("base::android") |
public class LibraryLoader { |
private static final String TAG = "LibraryLoader"; |
@@ -96,7 +94,7 @@ public class LibraryLoader { |
* @param initCommandLine The command line arguments that native command line will |
* be initialized with. |
*/ |
- static void initialize(String[] initCommandLine) throws ProcessInitException { |
+ public static void initialize(String[] initCommandLine) throws ProcessInitException { |
synchronized (sLock) { |
initializeAlreadyLocked(initCommandLine); |
} |
@@ -132,7 +130,7 @@ public class LibraryLoader { |
sLoaded = true; |
} |
} catch (UnsatisfiedLinkError e) { |
- throw new ProcessInitException(ResultCodes.RESULT_CODE_NATIVE_LIBRARY_LOAD_FAILED, e); |
+ throw new ProcessInitException(LoaderErrors.LOADER_ERROR_NATIVE_LIBRARY_LOAD_FAILED, e); |
} |
// Check that the version of the library we have loaded matches the version we expect |
Log.i(TAG, String.format( |
@@ -141,7 +139,7 @@ public class LibraryLoader { |
NativeLibraries.VERSION_NUMBER, |
nativeGetVersionNumber())); |
if (!NativeLibraries.VERSION_NUMBER.equals(nativeGetVersionNumber())) { |
- throw new ProcessInitException(ResultCodes.RESULT_CODE_NATIVE_LIBRARY_WRONG_VERSION); |
+ throw new ProcessInitException(LoaderErrors.LOADER_ERROR_NATIVE_LIBRARY_WRONG_VERSION); |
} |
} |
@@ -153,10 +151,9 @@ public class LibraryLoader { |
if (sInitialized) { |
return; |
} |
- int resultCode = nativeLibraryLoaded(initCommandLine); |
- if (resultCode != 0) { |
+ if (!nativeLibraryLoaded(initCommandLine)) { |
Log.e(TAG, "error calling nativeLibraryLoaded"); |
- throw new ProcessInitException(resultCode); |
+ throw new ProcessInitException(LoaderErrors.LOADER_ERROR_FAILED_TO_REGISTER_JNI); |
} |
// From this point on, native code is ready to use and checkIsReady() |
// shouldn't complain from now on (and in fact, it's used by the |
@@ -177,7 +174,7 @@ public class LibraryLoader { |
// |
// Return 0 on success, otherwise return the error code from |
// content/public/common/result_codes.h. |
- private static native int nativeLibraryLoaded(String[] initCommandLine); |
+ private static native boolean nativeLibraryLoaded(String[] initCommandLine); |
// Method called to record statistics about the content linker operation, |
// i.e. whether the library failed to be loaded at a fixed address, and |