mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out e64522db8661 (bug 863288) for robocop-1 hangs
This commit is contained in:
parent
2163c686b3
commit
cddd249036
@ -7,7 +7,6 @@ package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.db.BrowserContract.Combined;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.util.GamepadUtils;
|
||||
import org.mozilla.gecko.util.StringUtils;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
@ -20,6 +19,7 @@ import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@ -677,9 +677,8 @@ public class AwesomeBar extends GeckoActivity
|
||||
}
|
||||
|
||||
Bitmap bitmap = null;
|
||||
if (b != null) {
|
||||
bitmap = BitmapUtils.decodeByteArray(b);
|
||||
}
|
||||
if (b != null)
|
||||
bitmap = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
|
||||
String shortcutTitle = TextUtils.isEmpty(title) ? url.replaceAll("^([a-z]+://)?(www\\.)?", "") : title;
|
||||
GeckoAppShell.createShortcut(shortcutTitle, url, bitmap, "");
|
||||
|
@ -7,7 +7,6 @@ package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.background.announcements.AnnouncementsBroadcastService;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.gfx.Layer;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
import org.mozilla.gecko.gfx.PanZoomController;
|
||||
@ -1157,10 +1156,10 @@ abstract public class GeckoApp
|
||||
if (isDataURI) {
|
||||
int dataStart = aSrc.indexOf(',');
|
||||
byte[] buf = Base64.decode(aSrc.substring(dataStart+1), Base64.DEFAULT);
|
||||
BitmapUtils.decodeByteArray(buf, options);
|
||||
BitmapFactory.decodeByteArray(buf, 0, buf.length, options);
|
||||
options.inSampleSize = getBitmapSampleSize(options, idealWidth, idealHeight);
|
||||
options.inJustDecodeBounds = false;
|
||||
image = BitmapUtils.decodeByteArray(buf, options);
|
||||
image = BitmapFactory.decodeByteArray(buf, 0, buf.length, options);
|
||||
} else {
|
||||
int byteRead;
|
||||
byte[] buf = new byte[4192];
|
||||
@ -1175,10 +1174,10 @@ abstract public class GeckoApp
|
||||
os.write(buf, 0, byteRead);
|
||||
}
|
||||
byte[] imgBuffer = os.toByteArray();
|
||||
BitmapUtils.decodeByteArray(imgBuffer, options);
|
||||
BitmapFactory.decodeByteArray(imgBuffer, 0, imgBuffer.length, options);
|
||||
options.inSampleSize = getBitmapSampleSize(options, idealWidth, idealHeight);
|
||||
options.inJustDecodeBounds = false;
|
||||
image = BitmapUtils.decodeByteArray(imgBuffer, options);
|
||||
image = BitmapFactory.decodeByteArray(imgBuffer, 0, imgBuffer.length, options);
|
||||
}
|
||||
if(image != null) {
|
||||
mgr.setBitmap(image);
|
||||
@ -1187,7 +1186,7 @@ abstract public class GeckoApp
|
||||
return false;
|
||||
}
|
||||
} catch(OutOfMemoryError ome) {
|
||||
Log.e(LOGTAG, "Out of Memory when converting to byte array", ome);
|
||||
Log.e(LOGTAG, "Out of Memmory when coverting to byte array", ome);
|
||||
return false;
|
||||
} catch(IOException ioe) {
|
||||
Log.e(LOGTAG, "I/O Exception while setting wallpaper", ioe);
|
||||
|
@ -6,11 +6,11 @@
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.gfx.IntSize;
|
||||
import org.mozilla.gecko.mozglue.DirectBufferAllocator;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.util.Log;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
@ -187,14 +187,18 @@ public final class ThumbnailHelper {
|
||||
}
|
||||
|
||||
private void setTabThumbnail(Tab tab, Bitmap bitmap, byte[] compressed) {
|
||||
if (bitmap == null) {
|
||||
if (compressed == null) {
|
||||
Log.w(LOGTAG, "setTabThumbnail: one of bitmap or compressed must be non-null!");
|
||||
return;
|
||||
try {
|
||||
if (bitmap == null) {
|
||||
if (compressed == null) {
|
||||
Log.w(LOGTAG, "setTabThumbnail: one of bitmap or compressed must be non-null!");
|
||||
return;
|
||||
}
|
||||
bitmap = BitmapFactory.decodeByteArray(compressed, 0, compressed.length);
|
||||
}
|
||||
bitmap = BitmapUtils.decodeByteArray(compressed);
|
||||
tab.updateThumbnail(bitmap);
|
||||
} catch (OutOfMemoryError ome) {
|
||||
Log.w(LOGTAG, "setTabThumbnail: decoding byte array of length " + compressed.length + " ran out of memory");
|
||||
}
|
||||
tab.updateThumbnail(bitmap);
|
||||
}
|
||||
|
||||
private boolean shouldUpdateThumbnail(Tab tab) {
|
||||
|
@ -24,6 +24,7 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Handler;
|
||||
@ -897,8 +898,8 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
if (b == null)
|
||||
continue;
|
||||
|
||||
Bitmap favicon = BitmapUtils.decodeByteArray(b);
|
||||
if (favicon == null)
|
||||
Bitmap favicon = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
if (favicon == null || favicon.getWidth() <= 0 || favicon.getHeight() <= 0)
|
||||
continue;
|
||||
|
||||
favicon = Favicons.getInstance().scaleImage(favicon);
|
||||
|
@ -7,13 +7,13 @@ package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.AwesomeBar.ContextMenuSubject;
|
||||
import org.mozilla.gecko.db.BrowserDB.URLColumns;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
@ -91,8 +91,8 @@ abstract public class AwesomeBarTab {
|
||||
byte[] b = cursor.getBlob(cursor.getColumnIndexOrThrow(URLColumns.FAVICON));
|
||||
Bitmap favicon = null;
|
||||
if (b != null) {
|
||||
Bitmap bitmap = BitmapUtils.decodeByteArray(b);
|
||||
if (bitmap != null) {
|
||||
Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
if (bitmap != null && bitmap.getWidth() > 0 && bitmap.getHeight() > 0) {
|
||||
favicon = Favicons.getInstance().scaleImage(bitmap);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import org.mozilla.gecko.AwesomeBar.ContextMenuSubject;
|
||||
import org.mozilla.gecko.db.BrowserContract.Combined;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.BrowserDB.URLColumns;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.util.GamepadUtils;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
@ -20,6 +19,7 @@ import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.AsyncTask;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@ -27,6 +27,7 @@ import android.util.Pair;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -192,8 +193,8 @@ public class HistoryTab extends AwesomeBarTab {
|
||||
Bitmap favicon = null;
|
||||
|
||||
if (b != null) {
|
||||
Bitmap bitmap = BitmapUtils.decodeByteArray(b);
|
||||
if (bitmap != null) {
|
||||
Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
if (bitmap != null && bitmap.getWidth() > 0 && bitmap.getHeight() > 0) {
|
||||
favicon = Favicons.getInstance().scaleImage(bitmap);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import org.mozilla.gecko.db.BrowserContract.History;
|
||||
import org.mozilla.gecko.db.BrowserContract.SyncColumns;
|
||||
import org.mozilla.gecko.db.BrowserContract.Thumbnails;
|
||||
import org.mozilla.gecko.db.BrowserContract.URLColumns;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
|
||||
import android.content.ContentProviderOperation;
|
||||
import android.content.ContentResolver;
|
||||
@ -23,6 +22,7 @@ import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.database.CursorWrapper;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.net.Uri;
|
||||
import android.provider.Browser;
|
||||
@ -707,13 +707,14 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
}
|
||||
|
||||
int faviconIndex = c.getColumnIndexOrThrow(Combined.FAVICON);
|
||||
|
||||
byte[] b = c.getBlob(faviconIndex);
|
||||
c.close();
|
||||
|
||||
if (b == null)
|
||||
return null;
|
||||
|
||||
return BitmapUtils.decodeByteArray(b);
|
||||
return BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,42 +14,6 @@ import android.util.Log;
|
||||
public final class BitmapUtils {
|
||||
private static final String LOGTAG = "GeckoBitmapUtils";
|
||||
|
||||
private BitmapUtils() {}
|
||||
|
||||
public static Bitmap decodeByteArray(byte[] bytes) {
|
||||
return decodeByteArray(bytes, null);
|
||||
}
|
||||
|
||||
public static Bitmap decodeByteArray(byte[] bytes, BitmapFactory.Options options) {
|
||||
if (bytes.length <= 0) {
|
||||
throw new IllegalArgumentException("bytes.length " + bytes.length
|
||||
+ " must be a positive number");
|
||||
}
|
||||
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options);
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.e(LOGTAG, "decodeByteArray(bytes.length=" + bytes.length
|
||||
+ ", options= " + options + ") OOM!", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (bitmap == null) {
|
||||
Log.w(LOGTAG, "decodeByteArray() returning null because BitmapFactory returned null");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (bitmap.getWidth() <= 0 || bitmap.getHeight() <= 0) {
|
||||
Log.w(LOGTAG, "decodeByteArray() returning null because BitmapFactory returned "
|
||||
+ "a bitmap with dimensions " + bitmap.getWidth()
|
||||
+ "x" + bitmap.getHeight());
|
||||
return null;
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public static int getDominantColor(Bitmap source) {
|
||||
return getDominantColor(source, true);
|
||||
}
|
||||
@ -110,7 +74,7 @@ public final class BitmapUtils {
|
||||
String base64 = dataURI.substring(dataURI.indexOf(',') + 1);
|
||||
try {
|
||||
byte[] raw = Base64.decode(base64, Base64.DEFAULT);
|
||||
return BitmapUtils.decodeByteArray(raw);
|
||||
return BitmapFactory.decodeByteArray(raw, 0, raw.length);
|
||||
} catch (Exception e) {
|
||||
Log.e(LOGTAG, "exception decoding bitmap from data URI: " + dataURI, e);
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import org.mozilla.gecko.db.BrowserContract.Thumbnails;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.BrowserDB.TopSitesCursorWrapper;
|
||||
import org.mozilla.gecko.db.BrowserDB.URLColumns;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.util.ActivityResultHandler;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.util.UiAsyncTask;
|
||||
@ -26,6 +25,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@ -316,7 +316,7 @@ public class TopSitesView extends GridView {
|
||||
if (b == null)
|
||||
continue;
|
||||
|
||||
Bitmap thumbnail = BitmapUtils.decodeByteArray(b);
|
||||
Bitmap thumbnail = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
if (thumbnail == null)
|
||||
continue;
|
||||
|
||||
@ -656,7 +656,7 @@ public class TopSitesView extends GridView {
|
||||
final byte[] b = c.getBlob(c.getColumnIndexOrThrow(Thumbnails.DATA));
|
||||
Bitmap bitmap = null;
|
||||
if (b != null) {
|
||||
bitmap = BitmapUtils.decodeByteArray(b);
|
||||
bitmap = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
}
|
||||
c.close();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user