Chromium Code Reviews| 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_file.h" | |
|
Paweł Hajdan Jr.
2011/05/05 20:13:51
Why does this #include download_file? Also, if you
ahendrickson
2011/05/06 16:16:50
Removed the include.
| |
| 51 #include "chrome/browser/download/download_process_handle.h" | |
| 50 #include "ui/gfx/native_widget_types.h" | 52 #include "ui/gfx/native_widget_types.h" |
| 51 | 53 |
| 52 struct DownloadBuffer; | 54 struct DownloadBuffer; |
| 53 struct DownloadCreateInfo; | 55 struct DownloadCreateInfo; |
| 54 struct DownloadSaveInfo; | 56 struct DownloadSaveInfo; |
| 55 class DownloadFile; | 57 class DownloadFile; |
| 56 class DownloadManager; | 58 class DownloadManager; |
| 57 class FilePath; | 59 class FilePath; |
| 58 class GURL; | 60 class GURL; |
| 59 class ResourceDispatcherHost; | 61 class ResourceDispatcherHost; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 void StartUpdateTimer(); | 133 void StartUpdateTimer(); |
| 132 void StopUpdateTimer(); | 134 void StopUpdateTimer(); |
| 133 void UpdateInProgressDownloads(); | 135 void UpdateInProgressDownloads(); |
| 134 | 136 |
| 135 // Clean up helper that runs on the download thread. | 137 // Clean up helper that runs on the download thread. |
| 136 void OnShutdown(); | 138 void OnShutdown(); |
| 137 | 139 |
| 138 // Creates DownloadFile on FILE thread and continues starting the download | 140 // Creates DownloadFile on FILE thread and continues starting the download |
| 139 // process. | 141 // process. |
| 140 void CreateDownloadFile(DownloadCreateInfo* info, | 142 void CreateDownloadFile(DownloadCreateInfo* info, |
| 143 DownloadProcessHandle process, | |
|
Paweł Hajdan Jr.
2011/05/05 20:13:51
nit: Now why not const DownloadProcessHandle& proc
ahendrickson
2011/05/06 16:16:50
Because I need to use non-const member functions.
| |
| 141 DownloadManager* download_manager, | 144 DownloadManager* download_manager, |
| 142 bool hash_needed); | 145 bool hash_needed); |
| 143 | 146 |
| 144 // Tells the ResourceDispatcherHost to resume a download request | 147 // Tells the ResourceDispatcherHost to resume a download request |
| 145 // that was paused to wait for the on-disk file to be created. | 148 // that was paused to wait for the on-disk file to be created. |
| 146 void ResumeDownloadRequest(int child_id, int request_id); | 149 void ResumeDownloadRequest(DownloadProcessHandle process); |
|
Paweł Hajdan Jr.
2011/05/05 20:13:51
nit: Now why not const DownloadProcessHandle& proc
ahendrickson
2011/05/06 16:16:50
Same as above.
| |
| 147 | 150 |
| 148 // Called only on the download thread. | 151 // Called only on the download thread. |
| 149 DownloadFile* GetDownloadFile(int id); | 152 DownloadFile* GetDownloadFile(int id); |
| 150 | 153 |
| 151 // Called only from RenameInProgressDownloadFile and | 154 // Called only from RenameInProgressDownloadFile and |
| 152 // RenameCompletingDownloadFile on the FILE thread. | 155 // RenameCompletingDownloadFile on the FILE thread. |
| 153 void CancelDownloadOnRename(int id); | 156 void CancelDownloadOnRename(int id); |
| 154 | 157 |
| 155 // Erases the download file with the given the download |id| and removes | 158 // Erases the download file with the given the download |id| and removes |
| 156 // it from the maps. | 159 // it from the maps. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 167 // Schedule periodic updates of the download progress. This timer | 170 // Schedule periodic updates of the download progress. This timer |
| 168 // is controlled from the FILE thread, and posts updates to the UI thread. | 171 // is controlled from the FILE thread, and posts updates to the UI thread. |
| 169 base::RepeatingTimer<DownloadFileManager> update_timer_; | 172 base::RepeatingTimer<DownloadFileManager> update_timer_; |
| 170 | 173 |
| 171 ResourceDispatcherHost* resource_dispatcher_host_; | 174 ResourceDispatcherHost* resource_dispatcher_host_; |
| 172 | 175 |
| 173 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 176 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
| 174 }; | 177 }; |
| 175 | 178 |
| 176 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 179 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
| OLD | NEW |