Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/frame_host/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1018 SiteInstanceImpl* site_instance, | 1018 SiteInstanceImpl* site_instance, |
| 1019 NavigationHandleImpl* navigation_handle) { | 1019 NavigationHandleImpl* navigation_handle) { |
| 1020 // If there is no browser-initiated pending entry for this navigation and it | 1020 // If there is no browser-initiated pending entry for this navigation and it |
| 1021 // is not for the error URL, create a pending entry using the current | 1021 // is not for the error URL, create a pending entry using the current |
| 1022 // SiteInstance, and ensure the address bar updates accordingly. We don't | 1022 // SiteInstance, and ensure the address bar updates accordingly. We don't |
| 1023 // know the referrer or extra headers at this point, but the referrer will | 1023 // know the referrer or extra headers at this point, but the referrer will |
| 1024 // be set properly upon commit. | 1024 // be set properly upon commit. |
| 1025 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); | 1025 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); |
| 1026 bool has_browser_initiated_pending_entry = | 1026 bool has_browser_initiated_pending_entry = |
| 1027 pending_entry && !pending_entry->is_renderer_initiated(); | 1027 pending_entry && !pending_entry->is_renderer_initiated(); |
| 1028 if (!has_browser_initiated_pending_entry) { | 1028 |
| 1029 // If there is a transient entry, creating a new pending entry will result | |
| 1030 // in deleting it, which leads to inconsistent state. | |
| 1031 bool has_transient_entry = !!controller_->GetTransientEntry(); | |
|
Charlie Reis
2016/04/13 06:03:37
I still think this is correct, but I just want to
Charlie Reis
2016/04/14 23:02:45
From your email, it sounds like we'll hang if we p
| |
| 1032 | |
| 1033 if (!has_browser_initiated_pending_entry && !has_transient_entry) { | |
| 1029 std::unique_ptr<NavigationEntryImpl> entry = | 1034 std::unique_ptr<NavigationEntryImpl> entry = |
| 1030 NavigationEntryImpl::FromNavigationEntry( | 1035 NavigationEntryImpl::FromNavigationEntry( |
| 1031 controller_->CreateNavigationEntry( | 1036 controller_->CreateNavigationEntry( |
| 1032 url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 1037 url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
| 1033 true /* is_renderer_initiated */, std::string(), | 1038 true /* is_renderer_initiated */, std::string(), |
| 1034 controller_->GetBrowserContext())); | 1039 controller_->GetBrowserContext())); |
| 1035 entry->set_site_instance(site_instance); | 1040 entry->set_site_instance(site_instance); |
| 1036 // TODO(creis): If there's a pending entry already, find a safe way to | 1041 // TODO(creis): If there's a pending entry already, find a safe way to |
| 1037 // update it instead of replacing it and copying over things like this. | 1042 // update it instead of replacing it and copying over things like this. |
| 1038 // That will allow us to skip the NavigationHandle update below as well. | 1043 // That will allow us to skip the NavigationHandle update below as well. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1090 if (pending_entry != controller_->GetVisibleEntry() || | 1095 if (pending_entry != controller_->GetVisibleEntry() || |
| 1091 !should_preserve_entry) { | 1096 !should_preserve_entry) { |
| 1092 controller_->DiscardPendingEntry(true); | 1097 controller_->DiscardPendingEntry(true); |
| 1093 | 1098 |
| 1094 // Also force the UI to refresh. | 1099 // Also force the UI to refresh. |
| 1095 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1100 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
| 1096 } | 1101 } |
| 1097 } | 1102 } |
| 1098 | 1103 |
| 1099 } // namespace content | 1104 } // namespace content |
| OLD | NEW |