Commit dfc75134 authored by rdsmith@chromium.org's avatar rdsmith@chromium.org

Do a quick tweak downwards to SDCH memory limits (esp for mobile).

This will allow experimentation to occur in M37 without concern about
blowing out memory.  A more thorough memory limit re-evaluation
is expected in M38.

BUG=374917
R=cbentzel@chromium.org

Review URL: https://codereview.chromium.org/342523002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278590 0039d316-1c4b-4281-b951-d872f2087c98
parent e7dcbedb
......@@ -17,10 +17,17 @@ namespace net {
//------------------------------------------------------------------------------
// static
const size_t SdchManager::kMaxDictionarySize = 1000000;
// Adjust SDCH limits downwards for mobile.
#if defined(OS_ANDROID) || defined(OS_IOS)
// static
const size_t SdchManager::kMaxDictionaryCount = 1;
const size_t SdchManager::kMaxDictionarySize = 150 * 1000;
#else
// static
const size_t SdchManager::kMaxDictionaryCount = 20;
const size_t SdchManager::kMaxDictionarySize = 1000 * 1000;
#endif
// static
bool SdchManager::g_sdch_enabled_ = true;
......
......@@ -394,12 +394,15 @@ TEST_F(SdchFilterTest, DictionaryAddOnce) {
const std::string kSampleDomain2 = "sdchtest2.com";
// Construct a second SDCH dictionary from a VCDIFF dictionary.
std::string dictionary2(NewSdchDictionary(kSampleDomain2));
std::string url_string2 = "http://" + kSampleDomain2;
GURL url2(url_string2);
EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary2, url2));
// Don't test adding a second dictionary if our limits are tight.
if (SdchManager::kMaxDictionaryCount > 1) {
// Construct a second SDCH dictionary from a VCDIFF dictionary.
std::string dictionary2(NewSdchDictionary(kSampleDomain2));
std::string url_string2 = "http://" + kSampleDomain2;
GURL url2(url_string2);
EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary2, url2));
}
}
TEST_F(SdchFilterTest, BasicDictionary) {
......@@ -634,6 +637,11 @@ TEST_F(SdchFilterTest, CrossDomainDictionaryUse) {
}
TEST_F(SdchFilterTest, DictionaryPathValidation) {
// Can't test path distinction between dictionaries if we aren't allowed
// more than one dictionary.
if (SdchManager::kMaxDictionaryCount <= 1)
return;
// Construct a valid SDCH dictionary from a VCDIFF dictionary.
const std::string kSampleDomain = "sdchtest.com";
std::string dictionary(NewSdchDictionary(kSampleDomain));
......@@ -683,6 +691,11 @@ TEST_F(SdchFilterTest, DictionaryPathValidation) {
}
TEST_F(SdchFilterTest, DictionaryPortValidation) {
// Can't test port distinction between dictionaries if we aren't allowed
// more than one dictionary.
if (SdchManager::kMaxDictionaryCount <= 1)
return;
// Construct a valid SDCH dictionary from a VCDIFF dictionary.
const std::string kSampleDomain = "sdchtest.com";
std::string dictionary(NewSdchDictionary(kSampleDomain));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment