You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(explainer): add alternatives considered section
* Introduce "Alternatives Considered" section in the explainer.
* Discuss the implications of using dataTransfer.items with File objects.
* Highlight the advantages of the DownloadURL model for memory efficiency.
-[Using dataTransfer.items with File objects](#using-datatransferitems-with-file-objects)
30
32
-[Acknowledgements](#acknowledgements)
31
33
-[References](#references)
32
34
@@ -38,7 +40,7 @@ The `DownloadURL` drag type is a Chromium‑specific drag‑and‑drop mechanism
38
40
39
41
# Goals
40
42
41
-
Enable users to drag multiple files from Chromium to a desktop folder on Windows using the `DownloadURL-list` drag type.
43
+
Enable users to drag multiple files from Chromium to a desktop folder using the `DownloadURL-list` drag type.
42
44
43
45
# Non-goals
44
46
@@ -224,11 +226,27 @@ If the user does not consent to multiple downloads, the entire set of dragged fi
224
226
225
227
A single-click option should be provided in the Chrome UI (download bubble and `chrome://downloads`) to allow users to easily remove all downloaded files from their device if they no longer want them or downloaded them by mistake.
226
228
229
+
# Alternatives Considered
230
+
231
+
## Using `dataTransfer.items` with `File` objects
232
+
233
+
The `DownloadURL` drag type follows a file download model: the dragged URL is materialized as a local file during the drop operation, but the exact behavior differs across operating systems.
234
+
235
+
For example:
236
+
* Windows: Chromium uses delayed rendering: it registers a placeholder at drag-start with no actual file path. When the user drops onto the file manager, it requests the file data which triggers Chromium to start downloading the URL. The file manager waits asynchronously until the download completes, then retrieves the real file path and copies the file to the target folder.
237
+
* Linux: A similar approach can be used by materializing the file and exposing it via text/uri-list with file:// URIs, but it works synchronously, so the drop target can freeze during the drop operation.
238
+
* macOS: macOS uses a promised file model, where the drop target determines the destination path. After the drop, the drag source materializes the file directly at that location. Unlike Windows and Linux, this avoids creating a temporary file and eliminates the need for an additional copy step.
239
+
240
+
If we instead used `dataTransfer.items` with `File` objects, the entire file content would need to be loaded into memory before the drag starts. The drop target would then need to materialize the `File` object into an actual file on disk, which is synchronous work that blocks the drop operation. This is impractical for large files or multiple files.
241
+
242
+
The `DownloadURL` model avoids this by deferring file materialization to disk and transferring a file path to the operating system. This keeps memory usage bounded and avoids requiring the renderer to hold the entire file content in memory during the drag operation.
243
+
227
244
# Acknowledgements
228
245
Many thanks for valuable feedback and advice from:
0 commit comments