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

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

Issue 8820009: Appcache, local storage, indexed db, databases: skip exit-time deletion when restarting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review. Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/appcache/chrome_appcache_service_unittest.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 FilePath GetCachePath(const FilePath& base) { 163 FilePath GetCachePath(const FilePath& base) {
164 return base.Append(chrome::kCacheDirname); 164 return base.Append(chrome::kCacheDirname);
165 } 165 }
166 166
167 FilePath GetMediaCachePath(const FilePath& base) { 167 FilePath GetMediaCachePath(const FilePath& base) {
168 return base.Append(chrome::kMediaCacheDirname); 168 return base.Append(chrome::kMediaCacheDirname);
169 } 169 }
170 170
171 void SaveSessionStateOnIOThread( 171 void SaveSessionStateOnIOThread(
172 net::URLRequestContextGetter* url_request_context_getter) { 172 net::URLRequestContextGetter* url_request_context_getter,
173 ChromeAppCacheService* appcache_service) {
173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
174 url_request_context_getter->GetURLRequestContext()->cookie_store()-> 175 url_request_context_getter->GetURLRequestContext()->cookie_store()->
175 GetCookieMonster()->SaveSessionCookies(); 176 GetCookieMonster()->SaveSessionCookies();
177 if (appcache_service)
178 appcache_service->set_save_session_state(true);
176 } 179 }
177 180
178 } // namespace 181 } // namespace
179 182
180 // static 183 // static
181 Profile* Profile::CreateProfile(const FilePath& path) { 184 Profile* Profile::CreateProfile(const FilePath& path) {
182 if (!file_util::PathExists(path)) { 185 if (!file_util::PathExists(path)) {
183 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the 186 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the
184 // profile directory. We should eventually be able to run in this 187 // profile directory. We should eventually be able to run in this
185 // situation. 188 // situation.
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 content::Source<Profile>(this), 507 content::Source<Profile>(this),
505 content::NotificationService::NoDetails()); 508 content::NotificationService::NoDetails());
506 509
507 if (appcache_service_ && clear_local_state_on_exit_) { 510 if (appcache_service_ && clear_local_state_on_exit_) {
508 BrowserThread::PostTask( 511 BrowserThread::PostTask(
509 BrowserThread::IO, FROM_HERE, 512 BrowserThread::IO, FROM_HERE,
510 base::Bind(&appcache::AppCacheService::set_clear_local_state_on_exit, 513 base::Bind(&appcache::AppCacheService::set_clear_local_state_on_exit,
511 appcache_service_.get(), true)); 514 appcache_service_.get(), true));
512 } 515 }
513 516
514 if (webkit_context_.get())
515 webkit_context_->DeleteSessionOnlyData();
516
517 StopCreateSessionServiceTimer(); 517 StopCreateSessionServiceTimer();
518 518
519 // Remove pref observers 519 // Remove pref observers
520 pref_change_registrar_.RemoveAll(); 520 pref_change_registrar_.RemoveAll();
521 521
522 // The sync service needs to be deleted before the services it calls. 522 // The sync service needs to be deleted before the services it calls.
523 // TODO(stevet): Make ProfileSyncService into a PKS and let the PDM take care 523 // TODO(stevet): Make ProfileSyncService into a PKS and let the PDM take care
524 // of the cleanup below. 524 // of the cleanup below.
525 sync_service_.reset(); 525 sync_service_.reset();
526 526
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 1577
1578 NetworkActionPredictor* ProfileImpl::GetNetworkActionPredictor() { 1578 NetworkActionPredictor* ProfileImpl::GetNetworkActionPredictor() {
1579 if (!network_action_predictor_.get()) 1579 if (!network_action_predictor_.get())
1580 network_action_predictor_.reset(new NetworkActionPredictor(this)); 1580 network_action_predictor_.reset(new NetworkActionPredictor(this));
1581 return network_action_predictor_.get(); 1581 return network_action_predictor_.get();
1582 } 1582 }
1583 1583
1584 void ProfileImpl::SaveSessionState() { 1584 void ProfileImpl::SaveSessionState() {
1585 if (!session_restore_enabled_) 1585 if (!session_restore_enabled_)
1586 return; 1586 return;
1587 if (webkit_context_.get())
1588 webkit_context_->SaveSessionState();
1589 if (db_tracker_.get())
1590 db_tracker_->SaveSessionState();
1591
1587 BrowserThread::PostTask( 1592 BrowserThread::PostTask(
1588 BrowserThread::IO, FROM_HERE, 1593 BrowserThread::IO, FROM_HERE,
1589 base::Bind(&SaveSessionStateOnIOThread, 1594 base::Bind(&SaveSessionStateOnIOThread,
1590 make_scoped_refptr(GetRequestContext()))); 1595 make_scoped_refptr(GetRequestContext()),
1596 make_scoped_refptr(appcache_service_.get())));
1591 } 1597 }
1592 1598
1593 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { 1599 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() {
1594 if (!spellcheck_profile_.get()) 1600 if (!spellcheck_profile_.get())
1595 spellcheck_profile_.reset(new SpellCheckProfile(path_)); 1601 spellcheck_profile_.reset(new SpellCheckProfile(path_));
1596 return spellcheck_profile_.get(); 1602 return spellcheck_profile_.get();
1597 } 1603 }
1598 1604
1599 void ProfileImpl::UpdateProfileUserNameCache() { 1605 void ProfileImpl::UpdateProfileUserNameCache() {
1600 ProfileManager* profile_manager = g_browser_process->profile_manager(); 1606 ProfileManager* profile_manager = g_browser_process->profile_manager();
(...skipping 15 matching lines...) Expand all
1616 FilePath* cache_path, 1622 FilePath* cache_path,
1617 int* max_size) { 1623 int* max_size) {
1618 DCHECK(cache_path); 1624 DCHECK(cache_path);
1619 DCHECK(max_size); 1625 DCHECK(max_size);
1620 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); 1626 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir));
1621 if (!path.empty()) 1627 if (!path.empty())
1622 *cache_path = path; 1628 *cache_path = path;
1623 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1629 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1624 prefs_->GetInteger(prefs::kDiskCacheSize); 1630 prefs_->GetInteger(prefs::kDiskCacheSize);
1625 } 1631 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/appcache/chrome_appcache_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698