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

Issue 2501193003: Selectively perform JNI registration in render processes on Android. (Closed)

Created:
4 years, 1 month ago by estevenson
Modified:
3 years, 10 months ago
Reviewers:
Ted C, agrieve, Torne, bshe
CC:
chromium-reviews, mikecase+watch_chromium.org, jbudorick+watch_chromium.org, agrieve+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Selectively perform JNI registration in render processes on Android. We currently register all JNI methods regardless of the process type even though little JNI is needed in render processes. This patch changes the JNI registration behavior for render processes so that registration is only performed for Java classes that are annotated with "@MainDex". Other Chrome processes, Webview, and Monochrome are not affected by this change. BUG=657024 Review-Url: https://codereview.chromium.org/2501193003 Cr-Commit-Position: refs/heads/master@{#447315} Committed: https://chromium.googlesource.com/chromium/src/+/5b04fbad6a653550a4540b70c2aa9647222e672a

Patch Set 1 #

Patch Set 2 : set enable_multidex flag #

Patch Set 3 : Conditionally register JNI based on process type. #

Patch Set 4 : Conditionally register JNI based on process type. #

Patch Set 5 : rebase #

Patch Set 6 : Add @MainDex where it's missing #

Total comments: 4

Patch Set 7 : Address agrieve's comments #

Patch Set 8 : Register everything in tests. #

Patch Set 9 : Conditionally register JNI based on process type. #

Total comments: 4

Patch Set 10 : Add JniRegistrationType enum #

Patch Set 11 : Change how registration is handled for tests #

Patch Set 12 : Use PROCESS_UNINITIALIZED as indicator for test #

Patch Set 13 : Update NativeInit #

Total comments: 9

Patch Set 14 : Correct JniRegistrationType where required in tests #

Patch Set 15 : Conditionally register JNI based on process type. #

Total comments: 2

Patch Set 16 : Set JniRegistrationType on the Java side #

Patch Set 17 : Conditionally register JNI based on process type. #

Patch Set 18 : Remove patchset dependency #

Patch Set 19 : Use the command line to configure JniRegistrationType #

Patch Set 20 : Conditionally register JNI based on process type. #

Total comments: 2

Patch Set 21 : Keep JniRegistrationType in native, add enableSelectiveJniRegistration to Java #

Total comments: 9

