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

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

Issue 8774029: Delete desktop/shell instance correctly when chrome is shutting down (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: close windows before observers are destroyed. 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 | chrome/browser/chrome_browser_main_extra_parts_aura.h » ('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/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 } 1996 }
1997 1997
1998 void ChromeBrowserMainParts::PostMainMessageLoopRun() { 1998 void ChromeBrowserMainParts::PostMainMessageLoopRun() {
1999 // Start watching for jank during shutdown. It gets disarmed when 1999 // Start watching for jank during shutdown. It gets disarmed when
2000 // |shutdown_watcher_| object is destructed. 2000 // |shutdown_watcher_| object is destructed.
2001 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(90)); 2001 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(90));
2002 2002
2003 // Disarm the startup hang detector time bomb if it is still Arm'ed. 2003 // Disarm the startup hang detector time bomb if it is still Arm'ed.
2004 startup_watcher_->Disarm(); 2004 startup_watcher_->Disarm();
2005 2005
2006 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
2007 chrome_extra_parts_[i]->PostMainMessageLoopRun();
2008
2006 #if defined(OS_WIN) 2009 #if defined(OS_WIN)
2007 // If it's the first run, log the search engine chosen. We wait until 2010 // If it's the first run, log the search engine chosen. We wait until
2008 // shutdown because otherwise we can't be sure the user has finished 2011 // shutdown because otherwise we can't be sure the user has finished
2009 // selecting a search engine through the dialog reached from the first run 2012 // selecting a search engine through the dialog reached from the first run
2010 // bubble link. 2013 // bubble link.
2011 if (record_search_engine_) { 2014 if (record_search_engine_) {
2012 TemplateURLService* url_service = 2015 TemplateURLService* url_service =
2013 TemplateURLServiceFactory::GetForProfile(profile_); 2016 TemplateURLServiceFactory::GetForProfile(profile_);
2014 const TemplateURL* default_search_engine = 2017 const TemplateURL* default_search_engine =
2015 url_service->GetDefaultSearchProvider(); 2018 url_service->GetDefaultSearchProvider();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_); 2099 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_);
2097 master_prefs_.reset(); 2100 master_prefs_.reset();
2098 process_singleton_.reset(); 2101 process_singleton_.reset();
2099 2102
2100 // We need to do this check as late as possible, but due to modularity, this 2103 // We need to do this check as late as possible, but due to modularity, this
2101 // may be the last point in Chrome. This would be more effective if done at 2104 // may be the last point in Chrome. This would be more effective if done at
2102 // a higher level on the stack, so that it is impossible for an early return 2105 // a higher level on the stack, so that it is impossible for an early return
2103 // to bypass this code. Perhaps we need a *final* hook that is called on all 2106 // to bypass this code. Perhaps we need a *final* hook that is called on all
2104 // paths from content/browser/browser_main. 2107 // paths from content/browser/browser_main.
2105 CHECK(MetricsService::UmaMetricsProperlyShutdown()); 2108 CHECK(MetricsService::UmaMetricsProperlyShutdown());
2106
2107 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
2108 chrome_extra_parts_[i]->PostMainMessageLoopRun();
2109 } 2109 }
2110 2110
2111 // Public members: 2111 // Public members:
2112 2112
2113 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 2113 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
2114 chrome_extra_parts_.push_back(parts); 2114 chrome_extra_parts_.push_back(parts);
2115 } 2115 }
2116 2116
2117 // Misc ------------------------------------------------------------------------ 2117 // Misc ------------------------------------------------------------------------
2118 2118
(...skipping 17 matching lines...) Expand all
2136 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && 2136 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) &&
2137 (pre_read == "0" || pre_read == "1")) { 2137 (pre_read == "0" || pre_read == "1")) {
2138 std::string uma_name(name); 2138 std::string uma_name(name);
2139 uma_name += "_PreRead"; 2139 uma_name += "_PreRead";
2140 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; 2140 uma_name += pre_read == "1" ? "Enabled" : "Disabled";
2141 AddPreReadHistogramTime(uma_name.c_str(), time); 2141 AddPreReadHistogramTime(uma_name.c_str(), time);
2142 } 2142 }
2143 #endif 2143 #endif
2144 #endif 2144 #endif
2145 } 2145 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_main_extra_parts_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698