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/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "base/process/kill.h" | 14 #include "base/process/process.h" |
15 #include "base/process/process_handle.h" | 15 #include "base/process/process_handle.h" |
16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/browser_process_platform_part.h" | 19 #include "chrome/browser/browser_process_platform_part.h" |
20 #include "chrome/browser/browser_shutdown.h" | 20 #include "chrome/browser/browser_shutdown.h" |
21 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
22 #include "chrome/browser/download/download_service.h" | 22 #include "chrome/browser/download/download_service.h" |
23 #include "chrome/browser/lifetime/browser_close_manager.h" | 23 #include "chrome/browser/lifetime/browser_close_manager.h" |
24 #include "chrome/browser/metrics/thread_watcher.h" | 24 #include "chrome/browser/metrics/thread_watcher.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 #if defined(OS_WIN) | 299 #if defined(OS_WIN) |
300 // KillProcess ought to terminate the process without further ado, so if | 300 // KillProcess ought to terminate the process without further ado, so if |
301 // execution gets to this point, presumably this is normal exit. | 301 // execution gets to this point, presumably this is normal exit. |
302 funnel.RecordEvent(L"KillProcess"); | 302 funnel.RecordEvent(L"KillProcess"); |
303 #endif | 303 #endif |
304 | 304 |
305 // On Windows 7 and later, the system will consider the process ripe for | 305 // On Windows 7 and later, the system will consider the process ripe for |
306 // termination as soon as it hides or destroys its windows. Since any | 306 // termination as soon as it hides or destroys its windows. Since any |
307 // execution past that point will be non-deterministically cut short, we | 307 // execution past that point will be non-deterministically cut short, we |
308 // might as well put ourselves out of that misery deterministically. | 308 // might as well put ourselves out of that misery deterministically. |
309 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 309 base::Process::Current().Terminate(0, false); |
310 } | 310 } |
311 | 311 |
312 void IncrementKeepAliveCount() { | 312 void IncrementKeepAliveCount() { |
313 // Increment the browser process refcount as long as we're keeping the | 313 // Increment the browser process refcount as long as we're keeping the |
314 // application alive. | 314 // application alive. |
315 if (!WillKeepAlive()) | 315 if (!WillKeepAlive()) |
316 g_browser_process->AddRefModule(); | 316 g_browser_process->AddRefModule(); |
317 ++g_keep_alive_count; | 317 ++g_keep_alive_count; |
318 } | 318 } |
319 | 319 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // environment is still active. | 414 // environment is still active. |
415 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) | 415 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
416 return !ash::Shell::HasInstance(); | 416 return !ash::Shell::HasInstance(); |
417 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 417 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
418 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); | 418 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
419 #endif | 419 #endif |
420 return true; | 420 return true; |
421 } | 421 } |
422 | 422 |
423 } // namespace chrome | 423 } // namespace chrome |
OLD | NEW |