diff options
author | sorin@chromium.org <sorin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-17 02:23:54 +0000 |
---|---|---|
committer | sorin@chromium.org <sorin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-17 02:23:54 +0000 |
commit | 7221d4c83aae27833bccdcbdbccf7b1aa37d6749 (patch) | |
tree | 64e8e66e8b96364a6a4b666dc9d8dbf60b7876d3 | |
parent | c7f99a6d59e619b6735a708ca18bae83cf55074a (diff) | |
download | chromium_src-7221d4c83aae27833bccdcbdbccf7b1aa37d6749.zip chromium_src-7221d4c83aae27833bccdcbdbccf7b1aa37d6749.tar.gz chromium_src-7221d4c83aae27833bccdcbdbccf7b1aa37d6749.tar.bz2 |
Revert of Clear SDCH information on "Clear browsing data" path. (https://codereview.chromium.org/321283002/)
Reason for revert:
Fails ASAN tests:
(view as text)
SdchManagerTest.ClearDictionaryData (run #1):
[ RUN ] SdchManagerTest.ClearDictionaryData
[ OK ] SdchManagerTest.ClearDictionaryData (0 ms)
[----------] 1 test from SdchManagerTest (0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (2 ms total)
[ PASSED ] 1 test.
YOU HAVE 107 DISABLED TESTS
=================================================================
==16633==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 192 byte(s) in 1 object(s) allocated from:
#0 0x51301b in operator new(unsigned long) /usr/local/google/work/chromium/src/third_party/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:55
#1 0x34c6174 in net::SdchManager::AddSdchDictionary(std::string const&, GURL const&) net/base/sdch_manager.cc:469
#2 0x808536 in net::SdchManagerTest_ClearDictionaryData_Test::TestBody() net/base/sdch_manager_unittest.cc:454
#3 0x33173a8 in HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void> testing/gtest/src/gtest.cc:2045
#4 0x33173a8 in testing::Test::Run() testing/gtest/src/gtest.cc:2061
#5 0x3319b89 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2237
#6 0x331a916 in testing::TestCase::Run() testing/gtest/src/gtest.cc:2344
#7 0x332da2a in testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4065
#8 0x332d060 in HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2045
#9 0x332d060 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:3697
<truncated, full output is in gzipped JSON output at end of step>
#5 0x7eff91b98391 in std::string::append(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:290
#6 0x7eff91b97aeb in std::string::resize(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:647
#7 0x31f1b12 in resize /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_string.h:749
#8 0x31f1b12 in base::Base64Encode(base::BasicStringPiece\u003Cstd::string> const&, std::string*) base/base64.cc:13
#9 0x34c73d5 in net::SdchManager::UrlSafeBase64Encode(std::string const&, std::string*) net/base/sdch_manager.cc:558
#10 0x34c67e7 in net::SdchManager::GenerateHash(std::string const&, std::string*, std::string*) net/base/sdch_manager.cc:524
#11 0x34c519b in net::SdchManager::AddSdchDictionary(std::string const&, GURL const&) net/base/sdch_manager.cc:380
#12 0x808536 in net::SdchManagerTest_ClearDictionaryData_Test::TestBody() net/base/sdch_manager_unittest.cc:454
#13 0x33173a8 in HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void> testing/gtest/src/gtest.cc:2045
#14 0x33173a8 in testing::Test::Run() testing/gtest/src/gtest.cc:2061
#15 0x3319b89 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2237
#16 0x331a916 in testing::TestCase::Run() testing/gtest/src/gtest.cc:2344
#17 0x332da2a in testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4065
#18 0x332d060 in HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2045
#19 0x332d060 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:3697
#20 0x3fc8ddc in RUN_ALL_TESTS testing/gtest/include/gtest/gtest.h:2231
#21 0x3fc8ddc in base::TestSuite::Run() base/test/test_suite.cc:227
#22 0x3fbd5a2 in Run base/callback.h:401
#23 0x3fbd5a2 in base::(anonymous namespace)::LaunchUnitTestsInternal(base::Callback\u003Cint ()> const&, int, bool, base::Callback\u003Cvoid ()> const&) base/test/launcher/unit_test_launcher.cc:498
#24 0x3fbcf1d in base::LaunchUnitTests(int, char**, base::Callback\u003Cint ()> const&) base/test/launcher/unit_test_launcher.cc:553
#25 0x2ae277c in main net/test/run_all_unittests.cc:64
#26 0x7eff9152d76c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226
SUMMARY: AddressSanitizer: 449 byte(s) leaked in 5 allocation(s).
SdchManagerTest.ClearDictionaryData (run #2):
[ RUN ] SdchManagerTest.ClearDictionaryData
[ OK ] SdchManagerTest.ClearDictionaryData (1 ms)
[----------] 1 test from SdchManagerTest (1 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[ PASSED ] 1 test.
YOU HAVE 107 DISABLED TESTS
=================================================================
==3818==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 192 byte(s) in 1 object(s) allocated from:
#0 0x51301b in operator new(unsigned long) /usr/local/google/work/chromium/src/third_party/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:55
#1 0x34c6174 in net::SdchManager::AddSdchDictionary(std::string const&, GURL const&) net/base/sdch_manager.cc:469
#2 0x808536 in net::SdchManagerTest_ClearDictionaryData_Test::TestBody() net/base/sdch_manager_unittest.cc:454
#3 0x33173a8 in HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void> testing/gtest/src/gtest.cc:2045
#4 0x33173a8 in testing::Test::Run() testing/gtest/src/gtest.cc:2061
#5 0x3319b89 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2237
#6 0x331a916 in testing::TestCase::Run() testing/gtest/src/gtest.cc:2344
#7 0x332da2a in testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4065
#8 0x332d060 in HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2045
#9 0x332d060 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:3697
<truncated, full output is in gzipped JSON output at end of step>
#5 0x7ffa92ba6391 in std::string::append(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:290
#6 0x7ffa92ba5aeb in std::string::resize(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:647
#7 0x31f1b12 in resize /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_string.h:749
#8 0x31f1b12 in base::Base64Encode(base::BasicStringPiece\u003Cstd::string> const&, std::string*) base/base64.cc:13
#9 0x34c73d5 in net::SdchManager::UrlSafeBase64Encode(std::string const&, std::string*) net/base/sdch_manager.cc:558
#10 0x34c67e7 in net::SdchManager::GenerateHash(std::string const&, std::string*, std::string*) net/base/sdch_manager.cc:524
#11 0x34c519b in net::SdchManager::AddSdchDictionary(std::string const&, GURL const&) net/base/sdch_manager.cc:380
#12 0x808536 in net::SdchManagerTest_ClearDictionaryData_Test::TestBody() net/base/sdch_manager_unittest.cc:454
#13 0x33173a8 in HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void> testing/gtest/src/gtest.cc:2045
#14 0x33173a8 in testing::Test::Run() testing/gtest/src/gtest.cc:2061
#15 0x3319b89 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2237
#16 0x331a916 in testing::TestCase::Run() testing/gtest/src/gtest.cc:2344
#17 0x332da2a in testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4065
#18 0x332d060 in HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2045
#19 0x332d060 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:3697
#20 0x3fc8ddc in RUN_ALL_TESTS testing/gtest/include/gtest/gtest.h:2231
#21 0x3fc8ddc in base::TestSuite::Run() base/test/test_suite.cc:227
#22 0x3fbd5a2 in Run base/callback.h:401
#23 0x3fbd5a2 in base::(anonymous namespace)::LaunchUnitTestsInternal(base::Callback\u003Cint ()> const&, int, bool, base::Callback\u003Cvoid ()> const&) base/test/launcher/unit_test_launcher.cc:498
#24 0x3fbcf1d in base::LaunchUnitTests(int, char**, base::Callback\u003Cint ()> const&) base/test/launcher/unit_test_launcher.cc:553
#25 0x2ae277c in main net/test/run_all_unittests.cc:64
#26 0x7ffa9253b76c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226
SUMMARY: AddressSanitizer: 449 byte(s) leaked in 5 allocation(s).
SdchManagerTest.ClearDictionaryData (run #3):
[ RUN ] SdchManagerTest.ClearDictionaryData
[ OK ] SdchManagerTest.ClearDictionaryData (0 ms)
[----------] 1 test from SdchManagerTest (1 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[ PASSED ] 1 test.
YOU HAVE 107 DISABLED TESTS
=================================================================
==3824==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 192 byte(s) in 1 object(s) allocated from:
#0 0x51301b in operator new(unsigned long) /usr/local/google/work/chromium/src/third_party/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:55
#1 0x34c6174 in net::SdchManager::AddSdchDictionary(std::string const&, GURL const&) net/base/sdch_manager.cc:469
#2 0x808536 in net::SdchManagerTest_ClearDictionaryData_Test::TestBody() net/base/sdch_manager_unittest.cc:454
#3 0x33173a8 in HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void> testing/gtest/src/gtest.cc:2045
#4 0x33173a8 in testing::Test::Run() testing/gtest/src/gtest.cc:2061
#5 0x3319b89 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2237
#6 0x331a916 in testing::TestCase::Run() testing/gtest/src/gtest.cc:2344
#7 0x332da2a in testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4065
#8 0x332d060 in HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2045
#9 0x332d060 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:3697
<truncated, full output is in gzipped JSON output at end of step>
#5 0x7f8ff892e391 in std::string::append(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:290
#6 0x7f8ff892daeb in std::string::resize(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:647
#7 0x31f1b12 in resize /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_string.h:749
#8 0x31f1b12 in base::Base64Encode(base::BasicStringPiece\u003Cstd::string> const&, std::string*) base/base64.cc:13
#9 0x34c73d5 in net::SdchManager::UrlSafeBase64Encode(std::string const&, std::string*) net/base/sdch_manager.cc:558
#10 0x34c67e7 in net::SdchManager::GenerateHash(std::string const&, std::string*, std::string*) net/base/sdch_manager.cc:524
#11 0x34c519b in net::SdchManager::AddSdchDictionary(std::string const&, GURL const&) net/base/sdch_manager.cc:380
#12 0x808536 in net::SdchManagerTest_ClearDictionaryData_Test::TestBody() net/base/sdch_manager_unittest.cc:454
#13 0x33173a8 in HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void> testing/gtest/src/gtest.cc:2045
#14 0x33173a8 in testing::Test::Run() testing/gtest/src/gtest.cc:2061
#15 0x3319b89 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2237
#16 0x331a916 in testing::TestCase::Run() testing/gtest/src/gtest.cc:2344
#17 0x332da2a in testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4065
#18 0x332d060 in HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2045
#19 0x332d060 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:3697
#20 0x3fc8ddc in RUN_ALL_TESTS testing/gtest/include/gtest/gtest.h:2231
#21 0x3fc8ddc in base::TestSuite::Run() base/test/test_suite.cc:227
#22 0x3fbd5a2 in Run base/callback.h:401
#23 0x3fbd5a2 in base::(anonymous namespace)::LaunchUnitTestsInternal(base::Callback\u003Cint ()> const&, int, bool, base::Callback\u003Cvoid ()> const&) base/test/launcher/unit_test_launcher.cc:498
#24 0x3fbcf1d in base::LaunchUnitTests(int, char**, base::Callback\u003Cint ()> const&) base/test/launcher/unit_test_launcher.cc:553
#25 0x2ae277c in main net/test/run_all_unittests.cc:64
#26 0x7f8ff82c376c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226
SUMMARY: AddressSanitizer: 449 byte(s) leaked in 5 allocation(s).
SdchManagerTest.ClearDictionaryData (run #4):
[ RUN ] SdchManagerTest.ClearDictionaryData
[ OK ] SdchManagerTest.ClearDictionaryData (1 ms)
[----------] 1 test from SdchManagerTest (1 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[ PASSED ] 1 test.
YOU HAVE 107 DISABLED TESTS
=================================================================
==3827==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 192 byte(s) in 1 object(s) allocated from:
#0 0x51301b in operator new(unsigned long) /usr/local/google/work/chromium/src/third_party/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:55
#1 0x34c6174 in net::SdchManager::AddSdchDictionary(std::string const&, GURL const&) net/base/sdch_manager.cc:469
#2 0x808536 in net::SdchManagerTest_ClearDictionaryData_Test::TestBody() net/base/sdch_manager_unittest.cc:454
#3 0x33173a8 in HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void> testing/gtest/src/gtest.cc:2045
#4 0x33173a8 in testing::Test::Run() testing/gtest/src/gtest.cc:2061
#5 0x3319b89 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2237
#6 0x331a916 in testing::TestCase::Run() testing/gtest/src/gtest.cc:2344
#7 0x332da2a in testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4065
#8 0x332d060 in HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2045
#9 0x332d060 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:3697
<truncated, full output is in gzipped JSON output at end of step>
#5 0x7ff270a3c391 in std::string::append(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:290
#6 0x7ff270a3baeb in std::string::resize(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:647
#7 0x31f1b12 in resize /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_string.h:749
#8 0x31f1b12 in base::Base64Encode(base::BasicStringPiece\u003Cstd::string> const&, std::string*) base/base64.cc:13
#9 0x34c73d5 in net::SdchManager::UrlSafeBase64Encode(std::string const&, std::string*) net/base/sdch_manager.cc:558
#10 0x34c67e7 in net::SdchManager::GenerateHash(std::string const&, std::string*, std::string*) net/base/sdch_manager.cc:524
#11 0x34c519b in net::SdchManager::AddSdchDictionary(std::string const&, GURL const&) net/base/sdch_manager.cc:380
#12 0x808536 in net::SdchManagerTest_ClearDictionaryData_Test::TestBody() net/base/sdch_manager_unittest.cc:454
#13 0x33173a8 in HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void> testing/gtest/src/gtest.cc:2045
#14 0x33173a8 in testing::Test::Run() testing/gtest/src/gtest.cc:2061
#15 0x3319b89 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2237
#16 0x331a916 in testing::TestCase::Run() testing/gtest/src/gtest.cc:2344
#17 0x332da2a in testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4065
#18 0x332d060 in HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2045
#19 0x332d060 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:3697
#20 0x3fc8ddc in RUN_ALL_TESTS testing/gtest/include/gtest/gtest.h:2231
#21 0x3fc8ddc in base::TestSuite::Run() base/test/test_suite.cc:227
#22 0x3fbd5a2 in Run base/callback.h:401
#23 0x3fbd5a2 in base::(anonymous namespace)::LaunchUnitTestsInternal(base::Callback\u003Cint ()> const&, int, bool, base::Callback\u003Cvoid ()> const&) base/test/launcher/unit_test_launcher.cc:498
#24 0x3fbcf1d in base::LaunchUnitTests(int, char**, base::Callback\u003Cint ()> const&) base/test/launcher/unit_test_launcher.cc:553
#25 0x2ae277c in main net/test/run_all_unittests.cc:64
#26 0x7ff2703d176c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226
SUMMARY: AddressSanitizer: 449 byte(s) leaked in 5 allocation(s).
Original issue's description:
> Clear SDCH information on "Clear browsing data" path.
>
> BUG=370567
> BUG=327783
> R=jar@chromium.org
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=277607
TBR=jar@chromium.org,sky@chromium.org,rdsmith@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=370567
Review URL: https://codereview.chromium.org/339763003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277624 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browsing_data/browsing_data_remover.cc | 11 | ||||
-rw-r--r-- | chrome/browser/net/sdch_dictionary_fetcher.cc | 14 | ||||
-rw-r--r-- | chrome/browser/net/sdch_dictionary_fetcher.h | 3 | ||||
-rw-r--r-- | net/base/sdch_manager.cc | 28 | ||||
-rw-r--r-- | net/base/sdch_manager.h | 10 | ||||
-rw-r--r-- | net/base/sdch_manager_unittest.cc | 33 |
6 files changed, 10 insertions, 89 deletions
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc index 29bf329..ba48751 100644 --- a/chrome/browser/browsing_data/browsing_data_remover.cc +++ b/chrome/browser/browsing_data/browsing_data_remover.cc @@ -75,7 +75,6 @@ #include "content/public/browser/storage_partition.h" #include "content/public/browser/user_metrics.h" #include "net/base/net_errors.h" -#include "net/base/sdch_manager.h" #include "net/cookies/cookie_store.h" #include "net/disk_cache/disk_cache.h" #include "net/http/http_cache.h" @@ -930,16 +929,6 @@ void BrowsingDataRemover::DoClearCache(int rv) { // Clear QUIC server information from memory and the disk cache. http_cache->GetSession()->quic_stream_factory()-> ClearCachedStatesInCryptoConfig(); - - // Clear SDCH dictionary state. - net::SdchManager* sdch_manager = - getter->GetURLRequestContext()->sdch_manager(); - // The test is probably overkill, since chrome should always have an - // SdchManager. But in general the URLRequestContext is *not* - // guaranteed to have an SdchManager, so checking is wise. - if (sdch_manager) - sdch_manager->ClearData(); - rv = http_cache->GetBackend( &cache_, base::Bind(&BrowsingDataRemover::DoClearCache, base::Unretained(this))); diff --git a/chrome/browser/net/sdch_dictionary_fetcher.cc b/chrome/browser/net/sdch_dictionary_fetcher.cc index 0a838bd..1130fe3 100644 --- a/chrome/browser/net/sdch_dictionary_fetcher.cc +++ b/chrome/browser/net/sdch_dictionary_fetcher.cc @@ -49,16 +49,6 @@ void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) { ScheduleDelayedRun(); } -void SdchDictionaryFetcher::Cancel() { - DCHECK(CalledOnValidThread()); - - while (!fetch_queue_.empty()) - fetch_queue_.pop(); - attempted_load_.clear(); - weak_factory_.InvalidateWeakPtrs(); - current_fetch_.reset(NULL); -} - void SdchDictionaryFetcher::ScheduleDelayedRun() { if (fetch_queue_.empty() || current_fetch_.get() || task_is_pending_) return; @@ -74,10 +64,6 @@ void SdchDictionaryFetcher::StartFetching() { DCHECK(task_is_pending_); task_is_pending_ = false; - // Handle losing the race against Cancel(). - if (fetch_queue_.empty()) - return; - DCHECK(context_.get()); current_fetch_.reset(net::URLFetcher::Create( fetch_queue_.front(), net::URLFetcher::GET, this)); diff --git a/chrome/browser/net/sdch_dictionary_fetcher.h b/chrome/browser/net/sdch_dictionary_fetcher.h index 968b42e..7eea42a 100644 --- a/chrome/browser/net/sdch_dictionary_fetcher.h +++ b/chrome/browser/net/sdch_dictionary_fetcher.h @@ -37,8 +37,9 @@ class SdchDictionaryFetcher virtual ~SdchDictionaryFetcher(); // Implementation of SdchFetcher class. + // This method gets the requested dictionary, and then calls back into the + // SdchManager class with the dictionary's text. virtual void Schedule(const GURL& dictionary_url) OVERRIDE; - virtual void Cancel() OVERRIDE; private: // Delay in ms between Schedule and actual download. diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc index 500a1a1..ad260a5 100644 --- a/net/base/sdch_manager.cc +++ b/net/base/sdch_manager.cc @@ -224,20 +224,6 @@ SdchManager::~SdchManager() { } } -void SdchManager::ClearData() { - blacklisted_domains_.clear(); - exponential_blacklist_count_.clear(); - allow_latency_experiment_.clear(); - if (fetcher_.get()) - fetcher_->Cancel(); - - // Note that this may result in not having dictionaries we've advertised - // for incoming responses. The window is relatively small (as ClearData() - // is not expected to be called frequently), so we rely on meta-refresh - // to handle this case. - dictionaries_.clear(); -} - // static void SdchManager::SdchErrorRecovery(ProblemCodes problem) { UMA_HISTOGRAM_ENUMERATION("Sdch3.ProblemCodes_4", problem, MAX_PROBLEM_CODE); @@ -266,9 +252,9 @@ void SdchManager::BlacklistDomain(const GURL& url) { if (count > 0) return; // Domain is already blacklisted. - count = 1 + 2 * exponential_blacklist_count_[domain]; + count = 1 + 2 * exponential_blacklist_count[domain]; if (count > 0) - exponential_blacklist_count_[domain] = count; + exponential_blacklist_count[domain] = count; else count = INT_MAX; @@ -279,13 +265,13 @@ void SdchManager::BlacklistDomainForever(const GURL& url) { SetAllowLatencyExperiment(url, false); std::string domain(StringToLowerASCII(url.host())); - exponential_blacklist_count_[domain] = INT_MAX; + exponential_blacklist_count[domain] = INT_MAX; blacklisted_domains_[domain] = INT_MAX; } void SdchManager::ClearBlacklistings() { blacklisted_domains_.clear(); - exponential_blacklist_count_.clear(); + exponential_blacklist_count.clear(); } void SdchManager::ClearDomainBlacklisting(const std::string& domain) { @@ -299,10 +285,10 @@ int SdchManager::BlackListDomainCount(const std::string& domain) { } int SdchManager::BlacklistDomainExponential(const std::string& domain) { - if (exponential_blacklist_count_.end() == - exponential_blacklist_count_.find(domain)) + if (exponential_blacklist_count.end() == + exponential_blacklist_count.find(domain)) return 0; - return exponential_blacklist_count_[StringToLowerASCII(domain)]; + return exponential_blacklist_count[StringToLowerASCII(domain)]; } bool SdchManager::IsInSupportedDomain(const GURL& url) { diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h index 0b3b319..c760313 100644 --- a/net/base/sdch_manager.h +++ b/net/base/sdch_manager.h @@ -49,11 +49,6 @@ class SdchFetcher { // from a server. The callee is responsible for getting that dictionary_text, // and then calling back to AddSdchDictionary() to the SdchManager instance. virtual void Schedule(const GURL& dictionary_url) = 0; - - // The Cancel() method is called to cancel all pending dictionary fetches. - // This is used for implementation of ClearData() below. - virtual void Cancel() = 0; - private: DISALLOW_COPY_AND_ASSIGN(SdchFetcher); }; @@ -239,9 +234,6 @@ class NET_EXPORT SdchManager : public NON_EXPORTED_BASE(base::NonThreadSafe) { SdchManager(); ~SdchManager(); - // Clear data (for browser data removal). - void ClearData(); - // Record stats on various errors. static void SdchErrorRecovery(ProblemCodes problem); @@ -366,7 +358,7 @@ class NET_EXPORT SdchManager : public NON_EXPORTED_BASE(base::NonThreadSafe) { // Support exponential backoff in number of domain accesses before // blacklisting expires. - DomainCounter exponential_blacklist_count_; + DomainCounter exponential_blacklist_count; // List of hostnames for which a latency experiment is allowed (because a // round trip test has recently passed). diff --git a/net/base/sdch_manager_unittest.cc b/net/base/sdch_manager_unittest.cc index e89988b..6684e4a 100644 --- a/net/base/sdch_manager_unittest.cc +++ b/net/base/sdch_manager_unittest.cc @@ -441,38 +441,5 @@ TEST_F(SdchManagerTest, HttpsCorrectlySupported) { EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(secure_url)); } -TEST_F(SdchManagerTest, ClearDictionaryData) { - std::string dictionary_domain("x.y.z.google.com"); - GURL blacklist_url("http://bad.chromium.org"); - - std::string dictionary_text(NewSdchDictionary(dictionary_domain)); - std::string tmp_hash; - std::string server_hash; - - SdchManager::GenerateHash(dictionary_text, &tmp_hash, &server_hash); - - EXPECT_TRUE(sdch_manager()->AddSdchDictionary( - dictionary_text, GURL("http://" + dictionary_domain))); - SdchManager::Dictionary* dictionary = NULL; - sdch_manager()->GetVcdiffDictionary( - server_hash, - GURL("http://" + dictionary_domain + "/random_url"), - &dictionary); - EXPECT_TRUE(dictionary); - - sdch_manager()->BlacklistDomain(GURL(blacklist_url)); - EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(blacklist_url)); - - sdch_manager()->ClearData(); - - dictionary = NULL; - sdch_manager()->GetVcdiffDictionary( - server_hash, - GURL("http://" + dictionary_domain + "/random_url"), - &dictionary); - EXPECT_FALSE(dictionary); - EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(blacklist_url)); -} - } // namespace net |