| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 SdchManager(); | 239 SdchManager(); |
| 240 ~SdchManager(); | 240 ~SdchManager(); |
| 241 | 241 |
| 242 // Clear data (for browser data removal). | 242 // Clear data (for browser data removal). |
| 243 void ClearData(); | 243 void ClearData(); |
| 244 | 244 |
| 245 // Record stats on various errors. | 245 // Record stats on various errors. |
| 246 static void SdchErrorRecovery(ProblemCodes problem); | 246 static void SdchErrorRecovery(ProblemCodes problem); |
| 247 | 247 |
| 248 // Register a fetcher that this class can use to obtain dictionaries. | 248 // Register a fetcher that this class can use to obtain dictionaries. |
| 249 void set_sdch_fetcher(SdchFetcher* fetcher); | 249 void set_sdch_fetcher(scoped_ptr<SdchFetcher> fetcher); |
| 250 | 250 |
| 251 // Enables or disables SDCH compression. | 251 // Enables or disables SDCH compression. |
| 252 static void EnableSdchSupport(bool enabled); | 252 static void EnableSdchSupport(bool enabled); |
| 253 | 253 |
| 254 static bool sdch_enabled() { return g_sdch_enabled_; } | 254 static bool sdch_enabled() { return g_sdch_enabled_; } |
| 255 | 255 |
| 256 // Enables or disables SDCH compression over secure connection. | 256 // Enables or disables SDCH compression over secure connection. |
| 257 static void EnableSecureSchemeSupport(bool enabled); | 257 static void EnableSecureSchemeSupport(bool enabled); |
| 258 | 258 |
| 259 static bool secure_scheme_supported() { return g_secure_scheme_supported_; } | 259 static bool secure_scheme_supported() { return g_secure_scheme_supported_; } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 std::string* client_hash, std::string* server_hash); | 329 std::string* client_hash, std::string* server_hash); |
| 330 | 330 |
| 331 // For Latency testing only, we need to know if we've succeeded in doing a | 331 // For Latency testing only, we need to know if we've succeeded in doing a |
| 332 // round trip before starting our comparative tests. If ever we encounter | 332 // round trip before starting our comparative tests. If ever we encounter |
| 333 // problems with SDCH, we opt-out of the test unless/until we perform a | 333 // problems with SDCH, we opt-out of the test unless/until we perform a |
| 334 // complete SDCH decoding. | 334 // complete SDCH decoding. |
| 335 bool AllowLatencyExperiment(const GURL& url) const; | 335 bool AllowLatencyExperiment(const GURL& url) const; |
| 336 | 336 |
| 337 void SetAllowLatencyExperiment(const GURL& url, bool enable); | 337 void SetAllowLatencyExperiment(const GURL& url, bool enable); |
| 338 | 338 |
| 339 int GetFetchesCountForTesting() const { |
| 340 return fetches_count_for_testing_; |
| 341 } |
| 342 |
| 339 private: | 343 private: |
| 340 struct BlacklistInfo { | 344 struct BlacklistInfo { |
| 341 BlacklistInfo() | 345 BlacklistInfo() |
| 342 : count(0), | 346 : count(0), |
| 343 exponential_count(0), | 347 exponential_count(0), |
| 344 reason(MIN_PROBLEM_CODE) {} | 348 reason(MIN_PROBLEM_CODE) {} |
| 345 | 349 |
| 346 int count; // # of times to refuse SDCH advertisement. | 350 int count; // # of times to refuse SDCH advertisement. |
| 347 int exponential_count; // Current exponential backoff ratchet. | 351 int exponential_count; // Current exponential backoff ratchet. |
| 348 ProblemCodes reason; // Why domain was blacklisted. | 352 ProblemCodes reason; // Why domain was blacklisted. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 369 // An instance that can fetch a dictionary given a URL. | 373 // An instance that can fetch a dictionary given a URL. |
| 370 scoped_ptr<SdchFetcher> fetcher_; | 374 scoped_ptr<SdchFetcher> fetcher_; |
| 371 | 375 |
| 372 // List domains where decode failures have required disabling sdch. | 376 // List domains where decode failures have required disabling sdch. |
| 373 DomainBlacklistInfo blacklisted_domains_; | 377 DomainBlacklistInfo blacklisted_domains_; |
| 374 | 378 |
| 375 // List of hostnames for which a latency experiment is allowed (because a | 379 // List of hostnames for which a latency experiment is allowed (because a |
| 376 // round trip test has recently passed). | 380 // round trip test has recently passed). |
| 377 ExperimentSet allow_latency_experiment_; | 381 ExperimentSet allow_latency_experiment_; |
| 378 | 382 |
| 383 int fetches_count_for_testing_; |
| 384 |
| 379 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 385 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
| 380 }; | 386 }; |
| 381 | 387 |
| 382 } // namespace net | 388 } // namespace net |
| 383 | 389 |
| 384 #endif // NET_BASE_SDCH_MANAGER_H_ | 390 #endif // NET_BASE_SDCH_MANAGER_H_ |
| OLD | NEW |