How to find out when an IO thread is created in the Browser Process

76 views
Skip to first unread message

keltion

unread,
Jul 3, 2022, 7:55:08 PM7/3/22
to Chromium-dev
Dear All,

I want to know when an IO thread is created in the Browser Process. It seems that the IO thread is created in the RenderProcessHostImpl object, I wonder how exactly I can find it. 

Could you please let me know if there is any way to solve this question?

Thanks,
keltion

Bruce Dawson

unread,
Jul 4, 2022, 2:28:46 PM7/4/22
to Chromium-dev, chatt...@gmail.com
I put a breakpoint in BrowserThreadImpl::BrowserThreadImpl and then ran Chrome. The first thread created here was the UI thread.  The second one was the IO Thread. This is the call stack that I saw:

     chrome.dll!content::BrowserThreadImpl::BrowserThreadImpl(content::BrowserThread::ID identifier, scoped_refptr<base::SingleThreadTaskRunner> task_runner) Line 104    C++
     chrome.dll!content::BrowserProcessIOThread::RegisterAsBrowserThread() Line 51    C++
>    chrome.dll!content::BrowserMainLoop::CreateThreads() Line 909    C++
     chrome.dll!base::OnceCallback<int ()>::Run() Line 143    C++
     chrome.dll!content::StartupTaskRunner::RunAllTasksNow() Line 43    C++
     chrome.dll!content::BrowserMainLoop::CreateStartupTasks() Line 869    C++
     chrome.dll!content::BrowserMainRunnerImpl::Initialize(content::MainFunctionParams parameters) Line 137    C++
     chrome.dll!content::BrowserMain(content::MainFunctionParams parameters) Line 26    C++

This was on Windows using Visual Studio as the debugger, but the basics should be similar on other operating systems.

So, look in BrowserMainLoop::CreateThreads and maybe you'll find what you are looking for.

Gabriel Charette

unread,
Jul 5, 2022, 5:10:08 PM7/5/22
to bruce...@google.com, Chromium-dev, chatt...@gmail.com
You actually want to look at BrowserTaskExecutor::CreateIOThread() (BrowserProcessIOThread::RegisterAsBrowserThread() is when we register the previously created IO thread as "BrowserThread::IO").

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/ea3d4061-5ea2-445f-a274-2111cde0ff5bn%40chromium.org.

keltion

unread,
Jul 6, 2022, 1:47:50 PM7/6/22
to Chromium-dev, g...@chromium.org, Chromium-dev, keltion, Bruce Dawson
Thank you so much for taking the time to reply. Thanks, my question has been solved :)
2022년 7월 6일 수요일 오전 6시 10분 8초 UTC+9에 g...@chromium.org님이 작성:
Reply all
Reply to author
Forward
0 new messages