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

Unified Diff: android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java

Issue 2268233004: Fix HandlerLeak lint warning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SuppressLint warning HandlerLeak. Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
index 1d28526a597de73ef6dfc7c835b0da7b1f81f555..32dfc46a9ba20a91c287ef3024db66e8814a973c 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
@@ -4,6 +4,7 @@
package com.android.webview.chromium;
+import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
@@ -110,6 +111,16 @@ public class WebViewContentsClientAdapter extends AwContentsClient {
private WeakHashMap<AwPermissionRequest, WeakReference<PermissionRequestAdapter>>
mOngoingPermissionRequests;
+
+ // Suppress the handler leak lint warning because:
+ // 1. the handler does not get GC'ed when there are still pending messages, which does
+ // not happen when there are no delayed messages.
+ // 2. If the app returns true for WebChromeClient#onCreateWindow callback but
+ // does not reply to the message with the WebView instance for the popup, then the
+ // static handler + weak reference pattern will have to deal with the case where the
+ // original webview instance being GC'ed by the time NEW_WEBVIEW_CREATED is sent by the
+ // app. Too much complexity for little gain.
+ @SuppressLint("HandlerLeak")
boliu 2016/08/24 21:25:43 I say don't bother with the comment. it's bound to
hush (inactive) 2016/08/30 21:58:17 Done.
/**
* Adapter constructor.
*
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698