Commit 96d60039 authored by Brian Manthos's avatar Brian Manthos Committed by Commit Bot

Installer work items: standardize on temp_path naming

CopyTreeWorkItem and MoveTreeWorkItem were using the name temp_dir,
while DeleteTreeWorkItem was using the name temp_path.  The latter
is more accurate and this CL makes the three consistent.

Change-Id: I3a9cf5412180e6006fb1afad322b8dde983eb2df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2213360Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Commit-Queue: Brian Manthos <brianman@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#771431}
parent 4b494f4b
...@@ -14,12 +14,12 @@ CopyTreeWorkItem::~CopyTreeWorkItem() { ...@@ -14,12 +14,12 @@ CopyTreeWorkItem::~CopyTreeWorkItem() {
CopyTreeWorkItem::CopyTreeWorkItem(const base::FilePath& source_path, CopyTreeWorkItem::CopyTreeWorkItem(const base::FilePath& source_path,
const base::FilePath& dest_path, const base::FilePath& dest_path,
const base::FilePath& temp_dir, const base::FilePath& temp_path,
CopyOverWriteOption overwrite_option, CopyOverWriteOption overwrite_option,
const base::FilePath& alternative_path) const base::FilePath& alternative_path)
: source_path_(source_path), : source_path_(source_path),
dest_path_(dest_path), dest_path_(dest_path),
temp_dir_(temp_dir), temp_path_(temp_path),
overwrite_option_(overwrite_option), overwrite_option_(overwrite_option),
alternative_path_(alternative_path), alternative_path_(alternative_path),
copied_to_dest_path_(false), copied_to_dest_path_(false),
...@@ -70,9 +70,9 @@ bool CopyTreeWorkItem::DoImpl() { ...@@ -70,9 +70,9 @@ bool CopyTreeWorkItem::DoImpl() {
// In all cases that reach here, move dest to a backup path. // In all cases that reach here, move dest to a backup path.
if (dest_exist) { if (dest_exist) {
if (!backup_path_.CreateUniqueTempDirUnderPath(temp_dir_)) { if (!backup_path_.CreateUniqueTempDirUnderPath(temp_path_)) {
PLOG(ERROR) << "Failed to get backup path in folder " PLOG(ERROR) << "Failed to get backup path in folder "
<< temp_dir_.value(); << temp_path_.value();
return false; return false;
} }
backup_path_created_ = true; backup_path_created_ = true;
......
...@@ -32,12 +32,12 @@ class CopyTreeWorkItem : public WorkItem { ...@@ -32,12 +32,12 @@ class CopyTreeWorkItem : public WorkItem {
// See comments on corresponding member variables for the semantics of // See comments on corresponding member variables for the semantics of
// arguments. // arguments.
// Notes on temp_path: to facilitate rollback, the caller needs to supply // Notes on |temp_path|: to facilitate rollback, the caller needs to supply
// a temporary directory to save the original files if they exist under // a temporary directory to save the original files if they exist under
// dest_path. // |dest_path|.
CopyTreeWorkItem(const base::FilePath& source_path, CopyTreeWorkItem(const base::FilePath& source_path,
const base::FilePath& dest_path, const base::FilePath& dest_path,
const base::FilePath& temp_dir, const base::FilePath& temp_path,
CopyOverWriteOption overwrite_option, CopyOverWriteOption overwrite_option,
const base::FilePath& alternative_path); const base::FilePath& alternative_path);
...@@ -55,7 +55,7 @@ class CopyTreeWorkItem : public WorkItem { ...@@ -55,7 +55,7 @@ class CopyTreeWorkItem : public WorkItem {
base::FilePath dest_path_; base::FilePath dest_path_;
// Temporary directory that can be used. // Temporary directory that can be used.
base::FilePath temp_dir_; base::FilePath temp_path_;
// Controls the behavior for overwriting. // Controls the behavior for overwriting.
CopyOverWriteOption overwrite_option_; CopyOverWriteOption overwrite_option_;
......
...@@ -15,11 +15,11 @@ MoveTreeWorkItem::~MoveTreeWorkItem() { ...@@ -15,11 +15,11 @@ MoveTreeWorkItem::~MoveTreeWorkItem() {
MoveTreeWorkItem::MoveTreeWorkItem(const base::FilePath& source_path, MoveTreeWorkItem::MoveTreeWorkItem(const base::FilePath& source_path,
const base::FilePath& dest_path, const base::FilePath& dest_path,
const base::FilePath& temp_dir, const base::FilePath& temp_path,
MoveTreeOption duplicate_option) MoveTreeOption duplicate_option)
: source_path_(source_path), : source_path_(source_path),
dest_path_(dest_path), dest_path_(dest_path),
temp_dir_(temp_dir), temp_path_(temp_path),
moved_to_dest_path_(false), moved_to_dest_path_(false),
moved_to_backup_(false), moved_to_backup_(false),
source_moved_to_backup_(false), source_moved_to_backup_(false),
...@@ -42,9 +42,9 @@ bool MoveTreeWorkItem::DoImpl() { ...@@ -42,9 +42,9 @@ bool MoveTreeWorkItem::DoImpl() {
// fail if files in dest_path_ are in use. // fail if files in dest_path_ are in use.
if (base::PathExists(dest_path_)) { if (base::PathExists(dest_path_)) {
// Generate a backup path that can keep the original files under dest_path_. // Generate a backup path that can keep the original files under dest_path_.
if (!backup_path_.CreateUniqueTempDirUnderPath(temp_dir_)) { if (!backup_path_.CreateUniqueTempDirUnderPath(temp_path_)) {
PLOG(ERROR) << "Failed to get backup path in folder " PLOG(ERROR) << "Failed to get backup path in folder "
<< temp_dir_.value(); << temp_path_.value();
return false; return false;
} }
base::FilePath backup = base::FilePath backup =
......
...@@ -31,7 +31,7 @@ class MoveTreeWorkItem : public WorkItem { ...@@ -31,7 +31,7 @@ class MoveTreeWorkItem : public WorkItem {
// |source_path| specifies file or directory that will be moved to location // |source_path| specifies file or directory that will be moved to location
// specified by |dest_path|. To facilitate rollback, the caller needs to // specified by |dest_path|. To facilitate rollback, the caller needs to
// supply a temporary directory, |temp_dir| to save the original files if // supply a temporary directory, |temp_path| to save the original files if
// they exist under dest_path. // they exist under dest_path.
// If |check_duplicates| is CHECK_DUPLICATES, then Do() will first check // If |check_duplicates| is CHECK_DUPLICATES, then Do() will first check
// whether the directory tree in source_path is entirely contained in // whether the directory tree in source_path is entirely contained in
...@@ -40,7 +40,7 @@ class MoveTreeWorkItem : public WorkItem { ...@@ -40,7 +40,7 @@ class MoveTreeWorkItem : public WorkItem {
// attempt to move source_path to dest_path as stated above. // attempt to move source_path to dest_path as stated above.
MoveTreeWorkItem(const base::FilePath& source_path, MoveTreeWorkItem(const base::FilePath& source_path,
const base::FilePath& dest_path, const base::FilePath& dest_path,
const base::FilePath& temp_dir, const base::FilePath& temp_path,
MoveTreeOption duplicate_option); MoveTreeOption duplicate_option);
// WorkItem: // WorkItem:
...@@ -54,7 +54,7 @@ class MoveTreeWorkItem : public WorkItem { ...@@ -54,7 +54,7 @@ class MoveTreeWorkItem : public WorkItem {
base::FilePath dest_path_; base::FilePath dest_path_;
// Temporary directory to backup dest_path_ (if it already exists). // Temporary directory to backup dest_path_ (if it already exists).
base::FilePath temp_dir_; base::FilePath temp_path_;
// The temporary directory into which the original dest_path_ has been moved. // The temporary directory into which the original dest_path_ has been moved.
base::ScopedTempDir backup_path_; base::ScopedTempDir backup_path_;
......
...@@ -31,10 +31,10 @@ CallbackWorkItem* WorkItem::CreateCallbackWorkItem( ...@@ -31,10 +31,10 @@ CallbackWorkItem* WorkItem::CreateCallbackWorkItem(
CopyTreeWorkItem* WorkItem::CreateCopyTreeWorkItem( CopyTreeWorkItem* WorkItem::CreateCopyTreeWorkItem(
const base::FilePath& source_path, const base::FilePath& source_path,
const base::FilePath& dest_path, const base::FilePath& dest_path,
const base::FilePath& temp_dir, const base::FilePath& temp_path,
CopyOverWriteOption overwrite_option, CopyOverWriteOption overwrite_option,
const base::FilePath& alternative_path) { const base::FilePath& alternative_path) {
return new CopyTreeWorkItem(source_path, dest_path, temp_dir, return new CopyTreeWorkItem(source_path, dest_path, temp_path,
overwrite_option, alternative_path); overwrite_option, alternative_path);
} }
...@@ -75,11 +75,11 @@ DeleteTreeWorkItem* WorkItem::CreateDeleteTreeWorkItem( ...@@ -75,11 +75,11 @@ DeleteTreeWorkItem* WorkItem::CreateDeleteTreeWorkItem(
MoveTreeWorkItem* WorkItem::CreateMoveTreeWorkItem( MoveTreeWorkItem* WorkItem::CreateMoveTreeWorkItem(
const base::FilePath& source_path, const base::FilePath& source_path,
const base::FilePath& dest_path, const base::FilePath& dest_path,
const base::FilePath& temp_dir, const base::FilePath& temp_path,
MoveTreeOption duplicate_option) { MoveTreeOption duplicate_option) {
return new MoveTreeWorkItem(source_path, return new MoveTreeWorkItem(source_path,
dest_path, dest_path,
temp_dir, temp_path,
duplicate_option); duplicate_option);
} }
......
...@@ -106,7 +106,7 @@ class WorkItem { ...@@ -106,7 +106,7 @@ class WorkItem {
static CopyTreeWorkItem* CreateCopyTreeWorkItem( static CopyTreeWorkItem* CreateCopyTreeWorkItem(
const base::FilePath& source_path, const base::FilePath& source_path,
const base::FilePath& dest_path, const base::FilePath& dest_path,
const base::FilePath& temp_dir, const base::FilePath& temp_path,
CopyOverWriteOption overwrite_option, CopyOverWriteOption overwrite_option,
const base::FilePath& alternative_path); const base::FilePath& alternative_path);
...@@ -145,7 +145,7 @@ class WorkItem { ...@@ -145,7 +145,7 @@ class WorkItem {
static MoveTreeWorkItem* CreateMoveTreeWorkItem( static MoveTreeWorkItem* CreateMoveTreeWorkItem(
const base::FilePath& source_path, const base::FilePath& source_path,
const base::FilePath& dest_path, const base::FilePath& dest_path,
const base::FilePath& temp_dir, const base::FilePath& temp_path,
MoveTreeOption duplicate_option); MoveTreeOption duplicate_option);
// Create a SetRegValueWorkItem that sets a registry value with REG_SZ type // Create a SetRegValueWorkItem that sets a registry value with REG_SZ type
......
...@@ -82,13 +82,13 @@ WorkItem* WorkItemList::AddCallbackWorkItem( ...@@ -82,13 +82,13 @@ WorkItem* WorkItemList::AddCallbackWorkItem(
WorkItem* WorkItemList::AddCopyTreeWorkItem( WorkItem* WorkItemList::AddCopyTreeWorkItem(
const std::wstring& source_path, const std::wstring& source_path,
const std::wstring& dest_path, const std::wstring& dest_path,
const std::wstring& temp_dir, const std::wstring& temp_path,
CopyOverWriteOption overwrite_option, CopyOverWriteOption overwrite_option,
const std::wstring& alternative_path) { const std::wstring& alternative_path) {
WorkItem* item = WorkItem::CreateCopyTreeWorkItem( WorkItem* item = WorkItem::CreateCopyTreeWorkItem(
base::FilePath(source_path), base::FilePath(source_path),
base::FilePath(dest_path), base::FilePath(dest_path),
base::FilePath(temp_dir), base::FilePath(temp_path),
overwrite_option, overwrite_option,
base::FilePath(alternative_path)); base::FilePath(alternative_path));
AddWorkItem(item); AddWorkItem(item);
...@@ -139,11 +139,11 @@ WorkItem* WorkItemList::AddDeleteTreeWorkItem(const base::FilePath& root_path, ...@@ -139,11 +139,11 @@ WorkItem* WorkItemList::AddDeleteTreeWorkItem(const base::FilePath& root_path,
WorkItem* WorkItemList::AddMoveTreeWorkItem(const std::wstring& source_path, WorkItem* WorkItemList::AddMoveTreeWorkItem(const std::wstring& source_path,
const std::wstring& dest_path, const std::wstring& dest_path,
const std::wstring& temp_dir, const std::wstring& temp_path,
MoveTreeOption duplicate_option) { MoveTreeOption duplicate_option) {
WorkItem* item = WorkItem::CreateMoveTreeWorkItem(base::FilePath(source_path), WorkItem* item = WorkItem::CreateMoveTreeWorkItem(base::FilePath(source_path),
base::FilePath(dest_path), base::FilePath(dest_path),
base::FilePath(temp_dir), base::FilePath(temp_path),
duplicate_option); duplicate_option);
AddWorkItem(item); AddWorkItem(item);
return item; return item;
......
...@@ -43,11 +43,11 @@ class WorkItemList : public WorkItem { ...@@ -43,11 +43,11 @@ class WorkItemList : public WorkItem {
// Add a CopyTreeWorkItem to the list of work items. // Add a CopyTreeWorkItem to the list of work items.
// See the NOTE in the documentation for the CopyTreeWorkItem class for // See the NOTE in the documentation for the CopyTreeWorkItem class for
// special considerations regarding |temp_dir|. // special considerations regarding |temp_path|.
virtual WorkItem* AddCopyTreeWorkItem( virtual WorkItem* AddCopyTreeWorkItem(
const std::wstring& source_path, const std::wstring& source_path,
const std::wstring& dest_path, const std::wstring& dest_path,
const std::wstring& temp_dir, const std::wstring& temp_path,
CopyOverWriteOption overwrite_option, CopyOverWriteOption overwrite_option,
const std::wstring& alternative_path = L""); const std::wstring& alternative_path = L"");
...@@ -81,7 +81,7 @@ class WorkItemList : public WorkItem { ...@@ -81,7 +81,7 @@ class WorkItemList : public WorkItem {
// Add a MoveTreeWorkItem to the list of work items. // Add a MoveTreeWorkItem to the list of work items.
virtual WorkItem* AddMoveTreeWorkItem(const std::wstring& source_path, virtual WorkItem* AddMoveTreeWorkItem(const std::wstring& source_path,
const std::wstring& dest_path, const std::wstring& dest_path,
const std::wstring& temp_dir, const std::wstring& temp_path,
MoveTreeOption duplicate_option); MoveTreeOption duplicate_option);
// Add a SetRegValueWorkItem that sets a registry value with REG_SZ type // Add a SetRegValueWorkItem that sets a registry value with REG_SZ type
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment