| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Provides global database of differential decompression dictionaries for the | 5 // Provides global database of differential decompression dictionaries for the |
| 6 // SDCH filter (processes sdch enconded content). | 6 // SDCH filter (processes sdch enconded content). |
| 7 | 7 |
| 8 // Exactly one instance of SdchManager is built, and all references are made | 8 // Exactly one instance of SdchManager is built, and all references are made |
| 9 // into that collection. | 9 // into that collection. |
| 10 // | 10 // |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // of the dictionary. The following are the known headers. | 245 // of the dictionary. The following are the known headers. |
| 246 const std::string domain_; | 246 const std::string domain_; |
| 247 const std::string path_; | 247 const std::string path_; |
| 248 const base::Time expiration_; // Implied by max-age. | 248 const base::Time expiration_; // Implied by max-age. |
| 249 const std::set<int> ports_; | 249 const std::set<int> ports_; |
| 250 | 250 |
| 251 DISALLOW_COPY_AND_ASSIGN(Dictionary); | 251 DISALLOW_COPY_AND_ASSIGN(Dictionary); |
| 252 }; | 252 }; |
| 253 | 253 |
| 254 SdchManager(); | 254 SdchManager(); |
| 255 virtual ~SdchManager(); | 255 ~SdchManager() override; |
| 256 | 256 |
| 257 // Clear data (for browser data removal). | 257 // Clear data (for browser data removal). |
| 258 void ClearData(); | 258 void ClearData(); |
| 259 | 259 |
| 260 // Record stats on various errors. | 260 // Record stats on various errors. |
| 261 static void SdchErrorRecovery(ProblemCodes problem); | 261 static void SdchErrorRecovery(ProblemCodes problem); |
| 262 | 262 |
| 263 // Register a fetcher that this class can use to obtain dictionaries. | 263 // Register a fetcher that this class can use to obtain dictionaries. |
| 264 void set_sdch_fetcher(scoped_ptr<SdchFetcher> fetcher); | 264 void set_sdch_fetcher(scoped_ptr<SdchFetcher> fetcher); |
| 265 | 265 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 int GetFetchesCountForTesting() const { | 348 int GetFetchesCountForTesting() const { |
| 349 return fetches_count_for_testing_; | 349 return fetches_count_for_testing_; |
| 350 } | 350 } |
| 351 | 351 |
| 352 // Implementation of SdchFetcher::Delegate. | 352 // Implementation of SdchFetcher::Delegate. |
| 353 | 353 |
| 354 // Add an SDCH dictionary to our list of availible | 354 // Add an SDCH dictionary to our list of availible |
| 355 // dictionaries. This addition will fail if addition is illegal | 355 // dictionaries. This addition will fail if addition is illegal |
| 356 // (data in the dictionary is not acceptable from the | 356 // (data in the dictionary is not acceptable from the |
| 357 // dictionary_url; dictionary already added, etc.). | 357 // dictionary_url; dictionary already added, etc.). |
| 358 virtual void AddSdchDictionary(const std::string& dictionary_text, | 358 void AddSdchDictionary(const std::string& dictionary_text, |
| 359 const GURL& dictionary_url) override; | 359 const GURL& dictionary_url) override; |
| 360 | 360 |
| 361 private: | 361 private: |
| 362 struct BlacklistInfo { | 362 struct BlacklistInfo { |
| 363 BlacklistInfo() | 363 BlacklistInfo() |
| 364 : count(0), | 364 : count(0), |
| 365 exponential_count(0), | 365 exponential_count(0), |
| 366 reason(MIN_PROBLEM_CODE) {} | 366 reason(MIN_PROBLEM_CODE) {} |
| 367 | 367 |
| 368 int count; // # of times to refuse SDCH advertisement. | 368 int count; // # of times to refuse SDCH advertisement. |
| 369 int exponential_count; // Current exponential backoff ratchet. | 369 int exponential_count; // Current exponential backoff ratchet. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 399 ExperimentSet allow_latency_experiment_; | 399 ExperimentSet allow_latency_experiment_; |
| 400 | 400 |
| 401 int fetches_count_for_testing_; | 401 int fetches_count_for_testing_; |
| 402 | 402 |
| 403 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 403 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
| 404 }; | 404 }; |
| 405 | 405 |
| 406 } // namespace net | 406 } // namespace net |
| 407 | 407 |
| 408 #endif // NET_BASE_SDCH_MANAGER_H_ | 408 #endif // NET_BASE_SDCH_MANAGER_H_ |
| OLD | NEW |