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_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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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, |
| 141 DownloadManager* download_manager, | 142 DownloadManager* download_manager, |
| 142 bool hash_needed); | 143 bool hash_needed); |
| 143 | 144 |
| 144 // Tells the ResourceDispatcherHost to resume a download request | 145 // Tells the ResourceDispatcherHost to resume a download request |
| 145 // that was paused to wait for the on-disk file to be created. | 146 // that was paused to wait for the on-disk file to be created. |
| 146 void ResumeDownloadRequest(int child_id, int request_id); | 147 void ResumeDownloadRequest(DownloadProcessHandle process); |
|
Paweł Hajdan Jr.
2011/05/09 19:47:31
nit: Why not a pointer?
ahendrickson
2011/05/10 18:04:43
Because it's called from other threads, and this w
Paweł Hajdan Jr.
2011/05/10 18:58:04
I see, makes sense. Could you add a short comment
| |
| 147 | 148 |
| 148 // Called only on the download thread. | 149 // Called only on the download thread. |
| 149 DownloadFile* GetDownloadFile(int id); | 150 DownloadFile* GetDownloadFile(int id); |
| 150 | 151 |
| 151 // Called only from RenameInProgressDownloadFile and | 152 // Called only from RenameInProgressDownloadFile and |
| 152 // RenameCompletingDownloadFile on the FILE thread. | 153 // RenameCompletingDownloadFile on the FILE thread. |
| 153 void CancelDownloadOnRename(int id); | 154 void CancelDownloadOnRename(int id); |
| 154 | 155 |
| 155 // Erases the download file with the given the download |id| and removes | 156 // Erases the download file with the given the download |id| and removes |
| 156 // it from the maps. | 157 // it from the maps. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 167 // Schedule periodic updates of the download progress. This timer | 168 // Schedule periodic updates of the download progress. This timer |
| 168 // is controlled from the FILE thread, and posts updates to the UI thread. | 169 // is controlled from the FILE thread, and posts updates to the UI thread. |
| 169 base::RepeatingTimer<DownloadFileManager> update_timer_; | 170 base::RepeatingTimer<DownloadFileManager> update_timer_; |
| 170 | 171 |
| 171 ResourceDispatcherHost* resource_dispatcher_host_; | 172 ResourceDispatcherHost* resource_dispatcher_host_; |
| 172 | 173 |
| 173 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 174 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
| 174 }; | 175 }; |
| 175 | 176 |
| 176 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ | 177 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ |
| OLD | NEW |