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

Side by Side Diff: content/browser/tab_contents/navigation_controller.cc

Issue 8418043: Temporary code to track down increase in renderer crashes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tab_contents/navigation_controller.h" 5 #include "content/browser/tab_contents/navigation_controller.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" // Temporary
9 #include "base/string_util.h" 10 #include "base/string_util.h"
10 #include "base/time.h" 11 #include "base/time.h"
11 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
12 #include "content/browser/browser_context.h" 13 #include "content/browser/browser_context.h"
13 #include "content/browser/browser_url_handler.h" 14 #include "content/browser/browser_url_handler.h"
14 #include "content/browser/child_process_security_policy.h" 15 #include "content/browser/child_process_security_policy.h"
15 #include "content/browser/in_process_webkit/session_storage_namespace.h" 16 #include "content/browser/in_process_webkit/session_storage_namespace.h"
17 #include "content/browser/renderer_host/render_view_host.h" // Temporary
16 #include "content/browser/site_instance.h" 18 #include "content/browser/site_instance.h"
17 #include "content/browser/tab_contents/interstitial_page.h" 19 #include "content/browser/tab_contents/interstitial_page.h"
18 #include "content/browser/tab_contents/navigation_details.h" 20 #include "content/browser/tab_contents/navigation_details.h"
19 #include "content/browser/tab_contents/navigation_entry.h" 21 #include "content/browser/tab_contents/navigation_entry.h"
20 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
21 #include "content/browser/tab_contents/tab_contents_delegate.h" 23 #include "content/browser/tab_contents/tab_contents_delegate.h"
22 #include "content/browser/user_metrics.h" 24 #include "content/browser/user_metrics.h"
23 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
24 #include "content/public/common/content_constants.h" 26 #include "content/public/common/content_constants.h"
25 #include "content/common/view_messages.h" 27 #include "content/common/view_messages.h"
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 if (existing_entry_index == -1) { 666 if (existing_entry_index == -1) {
665 // The page was not found. It could have been pruned because of the limit on 667 // The page was not found. It could have been pruned because of the limit on
666 // back/forward entries (not likely since we'll usually tell it to navigate 668 // back/forward entries (not likely since we'll usually tell it to navigate
667 // to such entries). It could also mean that the renderer is smoking crack. 669 // to such entries). It could also mean that the renderer is smoking crack.
668 NOTREACHED(); 670 NOTREACHED();
669 671
670 // Because the unknown entry has committed, we risk showing the wrong URL in 672 // Because the unknown entry has committed, we risk showing the wrong URL in
671 // release builds. Instead, we'll kill the renderer process to be safe. 673 // release builds. Instead, we'll kill the renderer process to be safe.
672 LOG(ERROR) << "terminating renderer for bad navigation: " << params.url; 674 LOG(ERROR) << "terminating renderer for bad navigation: " << params.url;
673 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_NC")); 675 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_NC"));
676
677 // Temporary code so we can get more information:
678 std::string temp = params.url.spec();;
679 temp.append("#");
680 temp.append(params.referrer.spec());
681 temp.append("#");
682 temp.append(base::IntToString(params.page_id));
683 for (int i = static_cast<int>(entries_.size()) - 1; i >= 0; --i) {
684 if (entries_[i]->site_instance() == tab_contents_->GetSiteInstance()) {
685 temp.append("#");
686 temp.append(base::IntToString(entries_[i]->page_id()));
687 }
688 }
689 GURL url(temp);
690 tab_contents_->render_view_host()->Send(new ViewMsg_TempCrashWithData(url));
691 return content::NAVIGATION_TYPE_NAV_IGNORE;
692
693
674 if (tab_contents_->GetSiteInstance()->HasProcess()) 694 if (tab_contents_->GetSiteInstance()->HasProcess())
675 tab_contents_->GetSiteInstance()->GetProcess()->ReceivedBadMessage(); 695 tab_contents_->GetSiteInstance()->GetProcess()->ReceivedBadMessage();
676 return content::NAVIGATION_TYPE_NAV_IGNORE; 696 return content::NAVIGATION_TYPE_NAV_IGNORE;
677 } 697 }
678 NavigationEntry* existing_entry = entries_[existing_entry_index].get(); 698 NavigationEntry* existing_entry = entries_[existing_entry_index].get();
679 699
680 if (!content::PageTransitionIsMainFrame(params.transition)) { 700 if (!content::PageTransitionIsMainFrame(params.transition)) {
681 // All manual subframes would get new IDs and were handled above, so we 701 // All manual subframes would get new IDs and were handled above, so we
682 // know this is auto. Since the current page was found in the navigation 702 // know this is auto. Since the current page was found in the navigation
683 // entry list, we're guaranteed to have a last committed entry. 703 // entry list, we're guaranteed to have a last committed entry.
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 for (int i = 0; i < max_index; i++) { 1249 for (int i = 0; i < max_index; i++) {
1230 // When cloning a tab, copy all entries except interstitial pages 1250 // When cloning a tab, copy all entries except interstitial pages
1231 if (source.entries_[i].get()->page_type() != 1251 if (source.entries_[i].get()->page_type() !=
1232 content::PAGE_TYPE_INTERSTITIAL) { 1252 content::PAGE_TYPE_INTERSTITIAL) {
1233 entries_.insert(entries_.begin() + insert_index++, 1253 entries_.insert(entries_.begin() + insert_index++,
1234 linked_ptr<NavigationEntry>( 1254 linked_ptr<NavigationEntry>(
1235 new NavigationEntry(*source.entries_[i]))); 1255 new NavigationEntry(*source.entries_[i])));
1236 } 1256 }
1237 } 1257 }
1238 } 1258 }
OLDNEW
« no previous file with comments | « no previous file | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698