| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 int request_id() const { return request_id_; } | 104 int request_id() const { return request_id_; } |
| 105 bool path_renamed() const { return path_renamed_; } | 105 bool path_renamed() const { return path_renamed_; } |
| 106 bool in_progress() const { return file_ != NULL; } | 106 bool in_progress() const { return file_ != NULL; } |
| 107 void set_in_progress(bool in_progress) { in_progress_ = in_progress; } | 107 void set_in_progress(bool in_progress) { in_progress_ = in_progress; } |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 // Open or Close the OS file handle. The file is opened in the constructor | 110 // Open or Close the OS file handle. The file is opened in the constructor |
| 111 // based on creation information passed to it, and automatically closed in | 111 // based on creation information passed to it, and automatically closed in |
| 112 // the destructor. | 112 // the destructor. |
| 113 void Close(); | 113 void Close(); |
| 114 bool Open(const wchar_t* open_mode); | 114 bool Open(const char* open_mode); |
| 115 | 115 |
| 116 // OS file handle for writing | 116 // OS file handle for writing |
| 117 FILE* file_; | 117 FILE* file_; |
| 118 | 118 |
| 119 // The unique identifier for this download, assigned at creation by | 119 // The unique identifier for this download, assigned at creation by |
| 120 // the DownloadFileManager for its internal record keeping. | 120 // the DownloadFileManager for its internal record keeping. |
| 121 int id_; | 121 int id_; |
| 122 | 122 |
| 123 // IDs for looking up the tab we are associated with. | 123 // IDs for looking up the tab we are associated with. |
| 124 int render_process_id_; | 124 int render_process_id_; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // Used for progress updates on the UI thread, mapping download->id() to bytes | 264 // Used for progress updates on the UI thread, mapping download->id() to bytes |
| 265 // received so far. Written to by the file thread and read by the UI thread. | 265 // received so far. Written to by the file thread and read by the UI thread. |
| 266 typedef base::hash_map<int, int64> ProgressMap; | 266 typedef base::hash_map<int, int64> ProgressMap; |
| 267 ProgressMap ui_progress_; | 267 ProgressMap ui_progress_; |
| 268 Lock progress_lock_; | 268 Lock progress_lock_; |
| 269 | 269 |
| 270 DISALLOW_EVIL_CONSTRUCTORS(DownloadFileManager); | 270 DISALLOW_EVIL_CONSTRUCTORS(DownloadFileManager); |
| 271 }; | 271 }; |
| 272 | 272 |
| 273 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ | 273 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ |
| OLD | NEW |