Chromium Code Reviews| 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/ui/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 if (browser) | 743 if (browser) |
| 744 return browser; | 744 return browser; |
| 745 } else if (behavior == BrowserOpenBehavior::USE_EXISTING) { | 745 } else if (behavior == BrowserOpenBehavior::USE_EXISTING) { |
| 746 browser = chrome::FindTabbedBrowser(profile_, process_startup); | 746 browser = chrome::FindTabbedBrowser(profile_, process_startup); |
| 747 } | 747 } |
| 748 | 748 |
| 749 base::AutoReset<bool> synchronous_launch_resetter( | 749 base::AutoReset<bool> synchronous_launch_resetter( |
| 750 &StartupBrowserCreator::in_synchronous_profile_launch_, true); | 750 &StartupBrowserCreator::in_synchronous_profile_launch_, true); |
| 751 | 751 |
| 752 // OpenTabsInBrowser requires at least one tab be passed. As a fallback to | 752 // OpenTabsInBrowser requires at least one tab be passed. As a fallback to |
| 753 // prevent a crash, use the NTP if |tabs| is empty. | 753 // prevent a crash, use the NTP if |tabs| is empty. This shouldn't happen, |
| 754 // but could indicate an inconsistency where, e.g., we expected a session | |
| 755 // restore to happen but it did not occur/succeed. This has been observed when | |
| 756 // launching Chrome with the kRestoreLastSession switch, using a profile that | |
| 757 // does not normally restore, when a Chrome process is already running. | |
|
Peter Kasting
2016/11/02 17:54:51
I'm concerned with "this shouldn't happen" (which
tmartino
2016/11/02 18:04:40
Hmm, I can certainly take a look at stepping throu
Peter Kasting
2016/11/02 18:05:47
Right, I'm wondering if the fix is "detect that th
tmartino
2017/02/03 23:44:11
Spent about a day on this and wanted to close the
| |
| 754 browser = OpenTabsInBrowser( | 758 browser = OpenTabsInBrowser( |
| 755 browser, process_startup, | 759 browser, process_startup, |
| 756 (tabs.empty() | 760 (tabs.empty() |
| 757 ? StartupTabs({StartupTab(GURL(chrome::kChromeUINewTabURL), false)}) | 761 ? StartupTabs({StartupTab(GURL(chrome::kChromeUINewTabURL), false)}) |
| 758 : tabs)); | 762 : tabs)); |
| 759 | 763 |
| 760 // Now that a restore is no longer possible, it is safe to clear DOM storage, | 764 // Now that a restore is no longer possible, it is safe to clear DOM storage, |
| 761 // unless this is a crash recovery. | 765 // unless this is a crash recovery. |
| 762 if (!is_post_crash_launch) { | 766 if (!is_post_crash_launch) { |
| 763 content::BrowserContext::GetDefaultStoragePartition(profile_) | 767 content::BrowserContext::GetDefaultStoragePartition(profile_) |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1221 #if defined(OS_WIN) | 1225 #if defined(OS_WIN) |
| 1222 TriggeredProfileResetter* triggered_profile_resetter = | 1226 TriggeredProfileResetter* triggered_profile_resetter = |
| 1223 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1227 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
| 1224 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1228 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
| 1225 if (triggered_profile_resetter) { | 1229 if (triggered_profile_resetter) { |
| 1226 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1230 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
| 1227 } | 1231 } |
| 1228 #endif // defined(OS_WIN) | 1232 #endif // defined(OS_WIN) |
| 1229 return has_reset_trigger; | 1233 return has_reset_trigger; |
| 1230 } | 1234 } |
| OLD | NEW |