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

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

Issue 1931503002: Add BackgroundModeOptimizer that can restart the browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PushKeepAlive
Patch Set: cleanup, enable by default (that's just to verify the tests) Created 4 years, 5 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
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/browser_shutdown.h" 5 #include "chrome/browser/browser_shutdown.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 #if defined(ENABLE_RLZ) 188 #if defined(ENABLE_RLZ)
189 // Cleanup any statics created by RLZ. Must be done before NotificationService 189 // Cleanup any statics created by RLZ. Must be done before NotificationService
190 // is destroyed. 190 // is destroyed.
191 rlz::RLZTracker::CleanupRlz(); 191 rlz::RLZTracker::CleanupRlz();
192 #endif 192 #endif
193 193
194 return restart_last_session; 194 return restart_last_session;
195 } 195 }
196 196
197 void ShutdownPostThreadsStop(bool restart_last_session) { 197 void ShutdownPostThreadsStop(bool restart_last_session,
198 bool restart_in_background) {
198 delete g_browser_process; 199 delete g_browser_process;
199 g_browser_process = NULL; 200 g_browser_process = NULL;
200 201
201 // crbug.com/95079 - This needs to happen after the browser process object 202 // crbug.com/95079 - This needs to happen after the browser process object
202 // goes away. 203 // goes away.
203 ProfileManager::NukeDeletedProfilesFromDisk(); 204 ProfileManager::NukeDeletedProfilesFromDisk();
204 205
205 #if defined(OS_CHROMEOS) 206 #if defined(OS_CHROMEOS)
206 chromeos::BootTimesRecorder::Get()->AddLogoutTimeMarker("BrowserDeleted", 207 chromeos::BootTimesRecorder::Get()->AddLogoutTimeMarker("BrowserDeleted",
207 true); 208 true);
(...skipping 24 matching lines...) Expand all
232 about_flags::RemoveFlagsSwitches(&switches); 233 about_flags::RemoveFlagsSwitches(&switches);
233 switches::RemoveSwitchesForAutostart(&switches); 234 switches::RemoveSwitchesForAutostart(&switches);
234 // Append the old switches to the new command line. 235 // Append the old switches to the new command line.
235 for (const auto& it : switches) { 236 for (const auto& it : switches) {
236 const base::CommandLine::StringType& switch_value = it.second; 237 const base::CommandLine::StringType& switch_value = it.second;
237 if (!switch_value.empty()) 238 if (!switch_value.empty())
238 new_cl->AppendSwitchNative(it.first, it.second); 239 new_cl->AppendSwitchNative(it.first, it.second);
239 else 240 else
240 new_cl->AppendSwitch(it.first); 241 new_cl->AppendSwitch(it.first);
241 } 242 }
243 if (restart_in_background)
244 new_cl->AppendSwitch(switches::kNoStartupWindow);
242 245
243 #if defined(OS_POSIX) || defined(OS_WIN) 246 #if defined(OS_POSIX) || defined(OS_WIN)
244 upgrade_util::RelaunchChromeBrowser(*new_cl.get()); 247 upgrade_util::RelaunchChromeBrowser(*new_cl.get());
245 #endif // defined(OS_WIN) 248 #endif // defined(OS_WIN)
246 249
247 #else 250 #else
248 NOTIMPLEMENTED(); 251 NOTIMPLEMENTED();
249 #endif // !defined(OS_CHROMEOS) 252 #endif // !defined(OS_CHROMEOS)
250 } 253 }
251 254
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 base::trace_event::TraceConfig trace_config( 345 base::trace_event::TraceConfig trace_config(
343 command_line.GetSwitchValueASCII(switches::kTraceShutdown), ""); 346 command_line.GetSwitchValueASCII(switches::kTraceShutdown), "");
344 content::TracingController::GetInstance()->StartTracing( 347 content::TracingController::GetInstance()->StartTracing(
345 trace_config, 348 trace_config,
346 content::TracingController::StartTracingDoneCallback()); 349 content::TracingController::StartTracingDoneCallback());
347 } 350 }
348 TRACE_EVENT0("shutdown", "StartShutdownTracing"); 351 TRACE_EVENT0("shutdown", "StartShutdownTracing");
349 } 352 }
350 353
351 } // namespace browser_shutdown 354 } // namespace browser_shutdown
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698