Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: net/base/sdch_manager.h

Issue 6347033: net: Add namespace net to Sdch* classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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 //
11 // The SdchManager maintains a collection of memory resident dictionaries. It 11 // The SdchManager maintains a collection of memory resident dictionaries. It
(...skipping 12 matching lines...) Expand all
24 #include <map> 24 #include <map>
25 #include <set> 25 #include <set>
26 #include <string> 26 #include <string>
27 27
28 #include "base/gtest_prod_util.h" 28 #include "base/gtest_prod_util.h"
29 #include "base/ref_counted.h" 29 #include "base/ref_counted.h"
30 #include "base/scoped_ptr.h" 30 #include "base/scoped_ptr.h"
31 #include "base/time.h" 31 #include "base/time.h"
32 #include "googleurl/src/gurl.h" 32 #include "googleurl/src/gurl.h"
33 33
34 namespace net {
35
34 //------------------------------------------------------------------------------ 36 //------------------------------------------------------------------------------
35 // Create a public interface to help us load SDCH dictionaries. 37 // Create a public interface to help us load SDCH dictionaries.
36 // The SdchManager class allows registration to support this interface. 38 // The SdchManager class allows registration to support this interface.
37 // A browser may register a fetcher that is used by the dictionary managers to 39 // A browser may register a fetcher that is used by the dictionary managers to
38 // get data from a specified URL. This allows us to use very high level browser 40 // get data from a specified URL. This allows us to use very high level browser
39 // functionality in this base (when the functionaity can be provided). 41 // functionality in this base (when the functionaity can be provided).
40 class SdchFetcher { 42 class SdchFetcher {
41 public: 43 public:
42 SdchFetcher() {} 44 SdchFetcher() {}
43 virtual ~SdchFetcher() {} 45 virtual ~SdchFetcher() {}
44 46
45 // The Schedule() method is called when there is a need to get a dictionary 47 // The Schedule() method is called when there is a need to get a dictionary
46 // from a server. The callee is responsible for getting that dictionary_text, 48 // from a server. The callee is responsible for getting that dictionary_text,
47 // and then calling back to AddSdchDictionary() to the SdchManager instance. 49 // and then calling back to AddSdchDictionary() to the SdchManager instance.
48 virtual void Schedule(const GURL& dictionary_url) = 0; 50 virtual void Schedule(const GURL& dictionary_url) = 0;
49 private: 51 private:
50 DISALLOW_COPY_AND_ASSIGN(SdchFetcher); 52 DISALLOW_COPY_AND_ASSIGN(SdchFetcher);
51 }; 53 };
54
52 //------------------------------------------------------------------------------ 55 //------------------------------------------------------------------------------
53 56
54 class SdchManager { 57 class SdchManager {
55 public: 58 public:
56 // A list of errors that appeared and were either resolved, or used to turn 59 // A list of errors that appeared and were either resolved, or used to turn
57 // off sdch encoding. 60 // off sdch encoding.
58 enum ProblemCodes { 61 enum ProblemCodes {
59 MIN_PROBLEM_CODE, 62 MIN_PROBLEM_CODE,
60 63
61 // Content-encoding correction problems. 64 // Content-encoding correction problems.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 161
159 // There is one instance of |Dictionary| for each memory-cached SDCH 162 // There is one instance of |Dictionary| for each memory-cached SDCH
160 // dictionary. 163 // dictionary.
161 class Dictionary : public base::RefCounted<Dictionary> { 164 class Dictionary : public base::RefCounted<Dictionary> {
162 public: 165 public:
163 // Sdch filters can get our text to use in decoding compressed data. 166 // Sdch filters can get our text to use in decoding compressed data.
164 const std::string& text() const { return text_; } 167 const std::string& text() const { return text_; }
165 168
166 private: 169 private:
167 friend class base::RefCounted<Dictionary>; 170 friend class base::RefCounted<Dictionary>;
168 friend class SdchManager; // Only manager can construct an instance. 171 friend class net::SdchManager; // Only manager can construct an instance.
willchan no longer on Chromium 2011/01/31 07:02:43 Try removing this net::. The error is because the
tfarina 2011/01/31 12:40:21 Done.
169 FRIEND_TEST_ALL_PREFIXES(SdchFilterTest, PathMatch); 172 FRIEND_TEST_ALL_PREFIXES(SdchFilterTest, PathMatch);
170 173
171 // Construct a vc-diff usable dictionary from the dictionary_text starting 174 // Construct a vc-diff usable dictionary from the dictionary_text starting
172 // at the given offset. The supplied client_hash should be used to 175 // at the given offset. The supplied client_hash should be used to
173 // advertise the dictionary's availability relative to the suppplied URL. 176 // advertise the dictionary's availability relative to the suppplied URL.
174 Dictionary(const std::string& dictionary_text, size_t offset, 177 Dictionary(const std::string& dictionary_text, size_t offset,
175 const std::string& client_hash, const GURL& url, 178 const std::string& client_hash, const GURL& url,
176 const std::string& domain, const std::string& path, 179 const std::string& domain, const std::string& path,
177 const base::Time& expiration, const std::set<int> ports); 180 const base::Time& expiration, const std::set<int> ports);
willchan no longer on Chromium 2011/01/31 07:02:43 Looks like jar wrote an accidental bug here. Shoul
tfarina 2011/01/31 12:40:21 Done.
178 ~Dictionary(); 181 ~Dictionary();
179 182
180 const GURL& url() const { return url_; } 183 const GURL& url() const { return url_; }
181 const std::string& client_hash() const { return client_hash_; } 184 const std::string& client_hash() const { return client_hash_; }
182 185
183 // Security method to check if we can advertise this dictionary for use 186 // Security method to check if we can advertise this dictionary for use
184 // if the |target_url| returns SDCH compressed data. 187 // if the |target_url| returns SDCH compressed data.
185 bool CanAdvertise(const GURL& target_url); 188 bool CanAdvertise(const GURL& target_url);
186 189
187 // Security methods to check if we can establish a new dictionary with the 190 // Security methods to check if we can establish a new dictionary with the
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // blacklisting expires. 361 // blacklisting expires.
359 DomainCounter exponential_blacklist_count; 362 DomainCounter exponential_blacklist_count;
360 363
361 // List of hostnames for which a latency experiment is allowed (because a 364 // List of hostnames for which a latency experiment is allowed (because a
362 // round trip test has recently passed). 365 // round trip test has recently passed).
363 ExperimentSet allow_latency_experiment_; 366 ExperimentSet allow_latency_experiment_;
364 367
365 DISALLOW_COPY_AND_ASSIGN(SdchManager); 368 DISALLOW_COPY_AND_ASSIGN(SdchManager);
366 }; 369 };
367 370
371 } // namespace net
372
368 #endif // NET_BASE_SDCH_MANAGER_H_ 373 #endif // NET_BASE_SDCH_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698