| 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 24 matching lines...) Expand all Loading... |
| 35 // timers) that live on the saving thread (file thread). | 35 // timers) that live on the saving thread (file thread). |
| 36 void SaveFileManager::Shutdown() { | 36 void SaveFileManager::Shutdown() { |
| 37 BrowserThread::PostTask( | 37 BrowserThread::PostTask( |
| 38 BrowserThread::FILE, FROM_HERE, | 38 BrowserThread::FILE, FROM_HERE, |
| 39 base::Bind(&SaveFileManager::OnShutdown, this)); | 39 base::Bind(&SaveFileManager::OnShutdown, this)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Stop file thread operations. | 42 // Stop file thread operations. |
| 43 void SaveFileManager::OnShutdown() { | 43 void SaveFileManager::OnShutdown() { |
| 44 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 44 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 45 STLDeleteValues(&save_file_map_); | 45 base::STLDeleteValues(&save_file_map_); |
| 46 } | 46 } |
| 47 | 47 |
| 48 SaveFile* SaveFileManager::LookupSaveFile(SaveItemId save_item_id) { | 48 SaveFile* SaveFileManager::LookupSaveFile(SaveItemId save_item_id) { |
| 49 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 49 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 50 SaveFileMap::iterator it = save_file_map_.find(save_item_id); | 50 SaveFileMap::iterator it = save_file_map_.find(save_item_id); |
| 51 return it == save_file_map_.end() ? nullptr : it->second; | 51 return it == save_file_map_.end() ? nullptr : it->second; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Look up a SavePackage according to a save id. | 54 // Look up a SavePackage according to a save id. |
| 55 SavePackage* SaveFileManager::LookupPackage(SaveItemId save_item_id) { | 55 SavePackage* SaveFileManager::LookupPackage(SaveItemId save_item_id) { |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 SaveFile* save_file = it->second; | 381 SaveFile* save_file = it->second; |
| 382 DCHECK(!save_file->InProgress()); | 382 DCHECK(!save_file->InProgress()); |
| 383 base::DeleteFile(save_file->FullPath(), false); | 383 base::DeleteFile(save_file->FullPath(), false); |
| 384 delete save_file; | 384 delete save_file; |
| 385 save_file_map_.erase(it); | 385 save_file_map_.erase(it); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace content | 390 } // namespace content |
| OLD | NEW |