Chromium Code Reviews| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 static void SdchErrorRecovery(ProblemCodes problem); | 244 static void SdchErrorRecovery(ProblemCodes problem); |
| 245 | 245 |
| 246 // Register a fetcher that this class can use to obtain dictionaries. | 246 // Register a fetcher that this class can use to obtain dictionaries. |
| 247 void set_sdch_fetcher(SdchFetcher* fetcher); | 247 void set_sdch_fetcher(SdchFetcher* fetcher); |
| 248 | 248 |
| 249 // Enables or disables SDCH compression. | 249 // Enables or disables SDCH compression. |
| 250 static void EnableSdchSupport(bool enabled); | 250 static void EnableSdchSupport(bool enabled); |
| 251 | 251 |
| 252 static bool sdch_enabled() { return g_sdch_enabled_; } | 252 static bool sdch_enabled() { return g_sdch_enabled_; } |
| 253 | 253 |
| 254 // Enables or disables SDCH compression over secure connection. | |
| 255 static void EnableSdchOverSecureSupport(bool enabled); | |
|
jar (doing other things)
2014/01/03 18:35:13
nit: This is already in the SdchManager class... s
mef
2014/01/03 20:26:55
Done.
| |
| 256 | |
| 257 static bool sdch_over_secure_enabled() { return g_sdch_over_secure_enabled_; } | |
|
jar (doing other things)
2014/01/03 18:35:13
nit: secure_scheme_supported
make this a const me
mef
2014/01/03 20:26:55
Done.
| |
| 258 | |
| 254 // Briefly prevent further advertising of SDCH on this domain (if SDCH is | 259 // Briefly prevent further advertising of SDCH on this domain (if SDCH is |
| 255 // enabled). After enough calls to IsInSupportedDomain() the blacklisting | 260 // enabled). After enough calls to IsInSupportedDomain() the blacklisting |
| 256 // will be removed. Additional blacklists take exponentially more calls | 261 // will be removed. Additional blacklists take exponentially more calls |
| 257 // to IsInSupportedDomain() before the blacklisting is undone. | 262 // to IsInSupportedDomain() before the blacklisting is undone. |
| 258 // Used when filter errors are found from a given domain, but it is plausible | 263 // Used when filter errors are found from a given domain, but it is plausible |
| 259 // that the cause is temporary (such as application startup, where cached | 264 // that the cause is temporary (such as application startup, where cached |
| 260 // entries are used, but a dictionary is not yet loaded). | 265 // entries are used, but a dictionary is not yet loaded). |
| 261 static void BlacklistDomain(const GURL& url); | 266 static void BlacklistDomain(const GURL& url); |
| 262 | 267 |
| 263 // Used when SEVERE filter errors are found from a given domain, to prevent | 268 // Used when SEVERE filter errors are found from a given domain, to prevent |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 | 342 |
| 338 // A map of dictionaries info indexed by the hash that the server provides. | 343 // A map of dictionaries info indexed by the hash that the server provides. |
| 339 typedef std::map<std::string, Dictionary*> DictionaryMap; | 344 typedef std::map<std::string, Dictionary*> DictionaryMap; |
| 340 | 345 |
| 341 // The one global instance of that holds all the data. | 346 // The one global instance of that holds all the data. |
| 342 static SdchManager* global_; | 347 static SdchManager* global_; |
| 343 | 348 |
| 344 // Support SDCH compression, by advertising in headers. | 349 // Support SDCH compression, by advertising in headers. |
| 345 static bool g_sdch_enabled_; | 350 static bool g_sdch_enabled_; |
| 346 | 351 |
| 352 // Support SDCH compression over secure connection, by advertising in headers. | |
|
jar (doing other things)
2014/01/03 18:35:13
nit: Better might be g_secure_scheme_support_
bet
mef
2014/01/03 20:26:55
Done.
| |
| 353 static bool g_sdch_over_secure_enabled_; | |
| 354 | |
| 347 // A simple implementation of a RFC 3548 "URL safe" base64 encoder. | 355 // A simple implementation of a RFC 3548 "URL safe" base64 encoder. |
| 348 static void UrlSafeBase64Encode(const std::string& input, | 356 static void UrlSafeBase64Encode(const std::string& input, |
| 349 std::string* output); | 357 std::string* output); |
| 350 DictionaryMap dictionaries_; | 358 DictionaryMap dictionaries_; |
| 351 | 359 |
| 352 // An instance that can fetch a dictionary given a URL. | 360 // An instance that can fetch a dictionary given a URL. |
| 353 scoped_ptr<SdchFetcher> fetcher_; | 361 scoped_ptr<SdchFetcher> fetcher_; |
| 354 | 362 |
| 355 // List domains where decode failures have required disabling sdch, along with | 363 // List domains where decode failures have required disabling sdch, along with |
| 356 // count of how many additonal uses should be blacklisted. | 364 // count of how many additonal uses should be blacklisted. |
| 357 DomainCounter blacklisted_domains_; | 365 DomainCounter blacklisted_domains_; |
| 358 | 366 |
| 359 // Support exponential backoff in number of domain accesses before | 367 // Support exponential backoff in number of domain accesses before |
| 360 // blacklisting expires. | 368 // blacklisting expires. |
| 361 DomainCounter exponential_blacklist_count; | 369 DomainCounter exponential_blacklist_count; |
| 362 | 370 |
| 363 // List of hostnames for which a latency experiment is allowed (because a | 371 // List of hostnames for which a latency experiment is allowed (because a |
| 364 // round trip test has recently passed). | 372 // round trip test has recently passed). |
| 365 ExperimentSet allow_latency_experiment_; | 373 ExperimentSet allow_latency_experiment_; |
| 366 | 374 |
| 367 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 375 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
| 368 }; | 376 }; |
| 369 | 377 |
| 370 } // namespace net | 378 } // namespace net |
| 371 | 379 |
| 372 #endif // NET_BASE_SDCH_MANAGER_H_ | 380 #endif // NET_BASE_SDCH_MANAGER_H_ |
| OLD | NEW |