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

Side by Side Diff: content/renderer/in_process_renderer_thread.cc

Issue 1518213002: Assign thread name to in_proc renderer and gpu thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Gpu thread too Created 5 years 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 unified diff | Download patch
« no previous file with comments | « content/gpu/in_process_gpu_thread.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/in_process_renderer_thread.h" 5 #include "content/renderer/in_process_renderer_thread.h"
6 6
7 #include "content/renderer/render_process.h" 7 #include "content/renderer/render_process.h"
8 #include "content/renderer/render_process_impl.h" 8 #include "content/renderer/render_process_impl.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 10
11 #if defined(OS_ANDROID)
12 #include "base/android/jni_android.h"
13 #endif
14
11 namespace content { 15 namespace content {
12 16
13 InProcessRendererThread::InProcessRendererThread( 17 InProcessRendererThread::InProcessRendererThread(
14 const InProcessChildThreadParams& params) 18 const InProcessChildThreadParams& params)
15 : Thread("Chrome_InProcRendererThread"), params_(params) { 19 : Thread("Chrome_InProcRendererThread"), params_(params) {
16 } 20 }
17 21
18 InProcessRendererThread::~InProcessRendererThread() { 22 InProcessRendererThread::~InProcessRendererThread() {
19 Stop(); 23 Stop();
20 } 24 }
21 25
22 void InProcessRendererThread::Init() { 26 void InProcessRendererThread::Init() {
27 // Call AttachCurrentThreadWithName, before any other AttachCurrentThread()
28 // calls. The latter causes Java VM to assign Thread-??? to the thread name.
29 // Please note calls to AttachCurrentThreadWithName after AttachCurrentThread
30 // will not change the thread name kept in Java VM.
31 #if defined(OS_ANDROID)
32 base::android::AttachCurrentThreadWithName(thread_name());
33 #endif
23 render_process_.reset(new RenderProcessImpl()); 34 render_process_.reset(new RenderProcessImpl());
24 RenderThreadImpl::Create(params_); 35 RenderThreadImpl::Create(params_);
25 } 36 }
26 37
27 void InProcessRendererThread::CleanUp() { 38 void InProcessRendererThread::CleanUp() {
28 render_process_.reset(); 39 render_process_.reset();
29 40
30 // It's a little lame to manually set this flag. But the single process 41 // It's a little lame to manually set this flag. But the single process
31 // RendererThread will receive the WM_QUIT. We don't need to assert on 42 // RendererThread will receive the WM_QUIT. We don't need to assert on
32 // this thread, so just force the flag manually. 43 // this thread, so just force the flag manually.
33 // If we want to avoid this, we could create the InProcRendererThread 44 // If we want to avoid this, we could create the InProcRendererThread
34 // directly with _beginthreadex() rather than using the Thread class. 45 // directly with _beginthreadex() rather than using the Thread class.
35 // We used to set this flag in the Init function above. However there 46 // We used to set this flag in the Init function above. However there
36 // other threads like WebThread which are created by this thread 47 // other threads like WebThread which are created by this thread
37 // which resets this flag. Please see Thread::StartWithOptions. Setting 48 // which resets this flag. Please see Thread::StartWithOptions. Setting
38 // this flag to true in Cleanup works around these problems. 49 // this flag to true in Cleanup works around these problems.
39 SetThreadWasQuitProperly(true); 50 SetThreadWasQuitProperly(true);
40 } 51 }
41 52
42 base::Thread* CreateInProcessRendererThread( 53 base::Thread* CreateInProcessRendererThread(
43 const InProcessChildThreadParams& params) { 54 const InProcessChildThreadParams& params) {
44 return new InProcessRendererThread(params); 55 return new InProcessRendererThread(params);
45 } 56 }
46 57
47 } // namespace content 58 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/in_process_gpu_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698