OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 static const size_t kMaxDictionaryCount; | 152 static const size_t kMaxDictionaryCount; |
153 | 153 |
154 // There is one instance of |Dictionary| for each memory-cached SDCH | 154 // There is one instance of |Dictionary| for each memory-cached SDCH |
155 // dictionary. | 155 // dictionary. |
156 class Dictionary : public base::RefCounted<Dictionary> { | 156 class Dictionary : public base::RefCounted<Dictionary> { |
157 public: | 157 public: |
158 // Sdch filters can get our text to use in decoding compressed data. | 158 // Sdch filters can get our text to use in decoding compressed data. |
159 const std::string& text() const { return text_; } | 159 const std::string& text() const { return text_; } |
160 | 160 |
161 private: | 161 private: |
| 162 friend class base::RefCounted<Dictionary>; |
162 friend class SdchManager; // Only manager can construct an instance. | 163 friend class SdchManager; // Only manager can construct an instance. |
163 FRIEND_TEST(SdchFilterTest, PathMatch); | 164 FRIEND_TEST(SdchFilterTest, PathMatch); |
164 | 165 |
165 // Construct a vc-diff usable dictionary from the dictionary_text starting | 166 // Construct a vc-diff usable dictionary from the dictionary_text starting |
166 // at the given offset. The supplied client_hash should be used to | 167 // at the given offset. The supplied client_hash should be used to |
167 // advertise the dictionary's availability relative to the suppplied URL. | 168 // advertise the dictionary's availability relative to the suppplied URL. |
168 Dictionary(const std::string& dictionary_text, size_t offset, | 169 Dictionary(const std::string& dictionary_text, size_t offset, |
169 const std::string& client_hash, const GURL& url, | 170 const std::string& client_hash, const GURL& url, |
170 const std::string& domain, const std::string& path, | 171 const std::string& domain, const std::string& path, |
171 const base::Time& expiration, const std::set<int> ports); | 172 const base::Time& expiration, const std::set<int> ports); |
| 173 ~Dictionary() {} |
172 | 174 |
173 const GURL& url() const { return url_; } | 175 const GURL& url() const { return url_; } |
174 const std::string& client_hash() const { return client_hash_; } | 176 const std::string& client_hash() const { return client_hash_; } |
175 | 177 |
176 // Security method to check if we can advertise this dictionary for use | 178 // Security method to check if we can advertise this dictionary for use |
177 // if the |target_url| returns SDCH compressed data. | 179 // if the |target_url| returns SDCH compressed data. |
178 bool CanAdvertise(const GURL& target_url); | 180 bool CanAdvertise(const GURL& target_url); |
179 | 181 |
180 // Security methods to check if we can establish a new dictionary with the | 182 // Security methods to check if we can establish a new dictionary with the |
181 // given data, that arrived in response to get of dictionary_url. | 183 // given data, that arrived in response to get of dictionary_url. |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 DomainCounter exponential_blacklist_count; | 354 DomainCounter exponential_blacklist_count; |
353 | 355 |
354 // List of hostnames for which a latency experiment is allowed (because a | 356 // List of hostnames for which a latency experiment is allowed (because a |
355 // round trip test has recently passed). | 357 // round trip test has recently passed). |
356 ExperimentSet allow_latency_experiment_; | 358 ExperimentSet allow_latency_experiment_; |
357 | 359 |
358 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 360 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
359 }; | 361 }; |
360 | 362 |
361 #endif // NET_BASE_SDCH_MANAGER_H_ | 363 #endif // NET_BASE_SDCH_MANAGER_H_ |
OLD | NEW |