diff options
| author | Cary Clark <cary@android.com> | 2010-06-25 11:27:47 -0400 |
|---|---|---|
| committer | Cary Clark <cary@android.com> | 2010-06-29 09:07:59 -0400 |
| commit | 9a211b99b45f5b1028389349eb946120e849b540 (patch) | |
| tree | 579bcf6babef89e5fcaaa4f7bc53150a7f37763e /WebKit/android/jni | |
| parent | 5a22f5d5a894759137cbc73b987cc21fe3dbcb2e (diff) | |
| download | external_webkit-9a211b99b45f5b1028389349eb946120e849b540.zip external_webkit-9a211b99b45f5b1028389349eb946120e849b540.tar.gz external_webkit-9a211b99b45f5b1028389349eb946120e849b540.tar.bz2 | |
set maximum image size
Our use of web settings does not specify the maximum image size,
although we have some hard-coded values used when decoding the
image. For defective images, the hard-coded values are not enough,
since we may exceed memory in the decoder before the limit is
reached.
Pass along our limits to the decoder, and respect any limits
set by the caller.
companion change in frameworks/base
Change-Id: Icdfca87a44a3af8bcc1f0ed4792e04e060a67333
http://b/2689053
Diffstat (limited to 'WebKit/android/jni')
| -rw-r--r-- | WebKit/android/jni/WebSettings.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp index 912465a..d9a7cf0 100644 --- a/WebKit/android/jni/WebSettings.cpp +++ b/WebKit/android/jni/WebSettings.cpp @@ -29,6 +29,7 @@ #include <wtf/Platform.h> #include "ApplicationCacheStorage.h" +#include "BitmapAllocatorAndroid.h" #include "DatabaseTracker.h" #include "Database.h" #include "DocLoader.h" @@ -114,6 +115,7 @@ struct FieldIds { mUseWideViewport = env->GetFieldID(clazz, "mUseWideViewport", "Z"); mSupportMultipleWindows = env->GetFieldID(clazz, "mSupportMultipleWindows", "Z"); mShrinksStandaloneImagesToFit = env->GetFieldID(clazz, "mShrinksStandaloneImagesToFit", "Z"); + mMaximumDecodedImageSize = env->GetFieldID(clazz, "mMaximumDecodedImageSize", "J"); mUseDoubleTree = env->GetFieldID(clazz, "mUseDoubleTree", "Z"); mPageCacheCapacity = env->GetFieldID(clazz, "mPageCacheCapacity", "I"); @@ -150,6 +152,7 @@ struct FieldIds { LOG_ASSERT(mUseWideViewport, "Could not find field mUseWideViewport"); LOG_ASSERT(mSupportMultipleWindows, "Could not find field mSupportMultipleWindows"); LOG_ASSERT(mShrinksStandaloneImagesToFit, "Could not find field mShrinksStandaloneImagesToFit"); + LOG_ASSERT(mMaximumDecodedImageSize, "Could not find field mMaximumDecodedImageSize"); LOG_ASSERT(mUseDoubleTree, "Could not find field mUseDoubleTree"); LOG_ASSERT(mPageCacheCapacity, "Could not find field mPageCacheCapacity"); @@ -195,6 +198,7 @@ struct FieldIds { jfieldID mUseWideViewport; jfieldID mSupportMultipleWindows; jfieldID mShrinksStandaloneImagesToFit; + jfieldID mMaximumDecodedImageSize; jfieldID mUseDoubleTree; jfieldID mPageCacheCapacity; // Ordinal() method and value field for enums @@ -355,6 +359,10 @@ public: #endif flag = env->GetBooleanField(obj, gFieldIds->mShrinksStandaloneImagesToFit); s->setShrinksStandaloneImagesToFit(flag); + jlong maxImage = env->GetIntField(obj, gFieldIds->mMaximumDecodedImageSize); + if (maxImage == 0) + maxImage = computeMaxBitmapSizeForCache(); + s->setMaximumDecodedImageSize(maxImage); #if ENABLE(DATABASE) flag = env->GetBooleanField(obj, gFieldIds->mDatabaseEnabled); WebCore::Database::setIsAvailable(flag); |
