Bug 1371838 - register the WR thread pool's thread to gecko profiler. r=jrmuizel

MozReview-Commit-ID: BUyTq2vz3cO
This commit is contained in:
JerryShih 2017-11-11 18:57:31 +08:00
parent 8b031732c0
commit 56d6261465

View File

@ -597,9 +597,14 @@ pub struct WrThreadPool(Arc<rayon::ThreadPool>);
#[no_mangle]
pub unsafe extern "C" fn wr_thread_pool_new() -> *mut WrThreadPool {
let worker_config = rayon::Configuration::new()
.thread_name(|idx|{ format!("WebRender:Worker#{}", idx) })
.thread_name(|idx|{ format!("WRWorker#{}", idx) })
.start_handler(|idx| {
register_thread_with_profiler(format!("WebRender:Worker#{}", idx));
let name = format!("WRWorker#{}", idx);
register_thread_with_profiler(name.clone());
gecko_profiler_register_thread(CString::new(name).unwrap().as_ptr());
})
.exit_handler(|_idx| {
gecko_profiler_unregister_thread();
});
let workers = Arc::new(rayon::ThreadPool::new(worker_config).unwrap());