| OLD | NEW |
| 1 # High-level overview of Save-Page-As code | 1 # High-level overview of Save-Page-As code |
| 2 | 2 |
| 3 This document describes code under `//content/browser/downloads` | 3 This document describes code under `//content/browser/downloads` |
| 4 restricting the scope only to code handling Save-Page-As functionality | 4 restricting the scope only to code handling Save-Page-As functionality |
| 5 (i.e. leaving out other downloads-related code). | 5 (i.e. leaving out other downloads-related code). |
| 6 This document focuses on high-level overview and aspects of the code that | 6 This document focuses on high-level overview and aspects of the code that |
| 7 span multiple compilation units (hoping that individual compilation units | 7 span multiple compilation units (hoping that individual compilation units |
| 8 are described by their code comments or by their code structure). | 8 are described by their code comments or by their code structure). |
| 9 | 9 |
| 10 ## Classes overview | 10 ## Classes overview |
| 11 | 11 |
| 12 * SavePackage class | 12 * SavePackage class |
| 13 * coordinates overall save-page-as request | 13 * coordinates overall save-page-as request |
| 14 * created and owned by `WebContents` | 14 * created and owned by `WebContents` |
| 15 (ref-counted today, but it is unnecessary - see https://crbug.com/596953) | 15 (ref-counted today, but it is unnecessary - see https://crbug.com/596953) |
| 16 * UI-thread object | 16 * UI-thread object |
| 17 | 17 |
| 18 * SaveFileCreateInfo::SaveFileSource enum | 18 * SaveFileCreateInfo::SaveFileSource enum |
| 19 * classifies `SaveItem` and `SaveFile` processing into 2 flavours: | 19 * classifies `SaveItem` and `SaveFile` processing into 2 flavours: |
| 20 * `SAVE_FILE_FROM_NET` (see `SaveFileResourceHandler`) | 20 * `SAVE_FILE_FROM_NET` (see `SaveFileResourceHandler`) |
| 21 * `SAVE_FILE_FROM_DOM` (see "Complete HTML" section below) | 21 * `SAVE_FILE_FROM_DOM` (see "Complete HTML" section below) |
| 22 | 22 |
| 23 * SaveItem class | 23 * SaveItem class |
| 24 * tracks saving a single file | 24 * tracks saving a single file |
| 25 * created and owned by `SavePackage` | 25 * created and owned by `SavePackage` |
| 26 * UI-thread object | 26 * UI-thread object |
| 27 | 27 |
| 28 * SaveFileManager class | 28 * SaveFileManager class |
| 29 * coordinates between FILE and UI threads | 29 * coordinates between the download sequence and the UI thread |
| 30 * Gets requests from `SavePackage` and communicates results back to | 30 * Gets requests from `SavePackage` and communicates results back to |
| 31 `SavePackage` on the UI thread. | 31 `SavePackage` on the UI thread. |
| 32 * Shephards data (received from the network OR from DOM) into | 32 * Shephards data (received from the network OR from DOM) into |
| 33 FILE thread - via `SaveFileManager::UpdateSaveProgress` | 33 the download sequence - via `SaveFileManager::UpdateSaveProgress` |
| 34 * created and owned by `BrowserMainLoop` | 34 * created and owned by `BrowserMainLoop` |
| 35 (ref-counted today, but it is unnecessary - see https://crbug.com/596953) | 35 (ref-counted today, but it is unnecessary - see https://crbug.com/596953) |
| 36 * The global instance can be retrieved by the Get method. | 36 * The global instance can be retrieved by the Get method. |
| 37 | 37 |
| 38 * SaveFile class | 38 * SaveFile class |
| 39 * tracks saving a single file | 39 * tracks saving a single file |
| 40 * created and owned by `SaveFileManager` | 40 * created and owned by `SaveFileManager` |
| 41 * FILE-thread object | 41 * download sequence object |
| 42 | 42 |
| 43 * SaveFileResourceHandler class | 43 * SaveFileResourceHandler class |
| 44 * tracks network downloads + forwards their status into `SaveFileManager` | 44 * tracks network downloads + forwards their status into `SaveFileManager` |
| 45 (onto FILE-thread) | 45 (onto download sequence) |
| 46 * created by `ResourceDispatcherHostImpl::BeginSaveFile` | 46 * created by `ResourceDispatcherHostImpl::BeginSaveFile` |
| 47 * IO-thread object | 47 * IO-thread object |
| 48 | 48 |
| 49 * SaveFileCreateInfo POD struct | 49 * SaveFileCreateInfo POD struct |
| 50 * short-lived object holding data passed to callbacks handling start of | 50 * short-lived object holding data passed to callbacks handling start of |
| 51 saving a file. | 51 saving a file. |
| 52 | 52 |
| 53 * MHTMLGenerationManager class | 53 * MHTMLGenerationManager class |
| 54 * singleton that manages progress of jobs responsible for saving individual | 54 * singleton that manages progress of jobs responsible for saving individual |
| 55 MHTML files (represented by `MHTMLGenerationManager::Job`). | 55 MHTML files (represented by `MHTMLGenerationManager::Job`). |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 * Blink: | 132 * Blink: |
| 133 * `//third_party/WebKit/public/web/WebFrameSerializer...` | 133 * `//third_party/WebKit/public/web/WebFrameSerializer...` |
| 134 * `//third_party/WebKit/Source/web/WebFrameSerializerImpl...` | 134 * `//third_party/WebKit/Source/web/WebFrameSerializerImpl...` |
| 135 (used for Complete HTML today; should use `FrameSerializer` instead in | 135 (used for Complete HTML today; should use `FrameSerializer` instead in |
| 136 the long-term - see https://crbug.com/328354). | 136 the long-term - see https://crbug.com/328354). |
| 137 * `//third_party/WebKit/Source/core/frame/FrameSerializer...` | 137 * `//third_party/WebKit/Source/core/frame/FrameSerializer...` |
| 138 (used for MHTML today) | 138 (used for MHTML today) |
| 139 * `//third_party/WebKit/Source/platform/mhtml/MHTMLArchive...` | 139 * `//third_party/WebKit/Source/platform/mhtml/MHTMLArchive...` |
| 140 | 140 |
| OLD | NEW |