Trace generated JNI functions.

This CL modifies jni_generator to add TRACE_EVENTs to generated
functions when "enable_jni_tracing" GN flag is set to "true".

Tracing events are added as TRACE_EVENT0("jni", <name>), where
<name> is the fully qualified name of the function that is about
to be called. I.e. <name> can be either Java or C++ function name,
depending on the direction of the call. Example:

package com.example;

@JNINamespace("com_example")
public class Foo {
    @CalledByNative
    Foo();
    // TRACE_EVENT0("jni", "com.example.Foo.<init>")

    @CalledByNative
    void callbackFromNative();
    // TRACE_EVENT0("jni", "com.example.Foo.callbackFromNative")

    native void nativeInstanceMethod(long nativeInstance);
    // TRACE_EVENT0("jni", "com_example::Foo::InstanceMethod")

    static native void nativeStaticMethod();
    // TRACE_EVENT0("jni", "com_example::JNI_Foo_StaticMethod")
}

Bug: 842241
Change-Id: Ib110a7070e3d2de05c2090055fb4acc8a6b40e78
Reviewed-on: https://chromium-review.googlesource.com/1064705
Reviewed-by: agrieve <agrieve@chromium.org>
Commit-Queue: Dmitry Skiba <dskiba@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559983}

CrOS-Libchrome-Original-Commit: 72e4521766dcfa34cef6500ff43ae33075978c6b
4 files changed
tree: 0224a1c239b3add870b171ae0f2483791584551b
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/