• torne's avatar
    Use combined native/manual JNI registration. · 103bf194
    torne authored
    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
    
    Review URL: https://codereview.chromium.org/920883002
    
    Cr-Commit-Position: refs/heads/master@{#317434}
    103bf194
jni_android.h 5.34 KB