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

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 6308001: When clearing plugin data at shutdown, wait for it to finish. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unnecessary stuff Created 9 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 | 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/browser_process_impl.h" 5 #include "chrome/browser/browser_process_impl.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 void BrowserProcessImpl::Observe(NotificationType type, 535 void BrowserProcessImpl::Observe(NotificationType type,
536 const NotificationSource& source, 536 const NotificationSource& source,
537 const NotificationDetails& details) { 537 const NotificationDetails& details) {
538 if (type == NotificationType::APP_TERMINATING) { 538 if (type == NotificationType::APP_TERMINATING) {
539 Profile* profile = ProfileManager::GetDefaultProfile(); 539 Profile* profile = ProfileManager::GetDefaultProfile();
540 if (profile) { 540 if (profile) {
541 PrefService* prefs = profile->GetPrefs(); 541 PrefService* prefs = profile->GetPrefs();
542 if (prefs->GetBoolean(prefs::kClearSiteDataOnExit) && 542 if (prefs->GetBoolean(prefs::kClearSiteDataOnExit) &&
543 local_state()->GetBoolean(prefs::kClearPluginLSODataEnabled)) { 543 local_state()->GetBoolean(prefs::kClearPluginLSODataEnabled)) {
544 plugin_data_remover_ = new PluginDataRemover(); 544 plugin_data_remover_ = new PluginDataRemover();
545 plugin_data_remover_->StartRemoving(base::Time(), NULL); 545 if (!plugin_data_remover_mime_type().empty())
546 plugin_data_remover_->set_mime_type(plugin_data_remover_mime_type());
547 plugin_data_remover_->StartRemoving(base::Time());
546 } 548 }
547 } 549 }
548 } else { 550 } else {
549 NOTREACHED(); 551 NOTREACHED();
550 } 552 }
551 } 553 }
552 554
553 void BrowserProcessImpl::WaitForPluginDataRemoverToFinish() { 555 void BrowserProcessImpl::WaitForPluginDataRemoverToFinish() {
554 if (!plugin_data_remover_.get() || !plugin_data_remover_->is_removing()) 556 if (plugin_data_remover_.get())
555 return; 557 plugin_data_remover_->Wait();
556 plugin_data_remover_->set_done_task(new MessageLoop::QuitTask());
557 base::Time start_time(base::Time::Now());
558 MessageLoop::current()->Run();
559 UMA_HISTOGRAM_TIMES("ClearPluginData.wait_at_shutdown",
560 base::Time::Now() - start_time);
561 } 558 }
562 559
563 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 560 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
564 void BrowserProcessImpl::StartAutoupdateTimer() { 561 void BrowserProcessImpl::StartAutoupdateTimer() {
565 autoupdate_timer_.Start( 562 autoupdate_timer_.Start(
566 base::TimeDelta::FromHours(kUpdateCheckIntervalHours), 563 base::TimeDelta::FromHours(kUpdateCheckIntervalHours),
567 this, 564 this,
568 &BrowserProcessImpl::OnAutoupdateTimer); 565 &BrowserProcessImpl::OnAutoupdateTimer);
569 } 566 }
570 #endif 567 #endif
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 } 913 }
917 914
918 void BrowserProcessImpl::OnAutoupdateTimer() { 915 void BrowserProcessImpl::OnAutoupdateTimer() {
919 if (CanAutorestartForUpdate()) { 916 if (CanAutorestartForUpdate()) {
920 DLOG(WARNING) << "Detected update. Restarting browser."; 917 DLOG(WARNING) << "Detected update. Restarting browser.";
921 RestartPersistentInstance(); 918 RestartPersistentInstance();
922 } 919 }
923 } 920 }
924 921
925 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 922 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698