Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(916)

Side by Side Diff: chrome/browser/download/download_file_manager.h

Issue 7237034: sql::MetaTable.next_download_id, DownloadManager::GetNextId() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: DownloadPrefs::GetNextId() Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // Manages all in progress downloads. 66 // Manages all in progress downloads.
67 class DownloadFileManager 67 class DownloadFileManager
68 : public base::RefCountedThreadSafe<DownloadFileManager> { 68 : public base::RefCountedThreadSafe<DownloadFileManager> {
69 public: 69 public:
70 explicit DownloadFileManager(ResourceDispatcherHost* rdh); 70 explicit DownloadFileManager(ResourceDispatcherHost* rdh);
71 71
72 // Called on shutdown on the UI thread. 72 // Called on shutdown on the UI thread.
73 void Shutdown(); 73 void Shutdown();
74 74
75 // Called on the IO thread
76 int GetNextId();
77
78 // Called on UI thread to make DownloadFileManager start the download. 75 // Called on UI thread to make DownloadFileManager start the download.
79 void StartDownload(DownloadCreateInfo* info); 76 void StartDownload(DownloadCreateInfo* info);
80 77
81 // Handlers for notifications sent from the IO thread and run on the 78 // Handlers for notifications sent from the IO thread and run on the
82 // FILE thread. 79 // FILE thread.
83 void UpdateDownload(int id, DownloadBuffer* buffer); 80 void UpdateDownload(int id, DownloadBuffer* buffer);
84 // |os_error| is 0 for normal completions, and non-0 for errors. 81 // |os_error| is 0 for normal completions, and non-0 for errors.
85 // |security_info| contains SSL information (cert_id, cert_status, 82 // |security_info| contains SSL information (cert_id, cert_status,
86 // security_bits, ssl_connection_status), which can be used to 83 // security_bits, ssl_connection_status), which can be used to
87 // fine-tune the error message. It is empty if the transaction 84 // fine-tune the error message. It is empty if the transaction
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 DownloadFile* GetDownloadFile(int id); 143 DownloadFile* GetDownloadFile(int id);
147 144
148 // Called only from RenameInProgressDownloadFile and 145 // Called only from RenameInProgressDownloadFile and
149 // RenameCompletingDownloadFile on the FILE thread. 146 // RenameCompletingDownloadFile on the FILE thread.
150 void CancelDownloadOnRename(int id); 147 void CancelDownloadOnRename(int id);
151 148
152 // Erases the download file with the given the download |id| and removes 149 // Erases the download file with the given the download |id| and removes
153 // it from the maps. 150 // it from the maps.
154 void EraseDownload(int id); 151 void EraseDownload(int id);
155 152
156 // Unique ID for each DownloadFile.
157 int next_id_;
158
159 typedef base::hash_map<int, DownloadFile*> DownloadFileMap; 153 typedef base::hash_map<int, DownloadFile*> DownloadFileMap;
160 154
161 // A map of all in progress downloads. It owns the download files. 155 // A map of all in progress downloads. It owns the download files.
162 DownloadFileMap downloads_; 156 DownloadFileMap downloads_;
163 157
164 // Schedule periodic updates of the download progress. This timer 158 // Schedule periodic updates of the download progress. This timer
165 // is controlled from the FILE thread, and posts updates to the UI thread. 159 // is controlled from the FILE thread, and posts updates to the UI thread.
166 base::RepeatingTimer<DownloadFileManager> update_timer_; 160 base::RepeatingTimer<DownloadFileManager> update_timer_;
167 161
168 ResourceDispatcherHost* resource_dispatcher_host_; 162 ResourceDispatcherHost* resource_dispatcher_host_;
169 163
170 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); 164 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager);
171 }; 165 };
172 166
173 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ 167 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698