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

Unified Diff: content/browser/browser_thread_impl.cc

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 | « base/android/jni_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_thread_impl.cc
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc
index d3c416d687f5a8986d107b2969f153cb96cdffad..641056ffb7869b7d3f4019d3b1f6388d1fc48f00 100644
--- a/content/browser/browser_thread_impl.cc
+++ b/content/browser/browser_thread_impl.cc
@@ -16,6 +16,10 @@
#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_thread_delegate.h"
+#if defined(OS_ANDROID)
+#include "base/android/jni_android.h"
+#endif
+
namespace content {
namespace {
@@ -218,6 +222,15 @@ MSVC_POP_WARNING()
MSVC_ENABLE_OPTIMIZE();
void BrowserThreadImpl::Run(base::MessageLoop* message_loop) {
+#if defined(OS_ANDROID)
+ // Not to reset thread name to "Thread-???" by VM, attach VM with thread name.
sky 2014/06/19 20:48:17 This comment makes no sense.
byungchul 2014/06/19 20:56:30 Otherwise, VM resets thread name.
+ // Though it may create unnecessary VM thread objects, keeping thread name
+ // gives more benefit in debugging in the platform.
+ if (!thread_name().empty()) {
+ base::android::AttachCurrentThreadWithName(thread_name());
sky 2014/06/19 20:48:17 I'm not familiar with thread_name(). Isn't it prop
byungchul 2014/06/19 20:56:30 Yes, but jvm's AttachCurrentThread() resets thread
+ }
+#endif
+
BrowserThread::ID thread_id = ID_COUNT;
if (!GetCurrentThreadIdentifier(&thread_id))
return Thread::Run(message_loop);
« no previous file with comments | « base/android/jni_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698