Document my current understanding

This commit is contained in:
Manav Rathi 2024-03-20 13:17:41 +05:30
parent 467acf2b8e
commit 4c651da244
No known key found for this signature in database

View file

@ -379,8 +379,29 @@ setupLogging();
// - ContextIsolation:
// https://www.electronjs.org/docs/latest/tutorial/context-isolation
//
// - IPC
// https://www.electronjs.org/docs/latest/tutorial/ipc
// - IPC https://www.electronjs.org/docs/latest/tutorial/ipc
//
//
// [Note: Transferring Files over IPC]
//
// Electron's IPC implementation uses the HTML standard Structured Clone
// Algorithm to serialize objects passed between processes. [1]
// https://www.electronjs.org/docs/latest/tutorial/ipc#object-serialization
//
// In particular, both ArrayBuffer and the web File types can be passed.
// https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
//
// Also, ArrayBuffer is "transferable", which means it is a zero-copy operation
// operation when it happens across threads.
// https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects
//
// In our case though, we're not dealing with threads but separate processes, so
// I'm not yet aware if the transfer involves copying or not. I haven't found
// any explicit documentation stating one way or the other.
//
// Closest is a note from one of the Electron committers stating that even with
// copying, the IPC should be fast enough for even moderately large data:
// https://github.com/electron/electron/issues/1948#issuecomment-864191345
//
contextBridge.exposeInMainWorld("ElectronAPIs", {
exists,