summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_thread_impl.cc
diff options
context:
space:
mode:
authorbyungchul@chromium.org <byungchul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-20 00:38:19 +0000
committerbyungchul@chromium.org <byungchul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-20 00:38:19 +0000
commitf3225bdbd75f7df42e33f13d67d58f21a90b266d (patch)
treeb7d056b1c71cffaa36de1cbaf73f12dcea17def6 /content/browser/browser_thread_impl.cc
parentcc2246cfdf5fdc114c951ec4ed6fe2fd6b357c03 (diff)
downloadchromium_src-f3225bdbd75f7df42e33f13d67d58f21a90b266d.zip
chromium_src-f3225bdbd75f7df42e33f13d67d58f21a90b266d.tar.gz
chromium_src-f3225bdbd75f7df42e33f13d67d58f21a90b266d.tar.bz2
Set chrome thread name in JVM.
JVM's AttachCurrentThread() resets thread name if the caller doesn't pass thread name. Pass it first time call of AttachCurrentThread(). Not call next times to reduce syscall (prctl) overhead. BUG=384603 Review URL: https://codereview.chromium.org/330823004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278551 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_thread_impl.cc')
-rw-r--r--content/browser/browser_thread_impl.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc
index d3c416d..641056f 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.
+ // 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());
+ }
+#endif
+
BrowserThread::ID thread_id = ID_COUNT;
if (!GetCurrentThreadIdentifier(&thread_id))
return Thread::Run(message_loop);