| Index: net/base/sdch_manager.cc
|
| diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
|
| index fee75e58f2fd11170213447a1fc911547e261ab4..38fc537a46b24c65d5a0168f15246adbea463d31 100644
|
| --- a/net/base/sdch_manager.cc
|
| +++ b/net/base/sdch_manager.cc
|
| @@ -220,7 +220,8 @@ bool SdchManager::Dictionary::DomainMatch(const GURL& gurl,
|
| }
|
|
|
| //------------------------------------------------------------------------------
|
| -SdchManager::SdchManager() {
|
| +SdchManager::SdchManager()
|
| + : fetches_count_for_testing_(0) {
|
| DCHECK(CalledOnValidThread());
|
| }
|
|
|
| @@ -251,9 +252,9 @@ void SdchManager::SdchErrorRecovery(ProblemCodes problem) {
|
| UMA_HISTOGRAM_ENUMERATION("Sdch3.ProblemCodes_4", problem, MAX_PROBLEM_CODE);
|
| }
|
|
|
| -void SdchManager::set_sdch_fetcher(SdchFetcher* fetcher) {
|
| +void SdchManager::set_sdch_fetcher(scoped_ptr<SdchFetcher> fetcher) {
|
| DCHECK(CalledOnValidThread());
|
| - fetcher_.reset(fetcher);
|
| + fetcher_ = fetcher.Pass();
|
| }
|
|
|
| // static
|
| @@ -341,8 +342,10 @@ bool SdchManager::IsInSupportedDomain(const GURL& url) {
|
| void SdchManager::FetchDictionary(const GURL& request_url,
|
| const GURL& dictionary_url) {
|
| DCHECK(CalledOnValidThread());
|
| - if (CanFetchDictionary(request_url, dictionary_url) && fetcher_.get())
|
| + if (CanFetchDictionary(request_url, dictionary_url) && fetcher_.get()) {
|
| + ++fetches_count_for_testing_;
|
| fetcher_->Schedule(dictionary_url);
|
| + }
|
| }
|
|
|
| bool SdchManager::CanFetchDictionary(const GURL& referring_url,
|
| @@ -565,18 +568,8 @@ void SdchManager::UrlSafeBase64Encode(const std::string& input,
|
| // Since this is only done during a dictionary load, and hashes are only 8
|
| // characters, we just do the simple fixup, rather than rewriting the encoder.
|
| base::Base64Encode(input, output);
|
| - for (size_t i = 0; i < output->size(); ++i) {
|
| - switch (output->data()[i]) {
|
| - case '+':
|
| - (*output)[i] = '-';
|
| - continue;
|
| - case '/':
|
| - (*output)[i] = '_';
|
| - continue;
|
| - default:
|
| - continue;
|
| - }
|
| - }
|
| + std::replace(output->begin(), output->end(), '+', '-');
|
| + std::replace(output->begin(), output->end(), '/', '_');
|
| }
|
|
|
| } // namespace net
|
|
|