Here are some notes about the set of DB messages...
Threading considerations:
Each blink::Document has a dedicated database thread for sqlite3 usage. If
multiple blink::Databases are opened by a document, all of the sqlite3 handles
are used on the same background thread.
The browser process pushes information to the renderer and into blink thru the
WebDatabase static methods. Currently, these methods are invoked on the IPC
thread.
There the relative ordering of the browser to renderer msgs matter:
* DatabaseOpened must preceded DatabaseOpenFile
* DatabaseModified cannot occur after DatabaseClosed
* and of course DatabaseOpened must precede DatabaseClosed
brower->renderer, IPC thread, mostly quota related
BLINK_EXPORT static void UpdateDatabaseSize(const WebSecurityOrigin&,
const WebString& name,
long long size);
BLINK_EXPORT static void CloseDatabaseImmediately(
const WebSecurityOrigin&,
const WebString& database_name);
renderer->browser, background DB threads, mostly vfs related
static blink::Platform::FileHandle DatabaseOpenFile(
const blink::WebString& vfs_file_name,
int desired_flags,
IPC::SyncMessageFilter* sync_message_filter);
static int DatabaseDeleteFile(
const blink::WebString& vfs_file_name,
bool sync_dir,
IPC::SyncMessageFilter* sync_message_filter);
static long DatabaseGetFileAttributes(
const blink::WebString& vfs_file_name,
IPC::SyncMessageFilter* sync_message_filter);
static long long DatabaseGetFileSize(
const blink::WebString& vfs_file_name,
IPC::SyncMessageFilter* sync_message_filter);
static long long DatabaseGetSpaceAvailable(
const blink::WebSecurityOrigin& origin,
IPC::SyncMessageFilter* sync_message_filter);
static bool DatabaseSetFileSize(const blink::WebString& vfs_file_name,
int64_t size,
IPC::SyncMessageFilter* sync_message_filter);
renderer->browser, Mix of main and db threads, the DatabaseObserver messages
virtual void DatabaseOpened(const WebSecurityOrigin&,
const WebString& database_name,
const WebString& database_display_name,
unsigned long estimated_size) = 0;
virtual void DatabaseModified(const WebSecurityOrigin&,
const WebString& database_name) = 0;
virtual void DatabaseClosed(const WebSecurityOrigin&,
const WebString& database_name) = 0;
void HandleSqliteError(origin, string name, int error)
Comment 1 by dcheng@chromium.org
, Aug 21 2017