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

Issue 920883002: Use combined native/manual JNI registration. (Closed)

Created:
5 years, 10 months ago by Torne
Modified:
5 years, 10 months ago
CC:
chromium-reviews, klundberg+watch_chromium.org, erikwright+watch_chromium.org, jbudorick+watch_chromium.org, android-webview-reviews_chromium.org, yfriedman+watch_chromium.org, simonb (inactive)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use combined native/manual JNI registration. Add a new mode to the JNI generator which emits both native JNI exports and manual registration code, and use this as the default mode (except when compiling with clang as a clang bug prevents this from working at present). Native JNI exports are stripped from binaries by default to enforce that the correct manual registration code is called (and to save increasing the dynamic symbol table size), except for binaries that explicitly opt in to using native exports (i.e. libwebviewchromium). Native exports are not compatible with the crazy linker, so cannot be used universally. The WebView-specific call to InitReplacementClassLoader, required by native export mode, has been moved to base to make it easy for other binaries to experiment with that mode. Manual JNI registration can be disabled with a call to base::android::DisableManualJniRegistration at the beginning of JNI_OnLoad and this has been added to WebView. We plan to refactor the Android library entry points to make it possible to avoid needing this flag by just not calling JNI registration but the work is still ongoing; the flag gets us the desired WebView startup time improvement in the meantime. BUG=442327 Committed: https://crrev.com/103bf19477cc121eee7a3c2bdc221f2874c971c3 Cr-Commit-Position: refs/heads/master@{#317434}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Don't set classloader twice in webview #

Patch Set 3 : Rebase and fix overlong line #

Patch Set 4 : Fix overlong line WITHOUT breaking golden test output #

Patch Set 5 : Rebase now that dependent CL is landed #

Patch Set 6 : Add gn support, jni generator test, tidy up, etc #

Patch Set 7 : Rebase again now that second dependent CL is landed #

Patch Set 8 : Add flag to disable manual JNI registration #

Total comments: 7

