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

Side by Side Diff: content/gpu/in_process_gpu_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 | « no previous file | content/renderer/in_process_renderer_thread.cc » ('j') | 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/gpu/in_process_gpu_thread.h" 5 #include "content/gpu/in_process_gpu_thread.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "content/common/gpu/gpu_memory_buffer_factory.h" 8 #include "content/common/gpu/gpu_memory_buffer_factory.h"
9 #include "content/gpu/gpu_child_thread.h" 9 #include "content/gpu/gpu_child_thread.h"
10 #include "content/gpu/gpu_process.h" 10 #include "content/gpu/gpu_process.h"
11 #include "gpu/command_buffer/service/sync_point_manager.h" 11 #include "gpu/command_buffer/service/sync_point_manager.h"
12 12
13 #if defined(OS_ANDROID)
14 #include "base/android/jni_android.h"
15 #endif
16
13 namespace content { 17 namespace content {
14 18
15 InProcessGpuThread::InProcessGpuThread( 19 InProcessGpuThread::InProcessGpuThread(
16 const InProcessChildThreadParams& params, 20 const InProcessChildThreadParams& params,
17 gpu::SyncPointManager* sync_point_manager_override) 21 gpu::SyncPointManager* sync_point_manager_override)
18 : base::Thread("Chrome_InProcGpuThread"), 22 : base::Thread("Chrome_InProcGpuThread"),
19 params_(params), 23 params_(params),
20 gpu_process_(NULL), 24 gpu_process_(NULL),
21 sync_point_manager_override_(sync_point_manager_override), 25 sync_point_manager_override_(sync_point_manager_override),
22 gpu_memory_buffer_factory_( 26 gpu_memory_buffer_factory_(
23 GpuMemoryBufferFactory::GetNativeType() != gfx::EMPTY_BUFFER 27 GpuMemoryBufferFactory::GetNativeType() != gfx::EMPTY_BUFFER
24 ? GpuMemoryBufferFactory::CreateNativeType() 28 ? GpuMemoryBufferFactory::CreateNativeType()
25 : nullptr) { 29 : nullptr) {
26 if (!sync_point_manager_override_) { 30 if (!sync_point_manager_override_) {
27 sync_point_manager_.reset(new gpu::SyncPointManager(false)); 31 sync_point_manager_.reset(new gpu::SyncPointManager(false));
28 sync_point_manager_override_ = sync_point_manager_.get(); 32 sync_point_manager_override_ = sync_point_manager_.get();
29 } 33 }
30 } 34 }
31 35
32 InProcessGpuThread::~InProcessGpuThread() { 36 InProcessGpuThread::~InProcessGpuThread() {
33 Stop(); 37 Stop();
34 } 38 }
35 39
36 void InProcessGpuThread::Init() { 40 void InProcessGpuThread::Init() {
41 // Call AttachCurrentThreadWithName, before any other AttachCurrentThread()
42 // calls. The latter causes Java VM to assign Thread-??? to the thread name.
43 // Please note calls to AttachCurrentThreadWithName after AttachCurrentThread
44 // will not change the thread name kept in Java VM.
45 #if defined(OS_ANDROID)
46 base::android::AttachCurrentThreadWithName(thread_name());
47 #endif
48
37 gpu_process_ = new GpuProcess(); 49 gpu_process_ = new GpuProcess();
38 50
39 // The process object takes ownership of the thread object, so do not 51 // The process object takes ownership of the thread object, so do not
40 // save and delete the pointer. 52 // save and delete the pointer.
41 GpuChildThread* child_thread = new GpuChildThread( 53 GpuChildThread* child_thread = new GpuChildThread(
42 params_, gpu_memory_buffer_factory_.get(), sync_point_manager_override_); 54 params_, gpu_memory_buffer_factory_.get(), sync_point_manager_override_);
43 55
44 // Since we are in the browser process, use the thread start time as the 56 // Since we are in the browser process, use the thread start time as the
45 // process start time. 57 // process start time.
46 child_thread->Init(base::Time::Now()); 58 child_thread->Init(base::Time::Now());
47 59
48 gpu_process_->set_main_thread(child_thread); 60 gpu_process_->set_main_thread(child_thread);
49 } 61 }
50 62
51 void InProcessGpuThread::CleanUp() { 63 void InProcessGpuThread::CleanUp() {
52 SetThreadWasQuitProperly(true); 64 SetThreadWasQuitProperly(true);
53 delete gpu_process_; 65 delete gpu_process_;
54 } 66 }
55 67
56 base::Thread* CreateInProcessGpuThread( 68 base::Thread* CreateInProcessGpuThread(
57 const InProcessChildThreadParams& params) { 69 const InProcessChildThreadParams& params) {
58 return new InProcessGpuThread(params, nullptr); 70 return new InProcessGpuThread(params, nullptr);
59 } 71 }
60 72
61 } // namespace content 73 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/in_process_renderer_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698