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

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

Issue 1106213003: Optimize writes upon ProfileManager::UpdateLastUser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « chrome/browser/profiles/profile_info_cache.cc ('k') | 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 <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 ProfileManager::ProfileInfo::~ProfileInfo() { 1325 ProfileManager::ProfileInfo::~ProfileInfo() {
1326 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1326 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1327 } 1327 }
1328 1328
1329 #if !defined(OS_ANDROID) && !defined(OS_IOS) 1329 #if !defined(OS_ANDROID) && !defined(OS_IOS)
1330 void ProfileManager::UpdateLastUser(Profile* last_active) { 1330 void ProfileManager::UpdateLastUser(Profile* last_active) {
1331 PrefService* local_state = g_browser_process->local_state(); 1331 PrefService* local_state = g_browser_process->local_state();
1332 DCHECK(local_state); 1332 DCHECK(local_state);
1333 // Only keep track of profiles that we are managing; tests may create others. 1333 // Only keep track of profiles that we are managing; tests may create others.
1334 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) { 1334 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) {
1335 local_state->SetString(prefs::kProfileLastUsed, 1335 std::string profile_path_base =
1336 last_active->GetPath().BaseName().MaybeAsASCII()); 1336 last_active->GetPath().BaseName().MaybeAsASCII();
1337 if (profile_path_base != local_state->GetString(prefs::kProfileLastUsed))
1338 local_state->SetString(prefs::kProfileLastUsed, profile_path_base);
1337 1339
1338 ProfileInfoCache& cache = GetProfileInfoCache(); 1340 ProfileInfoCache& cache = GetProfileInfoCache();
1339 size_t profile_index = 1341 size_t profile_index =
1340 cache.GetIndexOfProfileWithPath(last_active->GetPath()); 1342 cache.GetIndexOfProfileWithPath(last_active->GetPath());
1341 if (profile_index != std::string::npos) 1343 if (profile_index != std::string::npos)
1342 cache.SetProfileActiveTimeAtIndex(profile_index); 1344 cache.SetProfileActiveTimeAtIndex(profile_index);
1343 } 1345 }
1344 } 1346 }
1345 1347
1346 ProfileManager::BrowserListObserver::BrowserListObserver( 1348 ProfileManager::BrowserListObserver::BrowserListObserver(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 } 1419 }
1418 1420
1419 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1421 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1420 if (!original_callback.is_null()) 1422 if (!original_callback.is_null())
1421 original_callback.Run(loaded_profile, status); 1423 original_callback.Run(loaded_profile, status);
1422 } 1424 }
1423 1425
1424 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1426 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1425 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1427 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1426 } 1428 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698