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

Side by Side Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 176363002: Rename Start/EndKeepAlive to Increment/DecrementKeepAliveCount (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (rename_keep_alive) Created 6 years, 9 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) 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/lifetime/application_lifetime.h" 5 #include "chrome/browser/lifetime/application_lifetime.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 content::NotificationService::AllSources(), 293 content::NotificationService::AllSources(),
294 content::NotificationService::NoDetails()); 294 content::NotificationService::NoDetails());
295 295
296 #if defined(OS_WIN) 296 #if defined(OS_WIN)
297 base::win::SetShouldCrashOnProcessDetach(false); 297 base::win::SetShouldCrashOnProcessDetach(false);
298 #endif 298 #endif
299 // This will end by terminating the process. 299 // This will end by terminating the process.
300 content::ImmediateShutdownAndExitProcess(); 300 content::ImmediateShutdownAndExitProcess();
301 } 301 }
302 302
303 void StartKeepAlive() { 303 void IncrementKeepAliveCount() {
304 // Increment the browser process refcount as long as we're keeping the 304 // Increment the browser process refcount as long as we're keeping the
305 // application alive. 305 // application alive.
306 if (!WillKeepAlive()) 306 if (!WillKeepAlive())
307 g_browser_process->AddRefModule(); 307 g_browser_process->AddRefModule();
308 ++g_keep_alive_count; 308 ++g_keep_alive_count;
309 } 309 }
310 310
311 void EndKeepAlive() { 311 void DecrementKeepAliveCount() {
312 DCHECK_GT(g_keep_alive_count, 0); 312 DCHECK_GT(g_keep_alive_count, 0);
313 --g_keep_alive_count; 313 --g_keep_alive_count;
314 314
315 DCHECK(g_browser_process); 315 DCHECK(g_browser_process);
316 // Although we should have a browser process, if there is none, 316 // Although we should have a browser process, if there is none,
317 // there is nothing to do. 317 // there is nothing to do.
318 if (!g_browser_process) return; 318 if (!g_browser_process) return;
319 319
320 // Allow the app to shutdown again. 320 // Allow the app to shutdown again.
321 if (!WillKeepAlive()) { 321 if (!WillKeepAlive()) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // environment is still active. 405 // environment is still active.
406 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) 406 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE)
407 return !ash::Shell::HasInstance(); 407 return !ash::Shell::HasInstance();
408 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) 408 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
409 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); 409 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty();
410 #endif 410 #endif
411 return true; 411 return true;
412 } 412 }
413 413
414 } // namespace chrome 414 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/lifetime/application_lifetime.h ('k') | chrome/browser/lifetime/application_lifetime_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698