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

Unified Diff: base/android/jni_android.h

Issue 330823004: Set chrome thread name in JVM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Define AttachCurrentThreadWithName and call it for all browser threads. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/android/jni_android.cc » ('j') | content/browser/browser_thread_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/jni_android.h
diff --git a/base/android/jni_android.h b/base/android/jni_android.h
index 7a006329b33b40c9640ed72ae54865e4cf43ebe0..faf53b7400bbdecc305db289f470f05f70ab6251 100644
--- a/base/android/jni_android.h
+++ b/base/android/jni_android.h
@@ -8,6 +8,8 @@
#include <jni.h>
#include <sys/types.h>
+#include <string>
+
#include "base/android/scoped_java_ref.h"
#include "base/atomicops.h"
#include "base/base_export.h"
@@ -25,10 +27,17 @@ struct RegistrationMethod {
bool (*func)(JNIEnv* env);
};
-// Attach the current thread to the VM (if necessary) and return the JNIEnv*.
+// Attaches the current thread to the VM (if necessary) and return the JNIEnv*.
BASE_EXPORT JNIEnv* AttachCurrentThread();
-// Detach the current thread from VM if it is attached.
+// Same to AttachCurrentThread except that thread name will be set to
+// |thread_name| if it is the first call. Otherwise, thread_name won't be
+// changed. AttachCurrentThread() doesn't regard underlying platform thread
+// name, but just resets it to "Thread-???". This function should be called
+// right after new thread is created if it is important to keep thread name.
+BASE_EXPORT JNIEnv* AttachCurrentThreadWithName(const std::string& thread_name);
+
+// Detaches the current thread from VM if it is attached.
BASE_EXPORT void DetachFromVM();
// Initializes the global JVM. It is not necessarily called before
« no previous file with comments | « no previous file | base/android/jni_android.cc » ('j') | content/browser/browser_thread_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698