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/leak_annotations.h" | 19 #include "base/debug/leak_annotations.h" |
20 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
21 #include "base/location.h" | 21 #include "base/location.h" |
22 #include "base/macros.h" | 22 #include "base/macros.h" |
23 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
24 #include "base/metrics/field_trial.h" | 24 #include "base/metrics/field_trial.h" |
25 #include "base/metrics/histogram_macros.h" | 25 #include "base/metrics/histogram_macros.h" |
26 #include "base/path_service.h" | 26 #include "base/path_service.h" |
27 #include "base/single_thread_task_runner.h" | 27 #include "base/single_thread_task_runner.h" |
28 #include "base/synchronization/waitable_event.h" | 28 #include "base/synchronization/waitable_event.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 70 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
71 #include "chrome/browser/shell_integration.h" | 71 #include "chrome/browser/shell_integration.h" |
72 #include "chrome/browser/status_icons/status_tray.h" | 72 #include "chrome/browser/status_icons/status_tray.h" |
73 #include "chrome/browser/ui/browser_dialogs.h" | 73 #include "chrome/browser/ui/browser_dialogs.h" |
74 #include "chrome/browser/ui/browser_finder.h" | 74 #include "chrome/browser/ui/browser_finder.h" |
75 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" | 75 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" |
76 #include "chrome/common/channel_info.h" | 76 #include "chrome/common/channel_info.h" |
77 #include "chrome/common/chrome_constants.h" | 77 #include "chrome/common/chrome_constants.h" |
78 #include "chrome/common/chrome_paths.h" | 78 #include "chrome/common/chrome_paths.h" |
79 #include "chrome/common/chrome_switches.h" | 79 #include "chrome/common/chrome_switches.h" |
80 #include "chrome/common/crash_keys.h" | |
80 #include "chrome/common/extensions/chrome_extensions_client.h" | 81 #include "chrome/common/extensions/chrome_extensions_client.h" |
81 #include "chrome/common/extensions/extension_process_policy.h" | 82 #include "chrome/common/extensions/extension_process_policy.h" |
82 #include "chrome/common/features.h" | 83 #include "chrome/common/features.h" |
83 #include "chrome/common/pref_names.h" | 84 #include "chrome/common/pref_names.h" |
84 #include "chrome/common/switch_utils.h" | 85 #include "chrome/common/switch_utils.h" |
85 #include "chrome/common/url_constants.h" | 86 #include "chrome/common/url_constants.h" |
86 #include "chrome/installer/util/google_update_constants.h" | 87 #include "chrome/installer/util/google_update_constants.h" |
87 #include "chrome/installer/util/google_update_settings.h" | 88 #include "chrome/installer/util/google_update_settings.h" |
88 #include "components/component_updater/component_updater_service.h" | 89 #include "components/component_updater/component_updater_service.h" |
89 #include "components/gcm_driver/gcm_driver.h" | 90 #include "components/gcm_driver/gcm_driver.h" |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1307 #elif !defined(OS_ANDROID) | 1308 #elif !defined(OS_ANDROID) |
1308 cached_default_web_client_state_ = shell_integration::GetDefaultBrowser(); | 1309 cached_default_web_client_state_ = shell_integration::GetDefaultBrowser(); |
1309 #endif | 1310 #endif |
1310 } | 1311 } |
1311 | 1312 |
1312 void BrowserProcessImpl::Pin() { | 1313 void BrowserProcessImpl::Pin() { |
1313 DCHECK(CalledOnValidThread()); | 1314 DCHECK(CalledOnValidThread()); |
1314 | 1315 |
1315 // CHECK(!IsShuttingDown()); | 1316 // CHECK(!IsShuttingDown()); |
1316 if (IsShuttingDown()) { | 1317 if (IsShuttingDown()) { |
1317 // Copy the stacktrace which released the final reference onto our stack so | 1318 base::debug::SetCrashKeyToStackTrace(crash_keys::kBrowserUnpinTrace, |
eroman
2016/12/14 20:40:24
Have you tested that this works?
I am pretty sure
dgn
2016/12/16 19:10:42
Thanks! Sadly we don't have a reliable repro for t
| |
1318 // it will be available in the crash report for inspection. | 1319 release_last_reference_callstack_); |
1319 base::debug::StackTrace callstack = release_last_reference_callstack_; | |
1320 base::debug::Alias(&callstack); | |
1321 CHECK(false); | 1320 CHECK(false); |
eroman
2016/12/14 20:40:24
I imagine there should be something like:
// TODO
dgn
2016/12/16 19:10:42
Not sure if temporary... you added that almost 5 y
eroman
2016/12/16 19:28:16
Heh, nothing quite as durable as a "temporary" hac
| |
1322 } | 1321 } |
1323 } | 1322 } |
1324 | 1323 |
1325 void BrowserProcessImpl::Unpin() { | 1324 void BrowserProcessImpl::Unpin() { |
1326 DCHECK(CalledOnValidThread()); | 1325 DCHECK(CalledOnValidThread()); |
1327 release_last_reference_callstack_ = base::debug::StackTrace(); | 1326 release_last_reference_callstack_ = base::debug::StackTrace(); |
1328 | 1327 |
1329 shutting_down_ = true; | 1328 shutting_down_ = true; |
1330 #if BUILDFLAG(ENABLE_PRINTING) | 1329 #if BUILDFLAG(ENABLE_PRINTING) |
1331 // Wait for the pending print jobs to finish. Don't do this later, since | 1330 // Wait for the pending print jobs to finish. Don't do this later, since |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1412 } | 1411 } |
1413 | 1412 |
1414 void BrowserProcessImpl::OnAutoupdateTimer() { | 1413 void BrowserProcessImpl::OnAutoupdateTimer() { |
1415 if (CanAutorestartForUpdate()) { | 1414 if (CanAutorestartForUpdate()) { |
1416 DLOG(WARNING) << "Detected update. Restarting browser."; | 1415 DLOG(WARNING) << "Detected update. Restarting browser."; |
1417 RestartBackgroundInstance(); | 1416 RestartBackgroundInstance(); |
1418 } | 1417 } |
1419 } | 1418 } |
1420 | 1419 |
1421 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1420 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |