 Chromium Code Reviews
 Chromium Code Reviews Issue 298063006:
  Make SdchManager per-profile.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 298063006:
  Make SdchManager per-profile.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: net/filter/sdch_filter.cc | 
| diff --git a/net/filter/sdch_filter.cc b/net/filter/sdch_filter.cc | 
| index 55d9b4c6bd984c4934df7472e17c3b1b2ecc2faf..1e07bd12a98befc5425db548b6d019ea363b8b18 100644 | 
| --- a/net/filter/sdch_filter.cc | 
| +++ b/net/filter/sdch_filter.cc | 
| @@ -12,6 +12,7 @@ | 
| #include "base/logging.h" | 
| #include "base/metrics/histogram.h" | 
| #include "net/base/sdch_manager.h" | 
| +#include "net/url_request/url_request_context.h" | 
| #include "sdch/open-vcdiff/src/google/vcdecoder.h" | 
| @@ -32,6 +33,7 @@ SdchFilter::SdchFilter(const FilterContext& filter_context) | 
| DCHECK(success); | 
| success = filter_context.GetURL(&url_); | 
| DCHECK(success); | 
| + DCHECK(filter_context_.GetURLRequestContext()->sdch_manager()); | 
| } | 
| SdchFilter::~SdchFilter() { | 
| @@ -51,7 +53,8 @@ SdchFilter::~SdchFilter() { | 
| // Make it possible for the user to hit reload, and get non-sdch content. | 
| // Note this will "wear off" quickly enough, and is just meant to assure | 
| // in some rare case that the user is not stuck. | 
| - SdchManager::BlacklistDomain(url_); | 
| + filter_context_.GetURLRequestContext()->sdch_manager()->BlacklistDomain( | 
| + url_); | 
| UMA_HISTOGRAM_COUNTS("Sdch3.PartialBytesIn", | 
| 
jar (doing other things)
2014/06/09 23:03:01
nit: I went and looked at these histogtrams.  The
 
Randy Smith (Not in Mondays)
2014/06/10 20:38:41
Will do, but in a separate CL.  Confirming: I do t
 
jar (doing other things)
2014/06/11 20:04:43
+1 with your plan, inluding <owner> field.
On 201
 | 
| static_cast<int>(filter_context_.GetByteReadCount())); | 
| UMA_HISTOGRAM_COUNTS("Sdch3.PartialVcdiffIn", source_bytes_); | 
| @@ -88,7 +91,8 @@ SdchFilter::~SdchFilter() { | 
| filter_context_.RecordPacketStats(FilterContext::SDCH_DECODE); | 
| // Allow latency experiments to proceed. | 
| - SdchManager::Global()->SetAllowLatencyExperiment(url_, true); | 
| + filter_context_.GetURLRequestContext()->sdch_manager()-> | 
| + SetAllowLatencyExperiment(url_, true); | 
| return; | 
| } | 
| case PASS_THROUGH: { | 
| @@ -213,7 +217,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, | 
| SdchManager::SdchErrorRecovery(SdchManager::PASSING_THROUGH_NON_SDCH); | 
| decoding_status_ = PASS_THROUGH; | 
| // ... but further back-off on advertising SDCH support. | 
| - SdchManager::BlacklistDomain(url_); | 
| + filter_context_.GetURLRequestContext()->sdch_manager()->BlacklistDomain( | 
| + url_); | 
| } | 
| if (decoding_status_ == PASS_THROUGH) { | 
| @@ -223,7 +228,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, | 
| if (std::string::npos == mime_type_.find("text/html")) { | 
| // Since we can't do a meta-refresh (along with an exponential | 
| // backoff), we'll just make sure this NEVER happens again. | 
| - SdchManager::BlacklistDomainForever(url_); | 
| + filter_context_.GetURLRequestContext()->sdch_manager()-> | 
| + BlacklistDomainForever(url_); | 
| if (filter_context_.IsCachedContent()) | 
| SdchManager::SdchErrorRecovery( | 
| SdchManager::CACHED_META_REFRESH_UNSUPPORTED); | 
| @@ -242,7 +248,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, | 
| } else { | 
| // Since it wasn't in the cache, we definately need at least some | 
| // period of blacklisting to get the correct content. | 
| - SdchManager::BlacklistDomain(url_); | 
| + filter_context_.GetURLRequestContext()->sdch_manager()-> | 
| + BlacklistDomain(url_); | 
| SdchManager::SdchErrorRecovery(SdchManager::META_REFRESH_RECOVERY); | 
| } | 
| decoding_status_ = META_REFRESH_RECOVERY; | 
| @@ -335,12 +342,15 @@ Filter::FilterStatus SdchFilter::InitializeDictionary() { | 
| dictionary_hash_is_plausible_ = true; // Assume plausible, but check. | 
| SdchManager::Dictionary* dictionary = NULL; | 
| - if ('\0' == dictionary_hash_[kServerIdLength - 1]) | 
| - SdchManager::Global()->GetVcdiffDictionary(std::string(dictionary_hash_, 0, | 
| - kServerIdLength - 1), | 
| - url_, &dictionary); | 
| - else | 
| + if ('\0' == dictionary_hash_[kServerIdLength - 1]) { | 
| + SdchManager* manager( | 
| + filter_context_.GetURLRequestContext()->sdch_manager()); | 
| + manager->GetVcdiffDictionary( | 
| + std::string(dictionary_hash_, 0, kServerIdLength - 1), | 
| + url_, &dictionary); | 
| + } else { | 
| dictionary_hash_is_plausible_ = false; | 
| + } | 
| if (!dictionary) { | 
| DCHECK(dictionary_hash_.size() == kServerIdLength); |