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

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 11959036: Implement vsync notification on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/android/content_view_core_impl.cc
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 32cd33500404133cd7f372b5dfd90ae9af493000..ea8a835ba99cad1c047b498dab269649a9215367 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -357,6 +357,12 @@ void ContentViewCoreImpl::Hide() {
}
void ContentViewCoreImpl::OnTabCrashed() {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
+ if (obj.is_null())
+ return;
+ Java_ContentViewCore_resetVSyncNotification(env, obj.obj());
+
// if tab_crashed_ is already true, just return. e.g. if two tabs share the
// render process, this will be called for each tab when the render process
// crashed. If user reload one tab, a new render process is created. It can be
@@ -367,10 +373,6 @@ void ContentViewCoreImpl::OnTabCrashed() {
if (tab_crashed_)
return;
tab_crashed_ = true;
- JNIEnv* env = AttachCurrentThread();
- ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
- if (obj.is_null())
- return;
Java_ContentViewCore_onTabCrash(env, obj.obj());
}
@@ -699,6 +701,15 @@ void ContentViewCoreImpl::LoadUrl(
tab_crashed_ = false;
}
+void ContentViewCoreImpl::SetVSyncNotificationEnabled(bool enabled) {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
+ if (obj.is_null())
+ return;
+ Java_ContentViewCore_setVSyncNotificationEnabled(
+ env, obj.obj(), static_cast<jboolean>(enabled));
+}
+
ui::WindowAndroid* ContentViewCoreImpl::GetWindowAndroid() const {
// This should never be NULL for Chrome, but will be NULL for WebView.
DCHECK(window_android_);
@@ -1204,6 +1215,15 @@ void ContentViewCoreImpl::UpdateVSyncParameters(JNIEnv* env, jobject /* obj */,
base::TimeDelta::FromMicroseconds(interval_micros));
}
+void ContentViewCoreImpl::OnVSync(JNIEnv* env, jobject /* obj */,
+ jlong frame_time_micros) {
+ RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
+ if (!view)
+ return;
+
+ view->SendVSync(base::TimeTicks::FromInternalValue(frame_time_micros));
+}
+
jboolean ContentViewCoreImpl::PopulateBitmapFromCompositor(JNIEnv* env,
jobject obj,
jobject jbitmap) {
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698