Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 2711533002: Revert of Add DumpWithoutCrashing in RendererDidNavigateToExistingPage (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /* 5 /*
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 21 matching lines...) Expand all
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36 #include "content/browser/frame_host/navigation_controller_impl.h" 36 #include "content/browser/frame_host/navigation_controller_impl.h"
37 37
38 #include <utility> 38 #include <utility>
39 39
40 #include "base/bind.h" 40 #include "base/bind.h"
41 #include "base/command_line.h" 41 #include "base/command_line.h"
42 #include "base/debug/alias.h"
43 #include "base/debug/dump_without_crashing.h" 42 #include "base/debug/dump_without_crashing.h"
44 #include "base/logging.h" 43 #include "base/logging.h"
45 #include "base/memory/ptr_util.h" 44 #include "base/memory/ptr_util.h"
46 #include "base/metrics/histogram_macros.h" 45 #include "base/metrics/histogram_macros.h"
47 #include "base/strings/string_number_conversions.h" // Temporary 46 #include "base/strings/string_number_conversions.h" // Temporary
48 #include "base/strings/string_util.h" 47 #include "base/strings/string_util.h"
49 #include "base/strings/utf_string_conversions.h" 48 #include "base/strings/utf_string_conversions.h"
50 #include "base/time/time.h" 49 #include "base/time/time.h"
51 #include "base/trace_event/trace_event.h" 50 #include "base/trace_event/trace_event.h"
52 #include "build/build_config.h" 51 #include "build/build_config.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return true; 157 return true;
159 } 158 }
160 159
161 if (ui::PageTransitionCoreTypeIs(entry->GetTransitionType(), 160 if (ui::PageTransitionCoreTypeIs(entry->GetTransitionType(),
162 ui::PAGE_TRANSITION_LINK)) { 161 ui::PAGE_TRANSITION_LINK)) {
163 return true; 162 return true;
164 } 163 }
165 return false; 164 return false;
166 } 165 }
167 166
168 // TODO(estark): remove this DumpWithoutCrashing after investigating
169 // https://crbug.com/688425.
170 void MaybeDumpCopiedNonSameOriginEntry(
171 const std::string& navigation_description,
172 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
173 bool is_in_page,
174 NavigationEntry* entry) {
175 if (!entry)
176 return;
177 if (url::Origin(entry->GetURL()).IsSameOriginWith(url::Origin(params.url)))
178 return;
179
180 std::string debug_info =
181 navigation_description + ": " +
182 std::string(is_in_page ? "Is in page, " : "Is not in page, ") +
183 std::string(params.nav_entry_id ? "has nav entry id, "
184 : "does not have nav entry id, ") +
185 std::string(params.did_create_new_entry ? "did create new entry, "
186 : "did not create new entry, ") +
187 std::string(params.should_replace_current_entry
188 ? "should replace current entry, "
189 : "should not replace current entry, ") +
190 entry->GetURL().spec() + " -> " + params.url.spec();
191 char debug_buf[2000];
192 base::strlcpy(debug_buf, debug_info.c_str(), arraysize(debug_buf));
193 base::debug::Alias(&debug_buf);
194 base::debug::DumpWithoutCrashing();
195 }
196
197 } // namespace 167 } // namespace
198 168
199 // NavigationControllerImpl ---------------------------------------------------- 169 // NavigationControllerImpl ----------------------------------------------------
200 170
201 const size_t kMaxEntryCountForTestingNotSet = static_cast<size_t>(-1); 171 const size_t kMaxEntryCountForTestingNotSet = static_cast<size_t>(-1);
202 172
203 // static 173 // static
204 size_t NavigationControllerImpl::max_entry_count_for_testing_ = 174 size_t NavigationControllerImpl::max_entry_count_for_testing_ =
205 kMaxEntryCountForTestingNotSet; 175 kMaxEntryCountForTestingNotSet;
206 176
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 params.url, params.referrer, params.method, params.post_id); 1098 params.url, params.referrer, params.method, params.post_id);
1129 new_entry = GetLastCommittedEntry()->CloneAndReplace( 1099 new_entry = GetLastCommittedEntry()->CloneAndReplace(
1130 frame_entry, true, rfh->frame_tree_node(), 1100 frame_entry, true, rfh->frame_tree_node(),
1131 delegate_->GetFrameTree()->root()); 1101 delegate_->GetFrameTree()->root());
1132 1102
1133 // We expect |frame_entry| to be owned by |new_entry|. This should never 1103 // We expect |frame_entry| to be owned by |new_entry|. This should never
1134 // fail, because it's the main frame. 1104 // fail, because it's the main frame.
1135 CHECK(frame_entry->HasOneRef()); 1105 CHECK(frame_entry->HasOneRef());
1136 1106
1137 update_virtual_url = new_entry->update_virtual_url_with_url(); 1107 update_virtual_url = new_entry->update_virtual_url_with_url();
1138
1139 MaybeDumpCopiedNonSameOriginEntry("New page navigation", params, is_in_page,
1140 GetLastCommittedEntry());
1141 } 1108 }
1142 1109
1143 // Only make a copy of the pending entry if it is appropriate for the new page 1110 // Only make a copy of the pending entry if it is appropriate for the new page
1144 // that was just loaded. Verify this by checking if the entry corresponds 1111 // that was just loaded. Verify this by checking if the entry corresponds
1145 // to the given navigation handle. Additionally, coarsely check that: 1112 // to the given navigation handle. Additionally, coarsely check that:
1146 // 1. The SiteInstance hasn't been assigned to something else. 1113 // 1. The SiteInstance hasn't been assigned to something else.
1147 // 2. The pending entry was intended as a new entry, rather than being a 1114 // 2. The pending entry was intended as a new entry, rather than being a
1148 // history navigation that was interrupted by an unrelated, 1115 // history navigation that was interrupted by an unrelated,
1149 // renderer-initiated navigation. 1116 // renderer-initiated navigation.
1150 // TODO(csharrison): Investigate whether we can remove some of the coarser 1117 // TODO(csharrison): Investigate whether we can remove some of the coarser
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 1202
1236 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE 1203 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE
1237 // in https://crbug.com/596707. 1204 // in https://crbug.com/596707.
1238 1205
1239 NavigationEntryImpl* entry; 1206 NavigationEntryImpl* entry;
1240 if (params.intended_as_new_entry) { 1207 if (params.intended_as_new_entry) {
1241 // This was intended as a new entry but the pending entry was lost in the 1208 // This was intended as a new entry but the pending entry was lost in the
1242 // meanwhile and no new page was created. We are stuck at the last committed 1209 // meanwhile and no new page was created. We are stuck at the last committed
1243 // entry. 1210 // entry.
1244 entry = GetLastCommittedEntry(); 1211 entry = GetLastCommittedEntry();
1245 MaybeDumpCopiedNonSameOriginEntry("Existing page navigation", params,
1246 is_in_page, entry);
1247 } else if (params.nav_entry_id) { 1212 } else if (params.nav_entry_id) {
1248 // This is a browser-initiated navigation (back/forward/reload). 1213 // This is a browser-initiated navigation (back/forward/reload).
1249 entry = GetEntryWithUniqueID(params.nav_entry_id); 1214 entry = GetEntryWithUniqueID(params.nav_entry_id);
1250 1215
1251 // Needed for the restore case, where the serialized NavigationEntry doesn't 1216 // Needed for the restore case, where the serialized NavigationEntry doesn't
1252 // have the SSL state. Note that for in-page navigation, there's no 1217 // have the SSL state. Note that for in-page navigation, there's no
1253 // SSLStatus in the NavigationHandle so don't overwrite the existing entry's 1218 // SSLStatus in the NavigationHandle so don't overwrite the existing entry's
1254 // SSLStatus. 1219 // SSLStatus.
1255 if (!is_in_page) 1220 if (!is_in_page)
1256 entry->GetSSL() = handle->ssl_status(); 1221 entry->GetSSL() = handle->ssl_status();
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 } 2134 }
2170 } 2135 }
2171 } 2136 }
2172 2137
2173 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2138 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2174 const base::Callback<base::Time()>& get_timestamp_callback) { 2139 const base::Callback<base::Time()>& get_timestamp_callback) {
2175 get_timestamp_callback_ = get_timestamp_callback; 2140 get_timestamp_callback_ = get_timestamp_callback;
2176 } 2141 }
2177 2142
2178 } // namespace content 2143 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698