From 2bf604e91ac204971a97a4a44830b6cf8321b4c9 Mon Sep 17 00:00:00 2001 From: igsolla Date: Tue, 10 Feb 2015 10:58:01 -0800 Subject: [WebView] Add a request id param to the flushVisualState API. The request id will allow callers to match requests with callbacks. BUG=457184 Review URL: https://codereview.chromium.org/911893002 Cr-Commit-Position: refs/heads/master@{#315603} --- android_webview/native/aw_contents.cc | 11 +++++++---- android_webview/native/aw_contents.h | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'android_webview/native') diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc index 6c468f6..7d55111 100644 --- a/android_webview/native/aw_contents.cc +++ b/android_webview/native/aw_contents.cc @@ -1036,6 +1036,7 @@ void AwContents::EnableOnNewPicture(JNIEnv* env, namespace { void FlushVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, + long request_id, ScopedJavaGlobalRef* callback, bool result) { JNIEnv* env = AttachCurrentThread(); @@ -1043,16 +1044,18 @@ void FlushVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, if (obj.is_null()) return; Java_AwContents_flushVisualStateCallback( - env, obj.obj(), callback->obj(), result); + env, obj.obj(), callback->obj(), request_id, result); } } // namespace -void AwContents::FlushVisualState(JNIEnv* env, jobject obj, jobject callback) { +void AwContents::FlushVisualState( + JNIEnv* env, jobject obj, long request_id, jobject callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ScopedJavaGlobalRef* j_callback = new ScopedJavaGlobalRef(); j_callback->Reset(env, callback); - web_contents_->GetMainFrame()->FlushVisualState(base::Bind( - &FlushVisualStateCallback, java_ref_, base::Owned(j_callback))); + web_contents_->GetMainFrame()->FlushVisualState( + base::Bind(&FlushVisualStateCallback, java_ref_, request_id, + base::Owned(j_callback))); } void AwContents::ClearView(JNIEnv* env, jobject obj) { diff --git a/android_webview/native/aw_contents.h b/android_webview/native/aw_contents.h index 077690f..754eece 100644 --- a/android_webview/native/aw_contents.h +++ b/android_webview/native/aw_contents.h @@ -129,7 +129,10 @@ class AwContents : public FindHelper::Listener, jlong GetAwDrawGLViewContext(JNIEnv* env, jobject obj); jlong CapturePicture(JNIEnv* env, jobject obj, int width, int height); void EnableOnNewPicture(JNIEnv* env, jobject obj, jboolean enabled); - void FlushVisualState(JNIEnv* env, jobject obj, jobject callback); + void FlushVisualState(JNIEnv* env, + jobject obj, + long request_id, + jobject callback); void ClearView(JNIEnv* env, jobject obj); void SetExtraHeadersForUrl(JNIEnv* env, jobject obj, jstring url, jstring extra_headers); -- cgit v1.1