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 #include "content/browser/download/download_file_manager.h" | 5 #include "content/browser/download/download_file_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 VLOG(20) << " " << __FUNCTION__ << "()" | 113 VLOG(20) << " " << __FUNCTION__ << "()" |
114 << " id = " << global_id | 114 << " id = " << global_id |
115 << " download_file = " << download_file->DebugString(); | 115 << " download_file = " << download_file->DebugString(); |
116 | 116 |
117 download_file->Detach(callback); | 117 download_file->Detach(callback); |
118 | 118 |
119 EraseDownload(global_id); | 119 EraseDownload(global_id); |
120 } | 120 } |
121 | 121 |
| 122 void DownloadFileManager::InterruptDownload( |
| 123 DownloadId id, const base::Closure& callback) { |
| 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 125 |
| 126 if (!ContainsKey(downloads_, id)) |
| 127 return; |
| 128 |
| 129 DownloadFile* download_file = downloads_[id]; |
| 130 |
| 131 VLOG(20) << " " << __FUNCTION__ << "()" |
| 132 << " id = " << id |
| 133 << " download_file = " << download_file->DebugString(); |
| 134 |
| 135 download_file->Detach(callback); |
| 136 |
| 137 EraseDownload(id); |
| 138 } |
| 139 |
122 void DownloadFileManager::OnDownloadManagerShutdown(DownloadManager* manager) { | 140 void DownloadFileManager::OnDownloadManagerShutdown(DownloadManager* manager) { |
123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
124 DCHECK(manager); | 142 DCHECK(manager); |
125 | 143 |
126 std::set<DownloadFile*> to_remove; | 144 std::set<DownloadFile*> to_remove; |
127 | 145 |
128 for (DownloadFileMap::iterator i = downloads_.begin(); | 146 for (DownloadFileMap::iterator i = downloads_.begin(); |
129 i != downloads_.end(); ++i) { | 147 i != downloads_.end(); ++i) { |
130 DownloadFile* download_file = i->second; | 148 DownloadFile* download_file = i->second; |
131 if (download_file->GetDownloadManager() == manager) { | 149 if (download_file->GetDownloadManager() == manager) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 DownloadFile* download_file = downloads_[global_id]; | 192 DownloadFile* download_file = downloads_[global_id]; |
175 | 193 |
176 VLOG(20) << " " << __FUNCTION__ << "()" | 194 VLOG(20) << " " << __FUNCTION__ << "()" |
177 << " id = " << global_id | 195 << " id = " << global_id |
178 << " download_file = " << download_file->DebugString(); | 196 << " download_file = " << download_file->DebugString(); |
179 | 197 |
180 downloads_.erase(global_id); | 198 downloads_.erase(global_id); |
181 | 199 |
182 delete download_file; | 200 delete download_file; |
183 } | 201 } |
OLD | NEW |