Add the classname to JNI method names to make them unique

Our JNI code generator generated a lot of Init(...) methods which
collided in jumbo builds. This patch adds a class name prefix to
them, and all other JNI methods, so that they have locally unique names.

[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]

Bug: 779013
Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.linux:linux_site_isolation;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I86b6ac83c8e0a3507bd1d0efc48d625c12b4bb2b
Reviewed-on: https://chromium-review.googlesource.com/765973
Commit-Queue: Daniel Bratell <[email protected]>
Reviewed-by: Daniel Bratell <[email protected]>
Reviewed-by: Peter Beverloo <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Rouslan Solomakhin <[email protected]>
Reviewed-by: Sky Malice <[email protected]>
Reviewed-by: Lambros Lambrou <[email protected]>
Reviewed-by: Yaron Friedman <[email protected]>
Reviewed-by: Luke Halliwell <[email protected]>
Reviewed-by: Ken Rockot <[email protected]>
Reviewed-by: Richard Coles <[email protected]>
Reviewed-by: Wei-Yin Chen (陳威尹) <[email protected]>
Reviewed-by: Miguel Casas <[email protected]>
Reviewed-by: Sadrul Chowdhury <[email protected]>
Reviewed-by: Paul Jensen <[email protected]>
Reviewed-by: Peter Kasting <[email protected]>
Reviewed-by: Bernhard Bauer <[email protected]>
Reviewed-by: agrieve <[email protected]>
Cr-Commit-Position: refs/heads/master@{#518300}
diff --git a/chrome/browser/android/foreign_session_helper.cc b/chrome/browser/android/foreign_session_helper.cc
index 08ebcdbf..9d07929 100644
--- a/chrome/browser/android/foreign_session_helper.cc
+++ b/chrome/browser/android/foreign_session_helper.cc
@@ -82,7 +82,7 @@
   return true;
 }
 
-void CopyTabToJava(
+void JNI_ForeignSessionHelper_CopyTabToJava(
     JNIEnv* env,
     const sessions::SessionTab& tab,
     ScopedJavaLocalRef<jobject>& j_window) {
@@ -101,7 +101,7 @@
       tab.timestamp.ToJavaTime(), tab.tab_id.id());
 }
 
-void CopyWindowToJava(
+void JNI_ForeignSessionHelper_CopyWindowToJava(
     JNIEnv* env,
     const sessions::SessionWindow& window,
     ScopedJavaLocalRef<jobject>& j_window) {
@@ -111,11 +111,11 @@
     if (ShouldSkipTab(session_tab))
       return;
 
-    CopyTabToJava(env, session_tab, j_window);
+    JNI_ForeignSessionHelper_CopyTabToJava(env, session_tab, j_window);
   }
 }
 
-void CopySessionToJava(
+void JNI_ForeignSessionHelper_CopySessionToJava(
     JNIEnv* env,
     const SyncedSession& session,
     ScopedJavaLocalRef<jobject>& j_session) {
@@ -129,15 +129,16 @@
     last_pushed_window.Reset(Java_ForeignSessionHelper_pushWindow(
         env, j_session, window.timestamp.ToJavaTime(), window.window_id.id()));
 
-    CopyWindowToJava(env, window, last_pushed_window);
+    JNI_ForeignSessionHelper_CopyWindowToJava(env, window, last_pushed_window);
   }
 }
 
 }  // namespace
 
-static jlong Init(JNIEnv* env,
-                  const JavaParamRef<jclass>& clazz,
-                  const JavaParamRef<jobject>& profile) {
+static jlong JNI_ForeignSessionHelper_Init(
+    JNIEnv* env,
+    const JavaParamRef<jclass>& clazz,
+    const JavaParamRef<jobject>& profile) {
   ForeignSessionHelper* foreign_session_helper = new ForeignSessionHelper(
       ProfileAndroid::FromProfileAndroid(profile));
   return reinterpret_cast<intptr_t>(foreign_session_helper);
@@ -258,11 +259,12 @@
       for (const sessions::SessionTab* tab : tabs) {
          if (ShouldSkipTab(*tab))
            continue;
-         CopyTabToJava(env, *tab, last_pushed_window);
+         JNI_ForeignSessionHelper_CopyTabToJava(env, *tab, last_pushed_window);
       }
     } else {
       // Push the full session, with tabs ordered by visual position.
-      CopySessionToJava(env, session, last_pushed_session);
+      JNI_ForeignSessionHelper_CopySessionToJava(env, session,
+                                                 last_pushed_session);
     }
   }