Chromium Code Reviews| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "content/browser/download/save_file_manager.h" | 7 #include "content/browser/download/save_file_manager.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 // fetching data. We forward the message to OnSaveFinished in UI thread. | 199 // fetching data. We forward the message to OnSaveFinished in UI thread. |
| 200 void SaveFileManager::SaveFinished(SaveItemId save_item_id, | 200 void SaveFileManager::SaveFinished(SaveItemId save_item_id, |
| 201 SavePackageId save_package_id, | 201 SavePackageId save_package_id, |
| 202 bool is_success) { | 202 bool is_success) { |
| 203 DVLOG(20) << " " << __FUNCTION__ << "()" | 203 DVLOG(20) << " " << __FUNCTION__ << "()" |
| 204 << " save_item_id = " << save_item_id | 204 << " save_item_id = " << save_item_id |
| 205 << " save_package_id = " << save_package_id | 205 << " save_package_id = " << save_package_id |
| 206 << " is_success = " << is_success; | 206 << " is_success = " << is_success; |
| 207 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 207 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 208 | 208 |
| 209 int64_t bytes_so_far; | 209 int64_t bytes_so_far = 0; |
|
Łukasz Anforowicz
2016/03/24 18:23:28
I think 0 is safe fallback here. Initializing to
Randy Smith (Not in Mondays)
2016/03/24 19:17:49
I don't think a broader discussion is worth it. T
Łukasz Anforowicz
2016/03/24 19:25:58
Makes sense - done.
| |
| 210 SaveFile* save_file = LookupSaveFile(save_item_id); | 210 SaveFile* save_file = LookupSaveFile(save_item_id); |
| 211 if (save_file != nullptr) { | 211 if (save_file != nullptr) { |
| 212 DCHECK(save_file->InProgress()); | 212 DCHECK(save_file->InProgress()); |
| 213 DVLOG(20) << " " << __FUNCTION__ << "()" | 213 DVLOG(20) << " " << __FUNCTION__ << "()" |
| 214 << " save_file = " << save_file->DebugString(); | 214 << " save_file = " << save_file->DebugString(); |
| 215 bytes_so_far = save_file->BytesSoFar(); | 215 bytes_so_far = save_file->BytesSoFar(); |
| 216 save_file->Finish(); | 216 save_file->Finish(); |
| 217 save_file->Detach(); | 217 save_file->Detach(); |
| 218 } else { | 218 } else { |
| 219 // We got called before StartSave - this should only happen if | 219 // We got called before StartSave - this should only happen if |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 SaveFile* save_file = it->second; | 421 SaveFile* save_file = it->second; |
| 422 DCHECK(!save_file->InProgress()); | 422 DCHECK(!save_file->InProgress()); |
| 423 base::DeleteFile(save_file->FullPath(), false); | 423 base::DeleteFile(save_file->FullPath(), false); |
| 424 delete save_file; | 424 delete save_file; |
| 425 save_file_map_.erase(it); | 425 save_file_map_.erase(it); |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 } | 428 } |
| 429 | 429 |
| 430 } // namespace content | 430 } // namespace content |
| OLD | NEW |