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

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

Issue 7234014: Move code to clear web databases on shutdown to the database tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 6 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 | Annotate | Revision Log
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 NotificationService::NoDetails()); 606 NotificationService::NoDetails());
607 607
608 StopCreateSessionServiceTimer(); 608 StopCreateSessionServiceTimer();
609 609
610 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); 610 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
611 611
612 if (clear_local_state_on_exit_) { 612 if (clear_local_state_on_exit_) {
613 BrowserThread::PostTask( 613 BrowserThread::PostTask(
614 BrowserThread::FILE, FROM_HERE, 614 BrowserThread::FILE, FROM_HERE,
615 NewRunnableFunction(&BrowsingDataRemover::ClearGearsData, path_)); 615 NewRunnableFunction(&BrowsingDataRemover::ClearGearsData, path_));
616 if (db_tracker_.get())
617 db_tracker_->Shutdown();
616 } 618 }
617 619
618 // DownloadManager is lazily created, so check before accessing it. 620 // DownloadManager is lazily created, so check before accessing it.
619 if (download_manager_.get()) { 621 if (download_manager_.get()) {
620 // The download manager queries the history system and should be shut down 622 // The download manager queries the history system and should be shut down
621 // before the history is shut down so it can properly cancel all requests. 623 // before the history is shut down so it can properly cancel all requests.
622 download_manager_->Shutdown(); 624 download_manager_->Shutdown();
623 download_manager_ = NULL; 625 download_manager_ = NULL;
624 } 626 }
625 627
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 1320 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
1319 GetExtensionSpecialStoragePolicy()); 1321 GetExtensionSpecialStoragePolicy());
1320 1322
1321 // Each consumer is responsible for registering its QuotaClient during 1323 // Each consumer is responsible for registering its QuotaClient during
1322 // its construction. 1324 // its construction.
1323 file_system_context_ = CreateFileSystemContext( 1325 file_system_context_ = CreateFileSystemContext(
1324 GetPath(), IsOffTheRecord(), 1326 GetPath(), IsOffTheRecord(),
1325 GetExtensionSpecialStoragePolicy(), 1327 GetExtensionSpecialStoragePolicy(),
1326 quota_manager_->proxy()); 1328 quota_manager_->proxy());
1327 db_tracker_ = new webkit_database::DatabaseTracker( 1329 db_tracker_ = new webkit_database::DatabaseTracker(
1328 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), 1330 GetPath(), IsOffTheRecord(), clear_local_state_on_exit_,
1331 GetExtensionSpecialStoragePolicy(),
1329 quota_manager_->proxy(), 1332 quota_manager_->proxy(),
1330 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 1333 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
1331 webkit_context_ = new WebKitContext( 1334 webkit_context_ = new WebKitContext(
1332 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), 1335 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
1333 clear_local_state_on_exit_, quota_manager_->proxy(), 1336 clear_local_state_on_exit_, quota_manager_->proxy(),
1334 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); 1337 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT));
1335 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); 1338 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy());
1336 BrowserThread::PostTask( 1339 BrowserThread::PostTask(
1337 BrowserThread::IO, FROM_HERE, 1340 BrowserThread::IO, FROM_HERE,
1338 NewRunnableMethod( 1341 NewRunnableMethod(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 clear_local_state_on_exit_ = 1396 clear_local_state_on_exit_ =
1394 prefs->GetBoolean(prefs::kClearSiteDataOnExit); 1397 prefs->GetBoolean(prefs::kClearSiteDataOnExit);
1395 if (webkit_context_) { 1398 if (webkit_context_) {
1396 webkit_context_->set_clear_local_state_on_exit( 1399 webkit_context_->set_clear_local_state_on_exit(
1397 clear_local_state_on_exit_); 1400 clear_local_state_on_exit_);
1398 } 1401 }
1399 if (appcache_service_) { 1402 if (appcache_service_) {
1400 appcache_service_->SetClearLocalStateOnExit( 1403 appcache_service_->SetClearLocalStateOnExit(
1401 clear_local_state_on_exit_); 1404 clear_local_state_on_exit_);
1402 } 1405 }
1406 if (db_tracker_) {
1407 db_tracker_->SetClearLocalStateOnExit(
1408 clear_local_state_on_exit_);
1409 }
1403 } else if (*pref_name_in == prefs::kGoogleServicesUsername) { 1410 } else if (*pref_name_in == prefs::kGoogleServicesUsername) {
1404 ProfileManager* profile_manager = g_browser_process->profile_manager(); 1411 ProfileManager* profile_manager = g_browser_process->profile_manager();
1405 profile_manager->RegisterProfileName(this); 1412 profile_manager->RegisterProfileName(this);
1406 } else if (*pref_name_in == prefs::kDefaultZoomLevel) { 1413 } else if (*pref_name_in == prefs::kDefaultZoomLevel) {
1407 GetHostZoomMap()->set_default_zoom_level( 1414 GetHostZoomMap()->set_default_zoom_level(
1408 prefs->GetDouble(prefs::kDefaultZoomLevel)); 1415 prefs->GetDouble(prefs::kDefaultZoomLevel));
1409 } 1416 }
1410 break; 1417 break;
1411 } 1418 }
1412 case NotificationType::BOOKMARK_MODEL_LOADED: 1419 case NotificationType::BOOKMARK_MODEL_LOADED:
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 if (!prerender::PrerenderManager::IsPrerenderingPossible()) 1658 if (!prerender::PrerenderManager::IsPrerenderingPossible())
1652 return NULL; 1659 return NULL;
1653 if (!prerender_manager_.get()) { 1660 if (!prerender_manager_.get()) {
1654 CHECK(g_browser_process->prerender_tracker()); 1661 CHECK(g_browser_process->prerender_tracker());
1655 prerender_manager_.reset( 1662 prerender_manager_.reset(
1656 new prerender::PrerenderManager( 1663 new prerender::PrerenderManager(
1657 this, g_browser_process->prerender_tracker())); 1664 this, g_browser_process->prerender_tracker()));
1658 } 1665 }
1659 return prerender_manager_.get(); 1666 return prerender_manager_.get();
1660 } 1667 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698