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

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, 9 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 bb670513fbebd5a21d3aadb8713c97ebd330b306..f9d5fba572dd33b63126c2e266a2da99fbd0e783 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -348,6 +348,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
@@ -358,10 +364,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());
}
@@ -677,6 +679,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 {
return window_android_;
}
@@ -1180,6 +1191,18 @@ void ContentViewCoreImpl::UpdateVSyncParameters(JNIEnv* env, jobject /* obj */,
base::TimeDelta::FromMicroseconds(interval_micros));
}
+void ContentViewCoreImpl::SendVSync(JNIEnv* env, jobject /* obj */,
+ jlong frame_time_micros) {
+ RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
+ if (!view)
+ return;
+
+ RenderWidgetHostImpl* host = RenderWidgetHostImpl::From(
+ view->GetRenderWidgetHost());
+
+ host->SendVSync(base::TimeTicks::FromInternalValue(frame_time_micros));
no sievers 2013/04/08 17:58:06 Hmm I can't find the definition for this function.
+}
+
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.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698