| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Objects that handle file operations for downloads, on the download thread. | 5 // Objects that handle file operations for downloads, on the download thread. |
| 6 // | 6 // |
| 7 // The DownloadFileManager owns a set of DownloadFile objects, each of which | 7 // The DownloadFileManager owns a set of DownloadFile objects, each of which |
| 8 // represent one in progress download and performs the disk IO for that | 8 // represent one in progress download and performs the disk IO for that |
| 9 // download. The DownloadFileManager itself is a singleton object owned by the | 9 // download. The DownloadFileManager itself is a singleton object owned by the |
| 10 // ResourceDispatcherHost. | 10 // ResourceDispatcherHost. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include <map> | 44 #include <map> |
| 45 #include <vector> | 45 #include <vector> |
| 46 | 46 |
| 47 #include "app/gfx/native_widget_types.h" | 47 #include "app/gfx/native_widget_types.h" |
| 48 #include "base/basictypes.h" | 48 #include "base/basictypes.h" |
| 49 #include "base/file_path.h" | 49 #include "base/file_path.h" |
| 50 #include "base/hash_tables.h" | 50 #include "base/hash_tables.h" |
| 51 #include "base/lock.h" | 51 #include "base/lock.h" |
| 52 #include "base/ref_counted.h" | 52 #include "base/ref_counted.h" |
| 53 #include "base/timer.h" | 53 #include "base/timer.h" |
| 54 #include "chrome/browser/power_save_blocker.h" |
| 54 #include "googleurl/src/gurl.h" | 55 #include "googleurl/src/gurl.h" |
| 55 | 56 |
| 56 namespace net { | 57 namespace net { |
| 57 class IOBuffer; | 58 class IOBuffer; |
| 58 } | 59 } |
| 59 struct DownloadCreateInfo; | 60 struct DownloadCreateInfo; |
| 60 class DownloadManager; | 61 class DownloadManager; |
| 61 class MessageLoop; | 62 class MessageLoop; |
| 62 class ResourceDispatcherHost; | 63 class ResourceDispatcherHost; |
| 63 class URLRequestContext; | 64 class URLRequestContext; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 147 |
| 147 // Full path to the downloaded file. | 148 // Full path to the downloaded file. |
| 148 FilePath full_path_; | 149 FilePath full_path_; |
| 149 | 150 |
| 150 // Whether the download is still using its initial temporary path. | 151 // Whether the download is still using its initial temporary path. |
| 151 bool path_renamed_; | 152 bool path_renamed_; |
| 152 | 153 |
| 153 // Whether the download is still receiving data. | 154 // Whether the download is still receiving data. |
| 154 bool in_progress_; | 155 bool in_progress_; |
| 155 | 156 |
| 157 // RAII handle to keep the system from sleeping while we're downloading. |
| 158 PowerSaveBlocker dont_sleep_; |
| 159 |
| 156 DISALLOW_COPY_AND_ASSIGN(DownloadFile); | 160 DISALLOW_COPY_AND_ASSIGN(DownloadFile); |
| 157 }; | 161 }; |
| 158 | 162 |
| 159 | 163 |
| 160 // DownloadFileManager --------------------------------------------------------- | 164 // DownloadFileManager --------------------------------------------------------- |
| 161 | 165 |
| 162 // Manages all in progress downloads. | 166 // Manages all in progress downloads. |
| 163 class DownloadFileManager | 167 class DownloadFileManager |
| 164 : public base::RefCountedThreadSafe<DownloadFileManager> { | 168 : public base::RefCountedThreadSafe<DownloadFileManager> { |
| 165 public: | 169 public: |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // Used for progress updates on the UI thread, mapping download->id() to bytes | 288 // Used for progress updates on the UI thread, mapping download->id() to bytes |
| 285 // received so far. Written to by the file thread and read by the UI thread. | 289 // received so far. Written to by the file thread and read by the UI thread. |
| 286 typedef base::hash_map<int, int64> ProgressMap; | 290 typedef base::hash_map<int, int64> ProgressMap; |
| 287 ProgressMap ui_progress_; | 291 ProgressMap ui_progress_; |
| 288 Lock progress_lock_; | 292 Lock progress_lock_; |
| 289 | 293 |
| 290 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 294 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
| 291 }; | 295 }; |
| 292 | 296 |
| 293 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 297 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
| OLD | NEW |