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/process_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/process/kill.h" | |
14 #include "base/process/process.h" | 13 #include "base/process/process.h" |
15 #include "base/process/process_info.h" | 14 #include "base/process/process_info.h" |
16 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
18 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time/time.h" | 18 #include "base/time/time.h" |
20 #include "base/win/metro.h" | 19 #include "base/win/metro.h" |
21 #include "base/win/registry.h" | 20 #include "base/win/registry.h" |
22 #include "base/win/scoped_handle.h" | 21 #include "base/win/scoped_handle.h" |
23 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // The user denied. Quit silently. | 287 // The user denied. Quit silently. |
289 return PROCESS_NOTIFIED; | 288 return PROCESS_NOTIFIED; |
290 } | 289 } |
291 | 290 |
292 // Record the termination event in the hung process' exit funnel. | 291 // Record the termination event in the hung process' exit funnel. |
293 browser_watcher::ExitFunnel funnel; | 292 browser_watcher::ExitFunnel funnel; |
294 if (funnel.Init(chrome::kBrowserExitCodesRegistryPath, process.Handle())) | 293 if (funnel.Init(chrome::kBrowserExitCodesRegistryPath, process.Handle())) |
295 funnel.RecordEvent(L"HungBrowserTerminated"); | 294 funnel.RecordEvent(L"HungBrowserTerminated"); |
296 | 295 |
297 // Time to take action. Kill the browser process. | 296 // Time to take action. Kill the browser process. |
298 base::KillProcess(process.Handle(), content::RESULT_CODE_HUNG, true); | 297 process.Terminate(content::RESULT_CODE_HUNG, true); |
299 remote_window_ = NULL; | 298 remote_window_ = NULL; |
300 return PROCESS_NONE; | 299 return PROCESS_NONE; |
301 } | 300 } |
302 | 301 |
303 ProcessSingleton::NotifyResult | 302 ProcessSingleton::NotifyResult |
304 ProcessSingleton::NotifyOtherProcessOrCreate() { | 303 ProcessSingleton::NotifyOtherProcessOrCreate() { |
305 ProcessSingleton::NotifyResult result = PROCESS_NONE; | 304 ProcessSingleton::NotifyResult result = PROCESS_NONE; |
306 if (!Create()) { | 305 if (!Create()) { |
307 result = NotifyOtherProcess(); | 306 result = NotifyOtherProcess(); |
308 if (result == PROCESS_NONE) | 307 if (result == PROCESS_NONE) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 ::SetEvent(metro_activation_event.Get()); | 429 ::SetEvent(metro_activation_event.Get()); |
431 } | 430 } |
432 } | 431 } |
433 } | 432 } |
434 | 433 |
435 return window_.hwnd() != NULL; | 434 return window_.hwnd() != NULL; |
436 } | 435 } |
437 | 436 |
438 void ProcessSingleton::Cleanup() { | 437 void ProcessSingleton::Cleanup() { |
439 } | 438 } |
OLD | NEW |