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); |