OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 SavePackageId save_package_id, | 203 SavePackageId save_package_id, |
204 int render_process_host_id, | 204 int render_process_host_id, |
205 int render_view_routing_id, | 205 int render_view_routing_id, |
206 int render_frame_routing_id, | 206 int render_frame_routing_id, |
207 ResourceContext* context); | 207 ResourceContext* context); |
208 // Call ResourceDispatcherHostImpl's CancelRequest method to execute cancel | 208 // Call ResourceDispatcherHostImpl's CancelRequest method to execute cancel |
209 // action in the IO thread. | 209 // action in the IO thread. |
210 void ExecuteCancelSaveRequest(int render_process_id, int request_id); | 210 void ExecuteCancelSaveRequest(int render_process_id, int request_id); |
211 | 211 |
212 // A map from save_item_id into SaveFiles. | 212 // A map from save_item_id into SaveFiles. |
213 using SaveFileMap = | 213 std::unordered_map<SaveItemId, std::unique_ptr<SaveFile>, SaveItemId::Hasher> |
214 std::unordered_map<SaveItemId, SaveFile*, SaveItemId::Hasher>; | 214 save_file_map_; |
215 SaveFileMap save_file_map_; | |
216 | 215 |
217 // Tracks which SavePackage to send data to, called only on UI thread. | 216 // Tracks which SavePackage to send data to, called only on UI thread. |
218 // SavePackageMap maps save item ids to their SavePackage. | 217 // SavePackageMap maps save item ids to their SavePackage. |
219 using SavePackageMap = | 218 std::unordered_map<SaveItemId, SavePackage*, SaveItemId::Hasher> packages_; |
220 std::unordered_map<SaveItemId, SavePackage*, SaveItemId::Hasher>; | |
221 SavePackageMap packages_; | |
222 | 219 |
223 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); | 220 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); |
224 }; | 221 }; |
225 | 222 |
226 } // namespace content | 223 } // namespace content |
227 | 224 |
228 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ | 225 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ |
OLD | NEW |