Patch Set 22 : Address Ted C comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+290 lines, -33 lines) Patch
M android_webview/lib/main/webview_entry_point.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +1 line, -1 line 0 comments Download
M base/android/java/src/org/chromium/base/JNIUtils.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +22 lines, -0 lines 0 comments Download
M base/android/jni_android.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +17 lines, -6 lines 0 comments Download
M base/android/jni_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +6 lines, -6 lines 0 comments Download
M base/android/jni_generator/SampleForTests_jni.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M base/android/jni_generator/jni_generator.py View 1 2 3 4 5 6 7 8 9 10 6 chunks +23 lines, -7 lines 0 comments Download
M base/android/jni_generator/jni_generator_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +15 lines, -0 lines 0 comments Download
M base/android/jni_generator/jni_generator_tests.py View 1 2 3 4 1 chunk +27 lines, -0 lines 0 comments Download
M base/android/jni_generator/testInnerClassNatives.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M base/android/jni_generator/testInnerClassNativesBothInnerAndOuter.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M base/android/jni_generator/testInnerClassNativesMultiple.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
A base/android/jni_generator/testMainDexFile.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +67 lines, -0 lines 0 comments Download
M base/android/jni_generator/testMultipleJNIAdditionalImport.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M base/android/jni_generator/testNatives.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M base/android/jni_generator/testNativesLong.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
A base/android/jni_generator/testNonMainDexFile.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +67 lines, -0 lines 0 comments Download
M base/android/jni_generator/testSingleJNIAdditionalImport.golden View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M base/android/jni_utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +3 lines, -0 lines 0 comments Download
M base/android/jni_utils.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +4 lines, -1 line 0 comments Download
M chrome/browser/android/chrome_entry_point.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/android/monochrome_entry_point.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +1 line, -1 line 0 comments Download
M content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +8 lines, -0 lines 0 comments Download
M third_party/gvr-android-sdk/display_synchronizer_jni.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M third_party/gvr-android-sdk/gvr_api_jni.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M third_party/gvr-android-sdk/native_callbacks_jni.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 90 (66 generated)
agrieve
https://codereview.chromium.org/2501193003/diff/100001/base/android/jni_generator/SampleForTests_jni.golden File base/android/jni_generator/SampleForTests_jni.golden (right): https://codereview.chromium.org/2501193003/diff/100001/base/android/jni_generator/SampleForTests_jni.golden#newcode488 base/android/jni_generator/SampleForTests_jni.golden:488: if (base::android::IsMultidexEnabled(env) && This logic should hold whether or ...
4 years ago (2016-12-07 20:46:19 UTC) #6
estevenson
https://codereview.chromium.org/2501193003/diff/100001/base/android/jni_generator/SampleForTests_jni.golden File base/android/jni_generator/SampleForTests_jni.golden (right): https://codereview.chromium.org/2501193003/diff/100001/base/android/jni_generator/SampleForTests_jni.golden#newcode488 base/android/jni_generator/SampleForTests_jni.golden:488: if (base::android::IsMultidexEnabled(env) && On 2016/12/07 20:46:19, agrieve (OOO Dec ...
4 years ago (2016-12-07 23:00:05 UTC) #9
estevenson
ptal torne! This change would be required in order to turn on multidex in release, ...
4 years ago (2016-12-13 16:33:33 UTC) #22
Torne
One main comment (which if you agree might make some of the below comments irrelevant): ...
4 years ago (2016-12-14 11:40:25 UTC) #23
estevenson
On 2016/12/14 11:40:25, Torne wrote: > One main comment (which if you agree might make ...
4 years ago (2016-12-14 19:20:07 UTC) #24
Torne
On 2016/12/14 19:20:07, estevenson wrote: > On 2016/12/14 11:40:25, Torne wrote: > > One main ...
4 years ago (2016-12-15 15:58:39 UTC) #25
estevenson
On 2016/12/15 15:58:39, Torne wrote: > On 2016/12/14 19:20:07, estevenson wrote: > > On 2016/12/14 ...
4 years ago (2016-12-15 23:01:22 UTC) #26
Torne
On 2016/12/15 23:01:22, estevenson wrote: > Sounds good, thanks for the advice. I'm thinking I'll ...
4 years ago (2016-12-16 11:39:34 UTC) #27
estevenson
ptal Torne https://codereview.chromium.org/2501193003/diff/240001/base/android/jni_generator/jni_generator_helper.h File base/android/jni_generator/jni_generator_helper.h (right): https://codereview.chromium.org/2501193003/diff/240001/base/android/jni_generator/jni_generator_helper.h#newcode57 base/android/jni_generator/jni_generator_helper.h:57: // The registration type isn't always initialized ...
3 years, 11 months ago (2017-01-09 13:20:00 UTC) #44
Torne
https://codereview.chromium.org/2501193003/diff/240001/base/android/java/src/org/chromium/base/CpuFeatures.java File base/android/java/src/org/chromium/base/CpuFeatures.java (right): https://codereview.chromium.org/2501193003/diff/240001/base/android/java/src/org/chromium/base/CpuFeatures.java#newcode25 base/android/java/src/org/chromium/base/CpuFeatures.java:25: @MainDex Might be cleaner to land the added @MainDex ...
3 years, 11 months ago (2017-01-09 16:43:32 UTC) #45
estevenson
bshe@chromium.org: Please review changes in //third_party/gvr-android-sdk/* https://codereview.chromium.org/2501193003/diff/240001/base/android/java/src/org/chromium/base/CpuFeatures.java File base/android/java/src/org/chromium/base/CpuFeatures.java (right): https://codereview.chromium.org/2501193003/diff/240001/base/android/java/src/org/chromium/base/CpuFeatures.java#newcode25 base/android/java/src/org/chromium/base/CpuFeatures.java:25: @MainDex On 2017/01/09 ...
3 years, 11 months ago (2017-01-12 03:46:49 UTC) #55
Torne
This will clash with https://codereview.chromium.org/2620303004/ which is touching a lot of the same functions.. (though ...
3 years, 11 months ago (2017-01-12 13:48:06 UTC) #56
bshe
On 2017/01/12 13:48:06, Torne wrote: > This will clash with https://codereview.chromium.org/2620303004/ which is > touching ...
3 years, 11 months ago (2017-01-12 16:40:50 UTC) #57
estevenson
ptal torne! This is a little different than what we spoke about offline but I ...
3 years, 10 months ago (2017-01-29 23:31:03 UTC) #67
Torne
This LGTM but it's slightly weird: https://codereview.chromium.org/2501193003/diff/380001/base/android/jni_android.h File base/android/jni_android.h (right): https://codereview.chromium.org/2501193003/diff/380001/base/android/jni_android.h#newcode73 base/android/jni_android.h:73: BASE_EXPORT void DisableManualJniRegistration(); ...
3 years, 10 months ago (2017-01-30 12:29:56 UTC) #68
estevenson
https://codereview.chromium.org/2501193003/diff/380001/base/android/jni_android.h File base/android/jni_android.h (right): https://codereview.chromium.org/2501193003/diff/380001/base/android/jni_android.h#newcode73 base/android/jni_android.h:73: BASE_EXPORT void DisableManualJniRegistration(); On 2017/01/30 12:29:56, Torne wrote: > ...
3 years, 10 months ago (2017-01-30 19:19:27 UTC) #71
Torne
On 2017/01/30 19:19:27, estevenson wrote: > https://codereview.chromium.org/2501193003/diff/380001/base/android/jni_android.h > File base/android/jni_android.h (right): > > https://codereview.chromium.org/2501193003/diff/380001/base/android/jni_android.h#newcode73 > ...
3 years, 10 months ago (2017-01-30 19:21:39 UTC) #72
estevenson
tedchoc@chromium.org: Please review changes in chrome_entry_point.cc, monochrome_entry_point.cc, and ChildProcessServiceImpl.java (+ any comments on the approach ...
3 years, 10 months ago (2017-01-30 23:14:24 UTC) #78
Torne
Thanks, I think this is pretty understandable and reasonable. LGTM :)
3 years, 10 months ago (2017-01-31 11:59:26 UTC) #81
Ted C
lgtm w/ a few small comments https://codereview.chromium.org/2501193003/diff/400001/base/android/java/src/org/chromium/base/JNIUtils.java File base/android/java/src/org/chromium/base/JNIUtils.java (right): https://codereview.chromium.org/2501193003/diff/400001/base/android/java/src/org/chromium/base/JNIUtils.java#newcode40 base/android/java/src/org/chromium/base/JNIUtils.java:40: sSelectiveJniRegistrationEnabled = true; ...
3 years, 10 months ago (2017-01-31 17:56:54 UTC) #82
Torne
https://codereview.chromium.org/2501193003/diff/400001/chrome/browser/android/chrome_entry_point.cc File chrome/browser/android/chrome_entry_point.cc (right): https://codereview.chromium.org/2501193003/diff/400001/chrome/browser/android/chrome_entry_point.cc#newcode32 chrome/browser/android/chrome_entry_point.cc:32: base::android::InitVM(vm); On 2017/01/31 17:56:54, Ted C wrote: > why ...
3 years, 10 months ago (2017-01-31 18:04:50 UTC) #83
estevenson
Thanks for the reviews :) https://codereview.chromium.org/2501193003/diff/400001/base/android/java/src/org/chromium/base/JNIUtils.java File base/android/java/src/org/chromium/base/JNIUtils.java (right): https://codereview.chromium.org/2501193003/diff/400001/base/android/java/src/org/chromium/base/JNIUtils.java#newcode40 base/android/java/src/org/chromium/base/JNIUtils.java:40: sSelectiveJniRegistrationEnabled = true; On ...
3 years, 10 months ago (2017-01-31 18:56:41 UTC) #84
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2501193003/420001
3 years, 10 months ago (2017-01-31 19:37:07 UTC) #87
commit-bot: I haz the power
3 years, 10 months ago (2017-01-31 20:35:36 UTC) #90
Message was sent while issue was closed.
Committed patchset #22 (id:420001) as
https://chromium.googlesource.com/chromium/src/+/5b04fbad6a653550a4540b70c2aa...

Powered by Google App Engine
This is Rietveld 408576698