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/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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 jobject jcontent_view_core) { | 902 jobject jcontent_view_core) { |
903 content::ContentViewCore* content_view_core = | 903 content::ContentViewCore* content_view_core = |
904 content::ContentViewCore::GetNativeContentViewCore(env, | 904 content::ContentViewCore::GetNativeContentViewCore(env, |
905 jcontent_view_core); | 905 jcontent_view_core); |
906 DCHECK(content_view_core); | 906 DCHECK(content_view_core); |
907 | 907 |
908 if (content_view_core->GetLayer()->parent() == content_layer_) | 908 if (content_view_core->GetLayer()->parent() == content_layer_) |
909 content_view_core->GetLayer()->RemoveFromParent(); | 909 content_view_core->GetLayer()->RemoveFromParent(); |
910 } | 910 } |
911 | 911 |
912 static void Init(JNIEnv* env, jobject obj) { | 912 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
913 TRACE_EVENT0("native", "TabAndroid::Init"); | 913 TRACE_EVENT0("native", "TabAndroid::Init"); |
914 // This will automatically bind to the Java object and pass ownership there. | 914 // This will automatically bind to the Java object and pass ownership there. |
915 new TabAndroid(env, obj); | 915 new TabAndroid(env, obj); |
916 } | 916 } |
917 | 917 |
918 // static | 918 // static |
919 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 919 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
920 return RegisterNativesImpl(env); | 920 return RegisterNativesImpl(env); |
921 } | 921 } |
922 | 922 |
923 static void RecordStartupToCommitUma(JNIEnv* env, jclass jcaller) { | 923 static void RecordStartupToCommitUma(JNIEnv* env, |
| 924 const JavaParamRef<jclass>& jcaller) { |
924 // Currently it takes about 2000ms to commit a navigation if the measurement | 925 // Currently it takes about 2000ms to commit a navigation if the measurement |
925 // begins very early in the browser start. How many buckets (b) are needed to | 926 // begins very early in the browser start. How many buckets (b) are needed to |
926 // explore the _typical_ values with granularity 100ms and a maximum duration | 927 // explore the _typical_ values with granularity 100ms and a maximum duration |
927 // of 1 minute? | 928 // of 1 minute? |
928 // s^{n+1} / s^{n} = 2100 / 2000 | 929 // s^{n+1} / s^{n} = 2100 / 2000 |
929 // s = 1.05 | 930 // s = 1.05 |
930 // s^b = 60000 | 931 // s^b = 60000 |
931 // b = ln(60000) / ln(1.05) ~= 225 | 932 // b = ln(60000) / ln(1.05) ~= 225 |
932 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime", | 933 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime", |
933 base::Time::Now() - chrome::android::GetMainEntryPointTime(), | 934 base::Time::Now() - chrome::android::GetMainEntryPointTime(), |
934 base::TimeDelta::FromMilliseconds(1), | 935 base::TimeDelta::FromMilliseconds(1), |
935 base::TimeDelta::FromMinutes(1), | 936 base::TimeDelta::FromMinutes(1), |
936 225); | 937 225); |
937 } | 938 } |
OLD | NEW |