OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // The DownloadFileManager owns a set of DownloadFile objects, each of which | 5 // The DownloadFileManager owns a set of DownloadFile objects, each of which |
6 // represent one in progress download and performs the disk IO for that | 6 // represent one in progress download and performs the disk IO for that |
7 // download. The DownloadFileManager itself is a singleton object owned by the | 7 // download. The DownloadFileManager itself is a singleton object owned by the |
8 // ResourceDispatcherHost. | 8 // ResourceDispatcherHost. |
9 // | 9 // |
10 // The DownloadFileManager uses the file_thread for performing file write | 10 // The DownloadFileManager uses the file_thread for performing file write |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void StartUpdateTimer(); | 108 void StartUpdateTimer(); |
109 void StopUpdateTimer(); | 109 void StopUpdateTimer(); |
110 void UpdateInProgressDownloads(); | 110 void UpdateInProgressDownloads(); |
111 | 111 |
112 // Clean up helper that runs on the download thread. | 112 // Clean up helper that runs on the download thread. |
113 void OnShutdown(); | 113 void OnShutdown(); |
114 | 114 |
115 // Creates DownloadFile on FILE thread and continues starting the download | 115 // Creates DownloadFile on FILE thread and continues starting the download |
116 // process. | 116 // process. |
117 void CreateDownloadFile(DownloadCreateInfo* info, | 117 void CreateDownloadFile(DownloadCreateInfo* info, |
118 DownloadManager* download_manager); | 118 DownloadManager* download_manager, |
| 119 bool hash_needed); |
119 | 120 |
120 // Tells the ResourceDispatcherHost to resume a download request | 121 // Tells the ResourceDispatcherHost to resume a download request |
121 // that was paused to wait for the on-disk file to be created. | 122 // that was paused to wait for the on-disk file to be created. |
122 void ResumeDownloadRequest(int child_id, int request_id); | 123 void ResumeDownloadRequest(int child_id, int request_id); |
123 | 124 |
124 // Called only on the download thread. | 125 // Called only on the download thread. |
125 DownloadFile* GetDownloadFile(int id); | 126 DownloadFile* GetDownloadFile(int id); |
126 | 127 |
127 // Called only from OnFinalDownloadName or OnIntermediateDownloadName | 128 // Called only from OnFinalDownloadName or OnIntermediateDownloadName |
128 // on the FILE thread. | 129 // on the FILE thread. |
129 void CancelDownloadOnRename(int id); | 130 void CancelDownloadOnRename(int id); |
130 | 131 |
131 // Unique ID for each DownloadFile. | 132 // Unique ID for each DownloadFile. |
132 int next_id_; | 133 int next_id_; |
133 | 134 |
134 // A map of all in progress downloads. | 135 // A map of all in progress downloads. |
135 typedef base::hash_map<int, DownloadFile*> DownloadFileMap; | 136 typedef base::hash_map<int, DownloadFile*> DownloadFileMap; |
136 DownloadFileMap downloads_; | 137 DownloadFileMap downloads_; |
137 | 138 |
138 // Schedule periodic updates of the download progress. This timer | 139 // Schedule periodic updates of the download progress. This timer |
139 // is controlled from the FILE thread, and posts updates to the UI thread. | 140 // is controlled from the FILE thread, and posts updates to the UI thread. |
140 base::RepeatingTimer<DownloadFileManager> update_timer_; | 141 base::RepeatingTimer<DownloadFileManager> update_timer_; |
141 | 142 |
142 ResourceDispatcherHost* resource_dispatcher_host_; | 143 ResourceDispatcherHost* resource_dispatcher_host_; |
143 | 144 |
144 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 145 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
145 }; | 146 }; |
146 | 147 |
147 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 148 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
OLD | NEW |