OLD | NEW |
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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
16 #include "base/process/kill.h" | 16 #include "base/process/kill.h" |
17 #include "base/process/process.h" | 17 #include "base/process/process_handle.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/browser_process_platform_part.h" | 20 #include "chrome/browser/browser_process_platform_part.h" |
21 #include "chrome/browser/browser_shutdown.h" | 21 #include "chrome/browser/browser_shutdown.h" |
22 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
23 #include "chrome/browser/download/download_service.h" | 23 #include "chrome/browser/download/download_service.h" |
24 #include "chrome/browser/lifetime/browser_close_manager.h" | 24 #include "chrome/browser/lifetime/browser_close_manager.h" |
25 #include "chrome/browser/metrics/thread_watcher.h" | 25 #include "chrome/browser/metrics/thread_watcher.h" |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 content::NotificationService::AllSources(), | 302 content::NotificationService::AllSources(), |
303 content::NotificationService::NoDetails()); | 303 content::NotificationService::NoDetails()); |
304 | 304 |
305 // This will end by terminating the process. | 305 // This will end by terminating the process. |
306 content::ImmediateShutdownAndExitProcess(); | 306 content::ImmediateShutdownAndExitProcess(); |
307 } else { | 307 } else { |
308 // On Windows 7 and later, the system will consider the process ripe for | 308 // On Windows 7 and later, the system will consider the process ripe for |
309 // termination as soon as it hides or destroys its windows. Since any | 309 // termination as soon as it hides or destroys its windows. Since any |
310 // execution past that point will be non-deterministically cut short, we | 310 // execution past that point will be non-deterministically cut short, we |
311 // might as well put ourselves out of that misery deterministically. | 311 // might as well put ourselves out of that misery deterministically. |
312 base::KillProcess(base::Process::Current().handle(), 0, false); | 312 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 void IncrementKeepAliveCount() { | 316 void IncrementKeepAliveCount() { |
317 // Increment the browser process refcount as long as we're keeping the | 317 // Increment the browser process refcount as long as we're keeping the |
318 // application alive. | 318 // application alive. |
319 if (!WillKeepAlive()) | 319 if (!WillKeepAlive()) |
320 g_browser_process->AddRefModule(); | 320 g_browser_process->AddRefModule(); |
321 ++g_keep_alive_count; | 321 ++g_keep_alive_count; |
322 } | 322 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 // environment is still active. | 418 // environment is still active. |
419 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) | 419 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
420 return !ash::Shell::HasInstance(); | 420 return !ash::Shell::HasInstance(); |
421 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 421 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
422 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); | 422 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
423 #endif | 423 #endif |
424 return true; | 424 return true; |
425 } | 425 } |
426 | 426 |
427 } // namespace chrome | 427 } // namespace chrome |
OLD | NEW |