Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Unified Diff: base/android/java/src/org/chromium/base/library_loader/Linker.java

Issue 228023005: Additions to support crazy linker callbacks from the UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update for review feedback. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/android/linker/linker_jni.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/library_loader/Linker.java
diff --git a/base/android/java/src/org/chromium/base/library_loader/Linker.java b/base/android/java/src/org/chromium/base/library_loader/Linker.java
index e17ba6dc0de61b91f8978e22587fbce3cd7fd5c9..54a672d7f166e9b625b736beef5ec6ae0ade6bdf 100644
--- a/base/android/java/src/org/chromium/base/library_loader/Linker.java
+++ b/base/android/java/src/org/chromium/base/library_loader/Linker.java
@@ -11,6 +11,7 @@ import android.os.Parcelable;
import android.util.Log;
import org.chromium.base.SysUtils;
+import org.chromium.base.ThreadUtils;
import java.io.File;
import java.io.FileInputStream;
@@ -842,6 +843,29 @@ public class Linker {
}
/**
+ * Move activity from the native thread to the main UI thread.
+ * Called from native code on its own thread. Posts a callback from
+ * the UI thread back to native code.
+ *
+ * @param opaque Opaque argument.
+ */
+ public static void postCallbackOnMainThread(final long opaque) {
+ ThreadUtils.postOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ nativeRunCallbackOnUiThread(opaque);
+ }
+ });
+ }
+
+ /**
+ * Native method to run callbacks on the main UI thread.
+ * Supplied by the crazy linker and called by postCallbackOnMainThread.
+ * @param opaque Opaque crazy linker arguments.
+ */
+ private static native void nativeRunCallbackOnUiThread(long opaque);
+
+ /**
* Native method used to load a library.
* @param library Platform specific library name (e.g. libfoo.so)
* @param loadAddress Explicit load address, or 0 for randomized one.
« no previous file with comments | « no previous file | base/android/linker/linker_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698