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

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

Issue 8371009: Make passing of DownloadRequestHandle separate from DownloadCreateInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 9 years, 2 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 #include <map> 43 #include <map>
44 44
45 #include "base/atomic_sequence_num.h" 45 #include "base/atomic_sequence_num.h"
46 #include "base/basictypes.h" 46 #include "base/basictypes.h"
47 #include "base/gtest_prod_util.h" 47 #include "base/gtest_prod_util.h"
48 #include "base/hash_tables.h" 48 #include "base/hash_tables.h"
49 #include "base/memory/ref_counted.h" 49 #include "base/memory/ref_counted.h"
50 #include "base/timer.h" 50 #include "base/timer.h"
51 #include "content/browser/download/download_id.h" 51 #include "content/browser/download/download_id.h"
52 #include "content/browser/download/download_request_handle.h"
53 #include "content/browser/download/interrupt_reasons.h" 52 #include "content/browser/download/interrupt_reasons.h"
54 #include "content/common/content_export.h" 53 #include "content/common/content_export.h"
55 #include "net/base/net_errors.h" 54 #include "net/base/net_errors.h"
56 #include "ui/gfx/native_widget_types.h" 55 #include "ui/gfx/native_widget_types.h"
57 56
58 struct DownloadCreateInfo; 57 struct DownloadCreateInfo;
59 struct DownloadSaveInfo; 58 struct DownloadSaveInfo;
60 class DownloadFile; 59 class DownloadFile;
61 class DownloadManager; 60 class DownloadManager;
61 class DownloadRequestHandle;
62 class FilePath; 62 class FilePath;
63 class GURL; 63 class GURL;
64 class ResourceDispatcherHost; 64 class ResourceDispatcherHost;
65 65
66 namespace content { 66 namespace content {
67 class DownloadBuffer; 67 class DownloadBuffer;
68 } 68 }
69 69
70 namespace net { 70 namespace net {
71 class URLRequestContextGetter; 71 class URLRequestContextGetter;
72 } 72 }
73 73
74 // Manages all in progress downloads. 74 // Manages all in progress downloads.
75 class CONTENT_EXPORT DownloadFileManager 75 class CONTENT_EXPORT DownloadFileManager
76 : public base::RefCountedThreadSafe<DownloadFileManager> { 76 : public base::RefCountedThreadSafe<DownloadFileManager> {
77 public: 77 public:
78 explicit DownloadFileManager(ResourceDispatcherHost* rdh); 78 explicit DownloadFileManager(ResourceDispatcherHost* rdh);
79 79
80 // Called on shutdown on the UI thread. 80 // Called on shutdown on the UI thread.
81 void Shutdown(); 81 void Shutdown();
82 82
83 // Called on UI thread to make DownloadFileManager start the download. 83 // Called on UI thread to make DownloadFileManager start the download.
84 void StartDownload(DownloadCreateInfo* info); 84 void StartDownload(DownloadCreateInfo* info,
85 const DownloadRequestHandle& request_handle);
85 86
86 // Handlers for notifications sent from the IO thread and run on the 87 // Handlers for notifications sent from the IO thread and run on the
87 // FILE thread. 88 // FILE thread.
88 void UpdateDownload(DownloadId global_id, content::DownloadBuffer* buffer); 89 void UpdateDownload(DownloadId global_id, content::DownloadBuffer* buffer);
89 90
90 // |reason| is the reason for interruption, if one occurs. 91 // |reason| is the reason for interruption, if one occurs.
91 // |security_info| contains SSL information (cert_id, cert_status, 92 // |security_info| contains SSL information (cert_id, cert_status,
92 // security_bits, ssl_connection_status), which can be used to 93 // security_bits, ssl_connection_status), which can be used to
93 // fine-tune the error message. It is empty if the transaction 94 // fine-tune the error message. It is empty if the transaction
94 // was not performed securely. 95 // was not performed securely.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void StartUpdateTimer(); 138 void StartUpdateTimer();
138 void StopUpdateTimer(); 139 void StopUpdateTimer();
139 void UpdateInProgressDownloads(); 140 void UpdateInProgressDownloads();
140 141
141 // Clean up helper that runs on the download thread. 142 // Clean up helper that runs on the download thread.
142 void OnShutdown(); 143 void OnShutdown();
143 144
144 // Creates DownloadFile on FILE thread and continues starting the download 145 // Creates DownloadFile on FILE thread and continues starting the download
145 // process. 146 // process.
146 void CreateDownloadFile(DownloadCreateInfo* info, 147 void CreateDownloadFile(DownloadCreateInfo* info,
148 const DownloadRequestHandle& request_handle,
147 DownloadManager* download_manager, 149 DownloadManager* download_manager,
148 bool hash_needed); 150 bool hash_needed);
149 151
150 // Called only on the download thread. 152 // Called only on the download thread.
151 DownloadFile* GetDownloadFile(DownloadId global_id); 153 DownloadFile* GetDownloadFile(DownloadId global_id);
152 154
153 // Called only from RenameInProgressDownloadFile and 155 // Called only from RenameInProgressDownloadFile and
154 // RenameCompletingDownloadFile on the FILE thread. 156 // RenameCompletingDownloadFile on the FILE thread.
155 // |rename_error| indicates what error caused the cancel. 157 // |rename_error| indicates what error caused the cancel.
156 void CancelDownloadOnRename(DownloadId global_id, net::Error rename_error); 158 void CancelDownloadOnRename(DownloadId global_id, net::Error rename_error);
(...skipping 10 matching lines...) Expand all
167 // Schedule periodic updates of the download progress. This timer 169 // Schedule periodic updates of the download progress. This timer
168 // is controlled from the FILE thread, and posts updates to the UI thread. 170 // is controlled from the FILE thread, and posts updates to the UI thread.
169 base::RepeatingTimer<DownloadFileManager> update_timer_; 171 base::RepeatingTimer<DownloadFileManager> update_timer_;
170 172
171 ResourceDispatcherHost* resource_dispatcher_host_; 173 ResourceDispatcherHost* resource_dispatcher_host_;
172 174
173 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); 175 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager);
174 }; 176 };
175 177
176 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ 178 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_file.cc ('k') | content/browser/download/download_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698