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

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

Issue 258008: Move initialization of ChromeURLRequestContexts to the IO thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync again, just in case Created 11 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) 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 saving files, on the file thread. 5 // Objects that handle file operations for saving files, on the file thread.
6 // 6 //
7 // The SaveFileManager owns a set of SaveFile objects, each of which connects 7 // The SaveFileManager owns a set of SaveFile objects, each of which connects
8 // with a SaveItem object which belongs to one SavePackage and runs on the file 8 // with a SaveItem object which belongs to one SavePackage and runs on the file
9 // thread for saving data in order to avoid disk activity on either network IO 9 // thread for saving data in order to avoid disk activity on either network IO
10 // thread or the UI thread. It coordinates the notifications from the network 10 // thread or the UI thread. It coordinates the notifications from the network
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 namespace net { 69 namespace net {
70 class IOBuffer; 70 class IOBuffer;
71 } 71 }
72 class GURL; 72 class GURL;
73 class SaveFile; 73 class SaveFile;
74 class SavePackage; 74 class SavePackage;
75 class MessageLoop; 75 class MessageLoop;
76 class ResourceDispatcherHost; 76 class ResourceDispatcherHost;
77 class Task; 77 class Task;
78 class URLRequestContext; 78 class URLRequestContextGetter;
79 79
80 class SaveFileManager 80 class SaveFileManager
81 : public base::RefCountedThreadSafe<SaveFileManager> { 81 : public base::RefCountedThreadSafe<SaveFileManager> {
82 public: 82 public:
83 SaveFileManager(MessageLoop* ui_loop, 83 SaveFileManager(MessageLoop* ui_loop,
84 MessageLoop* io_loop, 84 MessageLoop* io_loop,
85 ResourceDispatcherHost* rdh); 85 ResourceDispatcherHost* rdh);
86 ~SaveFileManager(); 86 ~SaveFileManager();
87 87
88 // Lifetime management. 88 // Lifetime management.
89 void Shutdown(); 89 void Shutdown();
90 90
91 // Called on the IO thread 91 // Called on the IO thread
92 int GetNextId(); 92 int GetNextId();
93 93
94 // Save the specified URL. Called on the UI thread and forwarded to the 94 // Save the specified URL. Called on the UI thread and forwarded to the
95 // ResourceDispatcherHost on the IO thread. 95 // ResourceDispatcherHost on the IO thread.
96 void SaveURL(const GURL& url, 96 void SaveURL(const GURL& url,
97 const GURL& referrer, 97 const GURL& referrer,
98 int render_process_host_id, 98 int render_process_host_id,
99 int render_view_id, 99 int render_view_id,
100 SaveFileCreateInfo::SaveFileSource save_source, 100 SaveFileCreateInfo::SaveFileSource save_source,
101 const FilePath& file_full_path, 101 const FilePath& file_full_path,
102 URLRequestContext* request_context, 102 URLRequestContextGetter* request_context_getter,
103 SavePackage* save_package); 103 SavePackage* save_package);
104 104
105 // Notifications sent from the IO thread and run on the file thread: 105 // Notifications sent from the IO thread and run on the file thread:
106 void StartSave(SaveFileCreateInfo* info); 106 void StartSave(SaveFileCreateInfo* info);
107 void UpdateSaveProgress(int save_id, net::IOBuffer* data, int size); 107 void UpdateSaveProgress(int save_id, net::IOBuffer* data, int size);
108 void SaveFinished(int save_id, GURL save_url, 108 void SaveFinished(int save_id, GURL save_url,
109 int render_process_id, bool is_success); 109 int render_process_id, bool is_success);
110 110
111 // Notifications sent from the UI thread and run on the file thread. 111 // Notifications sent from the UI thread and run on the file thread.
112 // Cancel a SaveFile instance which has specified save id. 112 // Cancel a SaveFile instance which has specified save id.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Deletes a specified file on the file thread. 211 // Deletes a specified file on the file thread.
212 void OnDeleteDirectoryOrFile(const FilePath& full_path, bool is_dir); 212 void OnDeleteDirectoryOrFile(const FilePath& full_path, bool is_dir);
213 213
214 // Notifications sent from the UI thread and run on the IO thread 214 // Notifications sent from the UI thread and run on the IO thread
215 215
216 // Initiates a request for URL to be saved. 216 // Initiates a request for URL to be saved.
217 void OnSaveURL(const GURL& url, 217 void OnSaveURL(const GURL& url,
218 const GURL& referrer, 218 const GURL& referrer,
219 int render_process_host_id, 219 int render_process_host_id,
220 int render_view_id, 220 int render_view_id,
221 URLRequestContext* request_context); 221 URLRequestContextGetter* request_context_getter);
222 // Handler for a notification sent to the IO thread for generating save id. 222 // Handler for a notification sent to the IO thread for generating save id.
223 void OnRequireSaveJobFromOtherSource(SaveFileCreateInfo* info); 223 void OnRequireSaveJobFromOtherSource(SaveFileCreateInfo* info);
224 // Call ResourceDispatcherHost's CancelRequest method to execute cancel 224 // Call ResourceDispatcherHost's CancelRequest method to execute cancel
225 // action in the IO thread. 225 // action in the IO thread.
226 void ExecuteCancelSaveRequest(int render_process_id, int request_id); 226 void ExecuteCancelSaveRequest(int render_process_id, int request_id);
227 227
228 // Unique ID for the next SaveFile object. 228 // Unique ID for the next SaveFile object.
229 int next_id_; 229 int next_id_;
230 230
231 // A map of all saving jobs by using save id. 231 // A map of all saving jobs by using save id.
(...skipping 29 matching lines...) Expand all
261 // hashmap since it is possible to save same URL in different tab at 261 // hashmap since it is possible to save same URL in different tab at
262 // same time. 262 // same time.
263 typedef base::hash_map<std::string, SavePackage*> StartingRequestsMap; 263 typedef base::hash_map<std::string, SavePackage*> StartingRequestsMap;
264 typedef base::hash_map<int, StartingRequestsMap> TabToStartingRequestsMap; 264 typedef base::hash_map<int, StartingRequestsMap> TabToStartingRequestsMap;
265 TabToStartingRequestsMap tab_starting_requests_; 265 TabToStartingRequestsMap tab_starting_requests_;
266 266
267 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); 267 DISALLOW_COPY_AND_ASSIGN(SaveFileManager);
268 }; 268 };
269 269
270 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H__ 270 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H__
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/save_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698