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

Unified Diff: chrome/installer/util/delete_tree_work_item.cc

Issue 2379543002: installer and some misc files: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: regroup ifs Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/delete_tree_work_item.h ('k') | chrome/installer/util/move_tree_work_item.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/delete_tree_work_item.cc
diff --git a/chrome/installer/util/delete_tree_work_item.cc b/chrome/installer/util/delete_tree_work_item.cc
index 8fc5dadfed220c7193bab53f9d177c6374c96d90..389d15b8fcef0ce2ce05e660156b2f78fe9f75fa 100644
--- a/chrome/installer/util/delete_tree_work_item.cc
+++ b/chrome/installer/util/delete_tree_work_item.cc
@@ -31,22 +31,25 @@ bool DeleteTreeWorkItem::DoImpl() {
void DeleteTreeWorkItem::RollbackImpl() {
if (moved_to_backup_) {
- base::FilePath backup = GetBackupPath();
+ const base::FilePath& backup = GetBackupPath();
DCHECK(!backup.empty());
if (base::PathExists(backup))
base::Move(backup, root_path_);
}
}
-base::FilePath DeleteTreeWorkItem::GetBackupPath() {
- if (backup_path_.path().empty() &&
- !backup_path_.CreateUniqueTempDirUnderPath(temp_path_)) {
- PLOG(ERROR) << "Failed to get backup path in folder " << temp_path_.value();
- return base::FilePath();
+const base::FilePath& DeleteTreeWorkItem::GetBackupPath() {
+ if (backup_path_.empty()) {
+ if (!backup_dir_.CreateUniqueTempDirUnderPath(temp_path_)) {
+ PLOG(ERROR) << "Failed to get backup path in folder "
+ << temp_path_.value();
+ return backup_path_;
+ }
+ backup_path_ = backup_dir_.GetPath().Append(root_path_.BaseName());
}
- DCHECK(!backup_path_.path().empty());
- return backup_path_.path().Append(root_path_.BaseName());
+ DCHECK(!backup_path_.empty());
+ return backup_path_;
}
bool DeleteTreeWorkItem::DeleteRoot() {
@@ -57,7 +60,7 @@ bool DeleteTreeWorkItem::DeleteRoot() {
}
bool DeleteTreeWorkItem::MoveRootToBackup() {
- base::FilePath backup = GetBackupPath();
+ const base::FilePath& backup = GetBackupPath();
if (backup.empty())
return false;
if (base::Move(root_path_, backup)) {
« no previous file with comments | « chrome/installer/util/delete_tree_work_item.h ('k') | chrome/installer/util/move_tree_work_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698