Don't waste memory creating new Boolean objects
Creating a new Boolean is wasteful since there's already a static
Boolean.TRUE and Boolean.FALSE. Using Boolean.valueOf will return one of
those static objects and reduce memory usage a bit.
Change-Id: Id497f951c8a894ec03ac6c3181e6055b56db9db4
diff --git a/core/java/android/webkit/GeolocationPermissions.java b/core/java/android/webkit/GeolocationPermissions.java
index 4565b756..5d54180 100755
--- a/core/java/android/webkit/GeolocationPermissions.java
+++ b/core/java/android/webkit/GeolocationPermissions.java
@@ -146,7 +146,7 @@
boolean allowed = nativeGetAllowed(origin);
Map retValues = new HashMap<String, Object>();
retValues.put(CALLBACK, callback);
- retValues.put(ALLOWED, new Boolean(allowed));
+ retValues.put(ALLOWED, Boolean.valueOf(allowed));
postUIMessage(Message.obtain(null, RETURN_ALLOWED, retValues));
} break;
case CLEAR:
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 8c515db..9975862 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -2054,7 +2054,7 @@
}
if (mWebView != null) {
Message msg = Message.obtain(mWebView.mPrivateHandler,
- WebView.SCROLL_BY_MSG_ID, dx, dy, new Boolean(animate));
+ WebView.SCROLL_BY_MSG_ID, dx, dy, Boolean.valueOf(animate));
if (mDrawIsScheduled) {
mEventHub.sendMessage(Message.obtain(null,
EventHub.MESSAGE_RELAY, msg));