Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start "Chrome" (or equivalent) as a thread instead of process?

We have an app, which is written in Qt/C++. Its GUI is in Html/Css/JS.

The app works well on the Chrome & Edge. On desktops, the app invokes the OS browser as a separate process. The browser connects via Websocket to the app and exchange the messages for the display purposes. This works well.

However, this doesn't work in the mobiles. Because invoking a browser as a separate process, would send the actual app to background in Android & iOS.
Now many answers on SO suggests to use the mobile webview, which comes built-in. But, the Webview in Android doesn't fulfill all the requirements in all the devices. And the iOS Webview is simply substandard & weak.

Question: Is there a way to start any chrome-like browser as a thread of the app itself?

The intention is to keep the app in the foreground without compromising on the Webview limitations. Fine with source code integration & compilation, if required.

like image 602
iammilind Avatar asked May 21 '20 04:05

iammilind


People also ask

How do I run Chrome as a different user?

Here’s how to do the same with that. If you have a shortcut to Chrome on your desktop (not your task bar), skip ahead to step two. 1. Search “Chrome” from the start menu, right click and select “Open File Location” 2. Hold “Shift” on your keyboard and right-click the Internet Explorer icon. Select “run as different user” 3.

Can you open multiple tabs from the same window in chrome?

on Chrome you can open multiple windows or different processes, but from the same window you can only open tabs related to that one. Anyone figure this out? It's driving me nuts. Every time I search from the address bar Chrome opens the search results in a new window.

What is the difference between Google Chrome and Internet Explorer?

In short IE is made by Microsoft and so is excel and they can interact but Google chrome is independent of Microsoft and not as compatible. What's wrong with using IE for the instance mentioned above?


Video Answer


1 Answers

Web engines are the the driving bodies for how a browser runs. As chrome is based on chromium web engine you need to modify the engine accordingly.

Chrome uses process for each tab while Firefox uses a thread instead.

Chrome architecture has two main processes Browser Process and Renderer Process. Browser UI is running in Browser Process and When you open new tab in Chrome browser, for each tab a new process is gets created called as Renderer Process. Renderer process handles rendering of your HTML contents.

Suppose you have opened 10 tabs in your chrome which leads to creation of 10 Renderer process and 1 browser process.

Why separate Renderer process for each tab ?

Suppose at any point of time while browsing through internet because of some reason some tab crashed, then only that renderer process gets killed and other process are still alive. Your 9 tabs are still responsive and working. As browser UI is running in different process. Browser UI wont get hanged in general and its responsive enough. As each renderer is running as different process, shared data access is difficult(thread can access shared data) which provides inter tab data security. There are many other process running on and having there own purpose.

like image 105
Nikhil Ghule Avatar answered Oct 24 '22 04:10

Nikhil Ghule