OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 29 matching lines...) Expand all Loading... | |
40 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 40 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
41 #pragma once | 41 #pragma once |
42 | 42 |
43 #include <map> | 43 #include <map> |
44 | 44 |
45 #include "base/basictypes.h" | 45 #include "base/basictypes.h" |
46 #include "base/gtest_prod_util.h" | 46 #include "base/gtest_prod_util.h" |
47 #include "base/hash_tables.h" | 47 #include "base/hash_tables.h" |
48 #include "base/memory/ref_counted.h" | 48 #include "base/memory/ref_counted.h" |
49 #include "base/timer.h" | 49 #include "base/timer.h" |
50 #include "chrome/browser/download/download_process_handle.h" | |
50 #include "ui/gfx/native_widget_types.h" | 51 #include "ui/gfx/native_widget_types.h" |
51 | 52 |
52 struct DownloadBuffer; | 53 struct DownloadBuffer; |
53 struct DownloadCreateInfo; | 54 struct DownloadCreateInfo; |
54 struct DownloadSaveInfo; | 55 struct DownloadSaveInfo; |
55 class DownloadFile; | 56 class DownloadFile; |
56 class DownloadManager; | 57 class DownloadManager; |
57 class FilePath; | 58 class FilePath; |
58 class GURL; | 59 class GURL; |
59 class ResourceDispatcherHost; | 60 class ResourceDispatcherHost; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 void StartUpdateTimer(); | 132 void StartUpdateTimer(); |
132 void StopUpdateTimer(); | 133 void StopUpdateTimer(); |
133 void UpdateInProgressDownloads(); | 134 void UpdateInProgressDownloads(); |
134 | 135 |
135 // Clean up helper that runs on the download thread. | 136 // Clean up helper that runs on the download thread. |
136 void OnShutdown(); | 137 void OnShutdown(); |
137 | 138 |
138 // Creates DownloadFile on FILE thread and continues starting the download | 139 // Creates DownloadFile on FILE thread and continues starting the download |
139 // process. | 140 // process. |
140 void CreateDownloadFile(DownloadCreateInfo* info, | 141 void CreateDownloadFile(DownloadCreateInfo* info, |
142 DownloadProcessHandle process, | |
141 DownloadManager* download_manager, | 143 DownloadManager* download_manager, |
142 bool hash_needed); | 144 bool hash_needed); |
143 | 145 |
144 // Tells the ResourceDispatcherHost to resume a download request | 146 // Tells the ResourceDispatcherHost to resume a download request |
145 // that was paused to wait for the on-disk file to be created. | 147 // that was paused to wait for the on-disk file to be created. |
146 void ResumeDownloadRequest(int child_id, int request_id); | 148 void ResumeDownloadRequest(DownloadProcessHandle process); |
Randy Smith (Not in Mondays)
2011/05/05 20:25:34
I'd suggest folding this routine into DownloadProc
| |
147 | 149 |
148 // Called only on the download thread. | 150 // Called only on the download thread. |
149 DownloadFile* GetDownloadFile(int id); | 151 DownloadFile* GetDownloadFile(int id); |
150 | 152 |
151 // Called only from RenameInProgressDownloadFile and | 153 // Called only from RenameInProgressDownloadFile and |
152 // RenameCompletingDownloadFile on the FILE thread. | 154 // RenameCompletingDownloadFile on the FILE thread. |
153 void CancelDownloadOnRename(int id); | 155 void CancelDownloadOnRename(int id); |
154 | 156 |
155 // Erases the download file with the given the download |id| and removes | 157 // Erases the download file with the given the download |id| and removes |
156 // it from the maps. | 158 // it from the maps. |
(...skipping 10 matching lines...) Expand all Loading... | |
167 // Schedule periodic updates of the download progress. This timer | 169 // Schedule periodic updates of the download progress. This timer |
168 // is controlled from the FILE thread, and posts updates to the UI thread. | 170 // is controlled from the FILE thread, and posts updates to the UI thread. |
169 base::RepeatingTimer<DownloadFileManager> update_timer_; | 171 base::RepeatingTimer<DownloadFileManager> update_timer_; |
170 | 172 |
171 ResourceDispatcherHost* resource_dispatcher_host_; | 173 ResourceDispatcherHost* resource_dispatcher_host_; |
172 | 174 |
173 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 175 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
174 }; | 176 }; |
175 | 177 |
176 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 178 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
OLD | NEW |