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 typedef std::map<std::string, int> DomainCounter; | 344 typedef std::map<std::string, int> DomainCounter; |
341 typedef std::set<std::string> ExperimentSet; | 345 typedef std::set<std::string> ExperimentSet; |
342 | 346 |
343 // A map of dictionaries info indexed by the hash that the server provides. | 347 // A map of dictionaries info indexed by the hash that the server provides. |
344 typedef std::map<std::string, scoped_refptr<Dictionary> > DictionaryMap; | 348 typedef std::map<std::string, scoped_refptr<Dictionary> > DictionaryMap; |
345 | 349 |
346 // Support SDCH compression, by advertising in headers. | 350 // Support SDCH compression, by advertising in headers. |
347 static bool g_sdch_enabled_; | 351 static bool g_sdch_enabled_; |
348 | 352 |
(...skipping 14 matching lines...) Expand all Loading... |
363 DomainCounter blacklisted_domains_; | 367 DomainCounter blacklisted_domains_; |
364 | 368 |
365 // Support exponential backoff in number of domain accesses before | 369 // Support exponential backoff in number of domain accesses before |
366 // blacklisting expires. | 370 // blacklisting expires. |
367 DomainCounter exponential_blacklist_count_; | 371 DomainCounter exponential_blacklist_count_; |
368 | 372 |
369 // List of hostnames for which a latency experiment is allowed (because a | 373 // List of hostnames for which a latency experiment is allowed (because a |
370 // round trip test has recently passed). | 374 // round trip test has recently passed). |
371 ExperimentSet allow_latency_experiment_; | 375 ExperimentSet allow_latency_experiment_; |
372 | 376 |
| 377 int fetches_count_for_testing_; |
| 378 |
373 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 379 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
374 }; | 380 }; |
375 | 381 |
376 } // namespace net | 382 } // namespace net |
377 | 383 |
378 #endif // NET_BASE_SDCH_MANAGER_H_ | 384 #endif // NET_BASE_SDCH_MANAGER_H_ |
OLD | NEW |