Patch Set 9 : Factor out common code in test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+155 lines, -10 lines) Patch
M android_webview/lib/main/webview_entry_point.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M android_webview/lib/main/webview_jni_onload_delegate.cc View 1 2 chunks +0 lines, -5 lines 0 comments Download
M android_webview/libwebviewchromium.gypi View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M base/android/base_jni_onload.cc View 1 2 3 4 5 2 chunks +6 lines, -0 lines 0 comments Download
M base/android/jni_android.h View 1 2 3 4 5 6 7 1 chunk +7 lines, -0 lines 0 comments Download
M base/android/jni_android.cc View 1 2 3 4 5 6 7 2 chunks +11 lines, -0 lines 0 comments Download
M base/android/jni_generator/jni_generator.py View 1 2 3 4 5 6 7 5 chunks +15 lines, -3 lines 0 comments Download
M base/android/jni_generator/jni_generator_tests.py View 1 2 3 4 5 6 7 8 3 chunks +12 lines, -2 lines 0 comments Download
A + base/android/jni_generator/testNativeExportsOptionalOption.golden View 1 2 3 4 5 6 7 1 chunk +69 lines, -0 lines 0 comments Download
M build/config/android/rules.gni View 1 2 3 4 5 2 chunks +12 lines, -0 lines 0 comments Download
M build/jar_file_jni_generator.gypi View 1 2 3 4 5 1 chunk +8 lines, -0 lines 0 comments Download
M build/jni_generator.gypi View 1 2 3 4 5 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 27 (5 generated)
Torne
This is not ready for review and currently incorporates several other inflight CLs for easy ...
5 years, 10 months ago (2015-02-12 18:28:50 UTC) #1
michaelbai
https://codereview.chromium.org/920883002/diff/1/base/android/base_jni_onload.cc File base/android/base_jni_onload.cc (right): https://codereview.chromium.org/920883002/diff/1/base/android/base_jni_onload.cc#newcode53 base/android/base_jni_onload.cc:53: base::android::GetClassLoader(env)); Move this to BaseJNIOnLoadDelegate::Init()
5 years, 10 months ago (2015-02-13 04:36:07 UTC) #3
Torne
https://codereview.chromium.org/920883002/diff/1/base/android/base_jni_onload.cc File base/android/base_jni_onload.cc (right): https://codereview.chromium.org/920883002/diff/1/base/android/base_jni_onload.cc#newcode53 base/android/base_jni_onload.cc:53: base::android::GetClassLoader(env)); On 2015/02/13 04:36:07, michaelbai wrote: > Move this ...
5 years, 10 months ago (2015-02-13 14:08:04 UTC) #4
Torne
The clang failure appears to be a clang bug - it believes the functions in ...
5 years, 10 months ago (2015-02-13 14:09:18 UTC) #5
Torne
On 2015/02/13 14:09:18, Torne wrote: > The clang failure appears to be a clang bug ...
5 years, 10 months ago (2015-02-16 14:58:11 UTC) #6
Torne
On 2015/02/13 04:36:07, michaelbai wrote: > https://codereview.chromium.org/920883002/diff/1/base/android/base_jni_onload.cc > File base/android/base_jni_onload.cc (right): > > https://codereview.chromium.org/920883002/diff/1/base/android/base_jni_onload.cc#newcode53 > ...
5 years, 10 months ago (2015-02-20 10:43:36 UTC) #7
Torne
Not quite finished with this yet, still need to add some mechanism to skip doing ...
5 years, 10 months ago (2015-02-20 11:52:11 UTC) #9
Torne
Oh also this still includes the dependent CL https://codereview.chromium.org/938373002/ - will rebase to eliminate that ...
5 years, 10 months ago (2015-02-20 11:52:40 UTC) #10
Torne
On 2015/02/20 11:52:40, Torne wrote: > Oh also this still includes the dependent CL > ...
5 years, 10 months ago (2015-02-20 13:34:49 UTC) #11
Torne
+cjhopman to cover remaining OWNERS Chris, Ross, Michael, this is now ready for review and ...
5 years, 10 months ago (2015-02-20 14:12:50 UTC) #13
Torne
5 years, 10 months ago (2015-02-20 14:37:41 UTC) #14
Torne
android_chromium_gn_compile_rel failure is https://code.google.com/p/chromium/issues/detail?id=460463 (infra problem).
5 years, 10 months ago (2015-02-20 14:53:16 UTC) #15
Torne
Tested component and non-component builds of content shell, chrome shell, and webview shell; they all ...
5 years, 10 months ago (2015-02-20 15:21:15 UTC) #16
rmcilroy
A couple of nits, but LGTM, thanks! https://codereview.chromium.org/920883002/diff/140001/base/android/jni_generator/jni_generator.py File base/android/jni_generator/jni_generator.py (right): https://codereview.chromium.org/920883002/diff/140001/base/android/jni_generator/jni_generator.py#newcode925 base/android/jni_generator/jni_generator.py:925: ${EARLY_EXIT}${CLASSES} On ...
5 years, 10 months ago (2015-02-20 17:19:35 UTC) #17
cjhopman
lgtm. The gn failure is a flake. https://codereview.chromium.org/920883002/diff/140001/base/android/jni_android.h File base/android/jni_android.h (right): https://codereview.chromium.org/920883002/diff/140001/base/android/jni_android.h#newcode25 base/android/jni_android.h:25: // JNI ...
5 years, 10 months ago (2015-02-20 19:11:55 UTC) #18
Torne
On 2015/02/20 19:11:55, cjhopman wrote: > lgtm. The gn failure is a flake. > > ...
5 years, 10 months ago (2015-02-20 19:17:44 UTC) #19
Torne
On 2015/02/20 19:17:44, Torne wrote: > On 2015/02/20 19:11:55, cjhopman wrote: > > lgtm. The ...
5 years, 10 months ago (2015-02-20 19:18:28 UTC) #20
Torne
I've now completed a fairly long run of chrome_shell startup tests with and without this ...
5 years, 10 months ago (2015-02-20 21:35:30 UTC) #21
Torne
I will take care of all the formatting/indentation in the JNI generator in a followup ...
5 years, 10 months ago (2015-02-20 21:53:46 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/920883002/160001
5 years, 10 months ago (2015-02-20 21:54:29 UTC) #25
commit-bot: I haz the power
Committed patchset #9 (id:160001)
5 years, 10 months ago (2015-02-20 23:06:51 UTC) #26
commit-bot: I haz the power
5 years, 10 months ago (2015-02-20 23:07:33 UTC) #27
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/103bf19477cc121eee7a3c2bdc221f2874c971c3
Cr-Commit-Position: refs/heads/master@{#317434}

Powered by Google App Engine
This is Rietveld 408576698