Bug 539356 - Part 29 - Handle OOM exception gracefully during java snapshots. r=jrmuizel

This commit is contained in:
Matt Woodrow 2012-08-29 17:48:44 +12:00
parent 79eed389a6
commit 62f7b73450

View File

@ -123,7 +123,11 @@ public class ScreenshotLayer extends SingleTileLayer {
end = Math.max(start, Math.min(dst.limit(), Math.min(src.capacity(), end)));
dst.position(start);
src.position(start).limit(end);
dst.put(src);
// This allocates a lot of memory and can fail sometimes. Handling the
// exception is better than crashing.
try {
dst.put(src);
} catch (java.lang.OutOfMemoryError e) {}
}
synchronized void setBitmap(ByteBuffer data, int width, int height, int format, Rect rect) {