Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: net/base/sdch_manager.cc

Issue 380003002: Improve testing for SDCH. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/sdch_manager.cc
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index 8892c13a7c46013467b1b249515a8157bab7ed9f..179ba9ba0c43c5c1cc8b6e0e23ce311e272f7edf 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -218,7 +218,8 @@ bool SdchManager::Dictionary::DomainMatch(const GURL& gurl,
}
//------------------------------------------------------------------------------
-SdchManager::SdchManager() {
+SdchManager::SdchManager()
+ : fetches_requested_(0) {
mef 2014/07/10 16:31:42 nit: this should fit on previous line.
DCHECK(CalledOnValidThread());
}
@@ -249,9 +250,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
@@ -339,8 +340,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_requested_;
fetcher_->Schedule(dictionary_url);
+ }
}
bool SdchManager::CanFetchDictionary(const GURL& referring_url,
@@ -557,6 +560,10 @@ void SdchManager::SetAllowLatencyExperiment(const GURL& url, bool enable) {
allow_latency_experiment_.erase(it);
}
+int SdchManager::GetFetchesRequestedForTesting() const {
+ return fetches_requested_;
+}
+
// static
void SdchManager::UrlSafeBase64Encode(const std::string& input,
std::string* output) {

Powered by Google App Engine
This is Rietveld 408576698