Thursday, February 21, 2013

design a web browser like Chrome

Chrome stores everything in separate process, which implies that the parent process would keep a hashmap of all the processes. The key would be the index and the value would be the process. The process would provide the details with regard to tab-content. Movement of tabs is just swapping of hash-keys.

Each tab is a process and have URL-handler. The handler would call a factory of protocol, such as httpFactory, ftpFactory etc. Each protocol handler has a retrieving-engine and rendering-engine. The browser would retrieve and render using factory.

I cant state definitively how Chrome handles the rendering threads - but I would assume that each tab has its own rendering thread. I wouldnt see the point of going through all the effort of process isolating the tabs, only to tie them all together on a common rendering thread. They would all have the opportunity to interfere with each other.

Don't confuse threads and processes. Each process will have it's own ui thread, but likely also it's own message pump.
Interestingly, using multiple processes means Google Chrome can have its own Task Manager (shown below), which you can get to by right clicking on the browser's title bar.  This Task Manager lets you track resource usage for each web app and plug-in, rather than for the entire browser.  It also lets you kill any web apps or plug-ins that have stopped responding, without having to restart the entire browser.

No comments:

Post a Comment