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

Unified Diff: android_webview/native/aw_contents.cc

Issue 817603002: cc: Make scheduling be driven by vsync for android webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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: android_webview/native/aw_contents.cc
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index 8494ed176785b50b0247871ab0c4886bfe3a4655..a36d30ca212458f2fcd4fef3120ad6ddeed5e1c5 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -65,6 +65,7 @@
#include "net/base/auth.h"
#include "net/cert/x509_certificate.h"
#include "third_party/skia/include/core/SkPicture.h"
+#include "ui/base/android/window_android.h"
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/image/image.h"
@@ -199,6 +200,9 @@ AwContents::AwContents(scoped_ptr<WebContents> web_contents)
InitDataReductionProxyIfNecessary();
if (autofill_manager_delegate)
InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData());
+ ContentViewCore* cvc =
+ ContentViewCore::FromWebContents(web_contents_.get());
+ if (cvc) cvc->GetWindowAndroid()->AddObserver(this);
content::SynchronousCompositor::SetClientForWebContents(
web_contents_.get(), &browser_view_renderer_);
}
@@ -282,6 +286,9 @@ void AwContents::SetAwAutofillClient(jobject client) {
AwContents::~AwContents() {
DCHECK_EQ(this, AwContents::FromWebContents(web_contents_.get()));
+ ContentViewCore* cvc =
+ ContentViewCore::FromWebContents(web_contents_.get());
+ if (cvc) cvc->GetWindowAndroid()->RemoveObserver(this);
content::SynchronousCompositor::SetClientForWebContents(web_contents_.get(),
NULL);
web_contents_->RemoveUserData(kAwContentsUserDataKey);
@@ -995,10 +1002,20 @@ void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta) {
env, obj.obj(), overscroll_delta.x(), overscroll_delta.y());
}
+void AwContents::RequestVSyncUpdate() {
+ ContentViewCore* cvc = ContentViewCore::FromWebContents(web_contents_.get());
+ if (cvc) cvc->GetWindowAndroid()->RequestVSyncUpdate();
+}
+
const BrowserViewRenderer* AwContents::GetBrowserViewRenderer() const {
return &browser_view_renderer_;
}
+void AwContents::OnVSync(base::TimeTicks frame_time,
+ base::TimeDelta vsync_period) {
+ browser_view_renderer_.OnVSync(frame_time, vsync_period);
+}
+
void AwContents::SetDipScale(JNIEnv* env, jobject obj, jfloat dip_scale) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
browser_view_renderer_.SetDipScale(dip_scale);

Powered by Google App Engine
This is Rietveld 408576698