From 42eb6b07c2791d8d13ec48ea3c92725eee4d94a2 Mon Sep 17 00:00:00 2001 From: "deanm@chromium.org" Date: Tue, 25 Nov 2008 23:14:46 +0000 Subject: Port some files in chrome/browser/ - part 1. Review URL: http://codereview.chromium.org/11402 Patch from Pawel Hajdan Jr. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6007 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/bookmarks/bookmark_storage.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'chrome/browser/bookmarks/bookmark_storage.cc') diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc index eb9bbe4..591f190 100644 --- a/chrome/browser/bookmarks/bookmark_storage.cc +++ b/chrome/browser/bookmarks/bookmark_storage.cc @@ -4,6 +4,7 @@ #include "chrome/browser/bookmarks/bookmark_storage.h" +#include "base/compiler_specific.h" #include "base/file_util.h" #include "base/json_writer.h" #include "base/message_loop.h" @@ -31,8 +32,7 @@ const int kSaveDelayMS = 2500; BookmarkStorage::BookmarkStorage(Profile* profile, BookmarkModel* model) : model_(model), -#pragma warning(suppress: 4355) // Okay to pass "this" here. - save_factory_(this), + ALLOW_THIS_IN_INITIALIZER_LIST(save_factory_(this)), backend_thread_(g_browser_process->file_thread()) { std::wstring path = profile->GetPath(); file_util::AppendToPath(&path, chrome::kBookmarksFileName); @@ -139,13 +139,10 @@ void BookmarkStorageBackend::Write(Value* value) { int bytes_written = file_util::WriteFile(tmp_file, content.c_str(), static_cast(content.length())); if (bytes_written != -1) { - if (!MoveFileEx(tmp_file.c_str(), path_.c_str(), - MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) { + if (!file_util::Move(tmp_file, path_)) { // Rename failed. Try again on the off chance someone has locked either // file and hope we're successful the second time through. - BOOL move_result = - MoveFileEx(tmp_file.c_str(), path_.c_str(), - MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); + bool move_result = file_util::Move(tmp_file, path_); DCHECK(move_result); if (!move_result) LOG(WARNING) << " writing bookmarks failed, result=" << move_result; -- cgit v1.1