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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 2650753002: Implement renderer importance API for WebView (Closed)
Patch Set: clean up unused local Created 3 years, 11 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: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 69393cef83a607e694c633ed576c4b987304188c..6ccba0af6dd9b70abf056fb7edc8c9307694315e 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -45,6 +45,7 @@ import android.webkit.ValueCallback;
import org.chromium.android_webview.permission.AwGeolocationCallback;
import org.chromium.android_webview.permission.AwPermissionRequest;
+import org.chromium.android_webview.renderer_priority.RendererPriority.RendererPriorityEnum;
import org.chromium.base.LocaleUtils;
import org.chromium.base.Log;
import org.chromium.base.ObserverList;
@@ -1175,7 +1176,8 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
@CalledByNative
private boolean onRenderProcessGoneDetail(int childProcessID, boolean crashed) {
if (isDestroyed(NO_WARN)) return false;
- return mContentsClient.onRenderProcessGone(new AwRenderProcessGoneDetail(crashed));
+ return mContentsClient.onRenderProcessGone(new AwRenderProcessGoneDetail(
+ crashed, nativeGetRendererCurrentPriority(mNativeAwContents)));
}
private boolean isNoOperation() {
@@ -2699,6 +2701,20 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
return mIsPopupWindow;
}
+ @RendererPriorityEnum
+ public int getRendererRequestedPriority() {
+ return nativeGetRendererRequestedPriority(mNativeAwContents);
+ }
+
+ public boolean getRendererPriorityWaivedWhenNotVisible() {
+ return nativeGetRendererPriorityWaivedWhenNotVisible(mNativeAwContents);
+ }
+
+ public void setRendererPriorityPolicy(
+ @RendererPriorityEnum int rendererRequestedPriority, boolean waivedWhenNotVisible) {
+ nativeSetRendererPriorityPolicy(
+ mNativeAwContents, rendererRequestedPriority, waivedWhenNotVisible);
+ }
//--------------------------------------------------------------------------------------------
// Methods called from native via JNI
//--------------------------------------------------------------------------------------------
@@ -3436,6 +3452,12 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
private native void nativeInvokeGeolocationCallback(
long nativeAwContents, boolean value, String requestingFrame);
+ private native int nativeGetRendererRequestedPriority(long nativeAwContents);
+ private native boolean nativeGetRendererPriorityWaivedWhenNotVisible(long nativeAwContents);
+ private native int nativeGetRendererCurrentPriority(long nativeAwContents);
+ private native void nativeSetRendererPriorityPolicy(
+ long nativeAwContents, int rendererRequestedPriority, boolean waivedWhenNotVisible);
+
private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean networkUp);
private native void nativeTrimMemory(long nativeAwContents, int level, boolean visible);

Powered by Google App Engine
This is Rietveld 408576698