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

This commit is contained in:
Matt Woodrow 2012-06-30 15:06:14 +12:00
Родитель 847a97d95f
Коммит 11927c4b90
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -139,7 +139,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) {