In an extension that uses the native-messaging API to communicate with a C application compiled with SQLite, a browser action button permits the user to open the extension UI, which consists of extension pages only, in multiple tabs.
It is never necessary for the user to open the same extension page in more than one tab but, if it is the user’s preferred method of organization, it will provide something like multiple views of the same SQLite database across multiple tabs instead of within the same single tab.
So, I assume, each browser tab has its own connection to the database. My question is does each browser tab have its own instance of the native C application also?
For example, suppose there is a global variable in RAM in the C application that is incremented each time a message is received from the extension, will the same variable be incremented regardless of which browser tab posted the message or will each tab have its own global variable and count?
I’m not trying to count messages but am using this as an example only to try to understand how the native application is used when there are multiple browser tabs loaded with the same extension page.
Also, is it accurate that regardless of how many browser tabs may be opened with the extension pages loaded and multipe connections to the same SQLite database, it would never be considered a multiple-thread scenario, such that it would always be safe to compile SQLite without the thread-safe option?