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

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 1299513002: [Android] Add support for a hung renderer dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
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/android/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "content/public/browser/android/content_view_core.h" 61 #include "content/public/browser/android/content_view_core.h"
62 #include "content/public/browser/browser_thread.h" 62 #include "content/public/browser/browser_thread.h"
63 #include "content/public/browser/interstitial_page.h" 63 #include "content/public/browser/interstitial_page.h"
64 #include "content/public/browser/navigation_entry.h" 64 #include "content/public/browser/navigation_entry.h"
65 #include "content/public/browser/notification_service.h" 65 #include "content/public/browser/notification_service.h"
66 #include "content/public/browser/render_frame_host.h" 66 #include "content/public/browser/render_frame_host.h"
67 #include "content/public/browser/render_process_host.h" 67 #include "content/public/browser/render_process_host.h"
68 #include "content/public/browser/render_view_host.h" 68 #include "content/public/browser/render_view_host.h"
69 #include "content/public/browser/user_metrics.h" 69 #include "content/public/browser/user_metrics.h"
70 #include "content/public/browser/web_contents.h" 70 #include "content/public/browser/web_contents.h"
71 #include "content/public/common/result_codes.h"
71 #include "content/public/common/top_controls_state.h" 72 #include "content/public/common/top_controls_state.h"
72 #include "jni/Tab_jni.h" 73 #include "jni/Tab_jni.h"
73 #include "net/base/escape.h" 74 #include "net/base/escape.h"
74 #include "skia/ext/image_operations.h" 75 #include "skia/ext/image_operations.h"
75 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 76 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
76 #include "ui/base/resource/resource_bundle.h" 77 #include "ui/base/resource/resource_bundle.h"
77 #include "ui/base/window_open_disposition.h" 78 #include "ui/base/window_open_disposition.h"
78 #include "ui/gfx/android/device_display_info.h" 79 #include "ui/gfx/android/device_display_info.h"
79 #include "ui/gfx/android/java_bitmap.h" 80 #include "ui/gfx/android/java_bitmap.h"
80 #include "ui/gfx/favicon_size.h" 81 #include "ui/gfx/favicon_size.h"
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 } 788 }
788 789
789 return -1; 790 return -1;
790 } 791 }
791 792
792 bool TabAndroid::HasPrerenderedUrl(JNIEnv* env, jobject obj, jstring url) { 793 bool TabAndroid::HasPrerenderedUrl(JNIEnv* env, jobject obj, jstring url) {
793 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url)); 794 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url));
794 return HasPrerenderedUrl(gurl); 795 return HasPrerenderedUrl(gurl);
795 } 796 }
796 797
798 void TabAndroid::ShutdownHungRenderer(JNIEnv* env, jobject obj) {
799 DCHECK(web_contents());
800 content::RenderProcessHost* process = web_contents()->GetRenderProcessHost();
801 process->Shutdown(content::RESULT_CODE_HUNG, false);
802 }
803
797 namespace { 804 namespace {
798 805
799 class ChromeInterceptNavigationDelegate : public InterceptNavigationDelegate { 806 class ChromeInterceptNavigationDelegate : public InterceptNavigationDelegate {
800 public: 807 public:
801 ChromeInterceptNavigationDelegate(JNIEnv* env, jobject jdelegate) 808 ChromeInterceptNavigationDelegate(JNIEnv* env, jobject jdelegate)
802 : InterceptNavigationDelegate(env, jdelegate) {} 809 : InterceptNavigationDelegate(env, jdelegate) {}
803 810
804 bool ShouldIgnoreNavigation( 811 bool ShouldIgnoreNavigation(
805 const NavigationParams& navigation_params) override { 812 const NavigationParams& navigation_params) override {
806 NavigationParams chrome_navigation_params(navigation_params); 813 NavigationParams chrome_navigation_params(navigation_params);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 // s^{n+1} / s^{n} = 2100 / 2000 887 // s^{n+1} / s^{n} = 2100 / 2000
881 // s = 1.05 888 // s = 1.05
882 // s^b = 60000 889 // s^b = 60000
883 // b = ln(60000) / ln(1.05) ~= 225 890 // b = ln(60000) / ln(1.05) ~= 225
884 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime", 891 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime",
885 base::Time::Now() - chrome::android::GetMainEntryPointTime(), 892 base::Time::Now() - chrome::android::GetMainEntryPointTime(),
886 base::TimeDelta::FromMilliseconds(1), 893 base::TimeDelta::FromMilliseconds(1),
887 base::TimeDelta::FromMinutes(1), 894 base::TimeDelta::FromMinutes(1),
888 225); 895 225);
889 } 896 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698