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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/atomic_ref_count.h" | 14 #include "base/atomic_ref_count.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/debug/alias.h" |
18 #include "base/debug/crash_logging.h" | 19 #include "base/debug/crash_logging.h" |
| 20 #include "base/debug/dump_without_crashing.h" |
19 #include "base/debug/leak_annotations.h" | 21 #include "base/debug/leak_annotations.h" |
20 #include "base/files/file_path.h" | 22 #include "base/files/file_path.h" |
21 #include "base/location.h" | 23 #include "base/location.h" |
22 #include "base/macros.h" | 24 #include "base/macros.h" |
23 #include "base/memory/ptr_util.h" | 25 #include "base/memory/ptr_util.h" |
24 #include "base/metrics/field_trial.h" | 26 #include "base/metrics/field_trial.h" |
25 #include "base/metrics/histogram_macros.h" | 27 #include "base/metrics/histogram_macros.h" |
26 #include "base/path_service.h" | 28 #include "base/path_service.h" |
27 #include "base/single_thread_task_runner.h" | 29 #include "base/single_thread_task_runner.h" |
28 #include "base/synchronization/waitable_event.h" | 30 #include "base/synchronization/waitable_event.h" |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 #endif | 1338 #endif |
1337 | 1339 |
1338 #if defined(LEAK_SANITIZER) | 1340 #if defined(LEAK_SANITIZER) |
1339 // Check for memory leaks now, before we start shutting down threads. Doing | 1341 // Check for memory leaks now, before we start shutting down threads. Doing |
1340 // this early means we won't report any shutdown-only leaks (as they have | 1342 // this early means we won't report any shutdown-only leaks (as they have |
1341 // not yet happened at this point). | 1343 // not yet happened at this point). |
1342 // If leaks are found, this will make the process exit immediately. | 1344 // If leaks are found, this will make the process exit immediately. |
1343 __lsan_do_leak_check(); | 1345 __lsan_do_leak_check(); |
1344 #endif | 1346 #endif |
1345 | 1347 |
| 1348 // TODO(sammiequon): This is used to help debug the crash in crbug.com/660962. |
| 1349 // Remove this when the crash is fixed or if verified to not be related to |
| 1350 // this. |
| 1351 if (!base::MessageLoop::current()->is_running()) { |
| 1352 std::string debug_info = KeepAliveRegistry::GetInstance()->ToString(); |
| 1353 char debug_buffer[100]; |
| 1354 base::strlcpy(debug_buffer, debug_info.c_str(), arraysize(debug_buffer)); |
| 1355 base::debug::Alias(&debug_buffer); |
| 1356 base::debug::DumpWithoutCrashing(); |
| 1357 } |
| 1358 |
1346 CHECK(base::MessageLoop::current()->is_running()); | 1359 CHECK(base::MessageLoop::current()->is_running()); |
1347 | 1360 |
1348 #if defined(OS_MACOSX) | 1361 #if defined(OS_MACOSX) |
1349 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1362 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1350 FROM_HERE, base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop)); | 1363 FROM_HERE, base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop)); |
1351 #endif | 1364 #endif |
1352 base::MessageLoop::current()->QuitWhenIdle(); | 1365 base::MessageLoop::current()->QuitWhenIdle(); |
1353 | 1366 |
1354 #if !defined(OS_ANDROID) | 1367 #if !defined(OS_ANDROID) |
1355 chrome::ShutdownIfNeeded(); | 1368 chrome::ShutdownIfNeeded(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 } | 1426 } |
1414 | 1427 |
1415 void BrowserProcessImpl::OnAutoupdateTimer() { | 1428 void BrowserProcessImpl::OnAutoupdateTimer() { |
1416 if (CanAutorestartForUpdate()) { | 1429 if (CanAutorestartForUpdate()) { |
1417 DLOG(WARNING) << "Detected update. Restarting browser."; | 1430 DLOG(WARNING) << "Detected update. Restarting browser."; |
1418 RestartBackgroundInstance(); | 1431 RestartBackgroundInstance(); |
1419 } | 1432 } |
1420 } | 1433 } |
1421 | 1434 |
1422 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1435 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |