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

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 2622853002: Check if a deleted profile still exists before logging that it is still there (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/profiles/profile_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 DCHECK(deleted_profiles); 882 DCHECK(deleted_profiles);
883 883
884 for (const std::unique_ptr<base::Value>& value : *deleted_profiles) { 884 for (const std::unique_ptr<base::Value>& value : *deleted_profiles) {
885 base::FilePath profile_path; 885 base::FilePath profile_path;
886 bool is_valid_profile_path = 886 bool is_valid_profile_path =
887 base::GetValueAsFilePath(*value, &profile_path) && 887 base::GetValueAsFilePath(*value, &profile_path) &&
888 profile_path.DirName() == user_data_dir(); 888 profile_path.DirName() == user_data_dir();
889 // Although it should never happen, make sure this is a valid path in the 889 // Although it should never happen, make sure this is a valid path in the
890 // user_data_dir, so we don't accidentially delete something else. 890 // user_data_dir, so we don't accidentially delete something else.
891 if (is_valid_profile_path) { 891 if (is_valid_profile_path) {
892 LOG(WARNING) << "Files of a deleted profile still exist after restart. " 892 if (base::PathExists(profile_path)) {
893 "Cleaning up now."; 893 LOG(WARNING) << "Files of a deleted profile still exist after restart. "
894 BrowserThread::PostTaskAndReply( 894 "Cleaning up now.";
895 BrowserThread::FILE, FROM_HERE, 895 BrowserThread::PostTaskAndReply(
896 base::Bind(&NukeProfileFromDisk, profile_path), 896 BrowserThread::FILE, FROM_HERE,
897 base::Bind(&NukeProfileFromDisk, profile_path),
898 base::Bind(&ProfileCleanedUp, value.get()));
899 } else {
900 // Everything is fine, the profile was removed on shutdown.
901 BrowserThread::PostTask(
902 BrowserThread::UI, FROM_HERE,
897 base::Bind(&ProfileCleanedUp, value.get())); 903 base::Bind(&ProfileCleanedUp, value.get()));
904 }
898 } else { 905 } else {
899 LOG(ERROR) << "Found invalid profile path in deleted_profiles: " 906 LOG(ERROR) << "Found invalid profile path in deleted_profiles: "
900 << profile_path.AsUTF8Unsafe(); 907 << profile_path.AsUTF8Unsafe();
901 NOTREACHED(); 908 NOTREACHED();
902 } 909 }
903 } 910 }
904 } 911 }
905 912
906 void ProfileManager::InitProfileUserPrefs(Profile* profile) { 913 void ProfileManager::InitProfileUserPrefs(Profile* profile) {
907 TRACE_EVENT0("browser", "ProfileManager::InitProfileUserPrefs"); 914 TRACE_EVENT0("browser", "ProfileManager::InitProfileUserPrefs");
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 1721
1715 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1722 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1716 if (!original_callback.is_null()) 1723 if (!original_callback.is_null())
1717 original_callback.Run(loaded_profile, status); 1724 original_callback.Run(loaded_profile, status);
1718 } 1725 }
1719 #endif // !defined(OS_ANDROID) 1726 #endif // !defined(OS_ANDROID)
1720 1727
1721 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1728 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1722 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1729 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1723 } 1730 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698