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

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

Issue 2368433002: Add net::SdchSourceStream and net::SdchPolicyDelegate (Closed)
Patch Set: Fix histograms Created 4 years, 2 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
« no previous file with comments | « no previous file | net/base/sdch_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file contains the SdchManager class and the DictionarySet 5 // This file contains the SdchManager class and the DictionarySet
6 // nested class. The manager is responsible for storing all 6 // nested class. The manager is responsible for storing all
7 // SdchDictionarys, and provides access to them through DictionarySet 7 // SdchDictionarys, and provides access to them through DictionarySet
8 // objects. A DictionarySet is an object whose lifetime is under the 8 // objects. A DictionarySet is an object whose lifetime is under the
9 // control of the consumer. It is a reference to a set of 9 // control of the consumer. It is a reference to a set of
10 // dictionaries, and guarantees that none of those dictionaries will 10 // dictionaries, and guarantees that none of those dictionaries will
11 // be destroyed while the DictionarySet reference is alive. 11 // be destroyed while the DictionarySet reference is alive.
12 12
13 #ifndef NET_BASE_SDCH_MANAGER_H_ 13 #ifndef NET_BASE_SDCH_MANAGER_H_
14 #define NET_BASE_SDCH_MANAGER_H_ 14 #define NET_BASE_SDCH_MANAGER_H_
15 15
16 #include <map> 16 #include <map>
17 #include <memory> 17 #include <memory>
18 #include <set> 18 #include <set>
19 #include <string> 19 #include <string>
20 #include <vector> 20 #include <vector>
21 21
22 #include "base/macros.h" 22 #include "base/macros.h"
23 #include "base/memory/ref_counted.h" 23 #include "base/memory/ref_counted.h"
24 #include "base/observer_list.h" 24 #include "base/observer_list.h"
25 #include "base/threading/thread_checker.h" 25 #include "base/threading/thread_checker.h"
26 #include "net/base/net_export.h" 26 #include "net/base/net_export.h"
27 #include "net/base/sdch_dictionary.h" 27 #include "net/base/sdch_dictionary.h"
28 #include "net/base/sdch_problem_codes.h" 28 #include "net/base/sdch_problem_codes.h"
29 #include "net/log/net_log_with_source.h"
29 30
30 class GURL; 31 class GURL;
31 32
32 namespace base { 33 namespace base {
33 class Value; 34 class Value;
34 } 35 }
35 36
36 namespace net { 37 namespace net {
37 38
38 class SdchObserver; 39 class SdchObserver;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 const GURL& dictionary_url, 188 const GURL& dictionary_url,
188 std::string* server_hash_p); 189 std::string* server_hash_p);
189 190
190 // Remove an SDCH dictionary 191 // Remove an SDCH dictionary
191 SdchProblemCode RemoveSdchDictionary(const std::string& server_hash); 192 SdchProblemCode RemoveSdchDictionary(const std::string& server_hash);
192 193
193 // Registration for events generated by the SDCH subsystem. 194 // Registration for events generated by the SDCH subsystem.
194 void AddObserver(SdchObserver* observer); 195 void AddObserver(SdchObserver* observer);
195 void RemoveObserver(SdchObserver* observer); 196 void RemoveObserver(SdchObserver* observer);
196 197
198 // Logs an SDCH failure to UMA and |netlog|.
199 static void LogSdchProblem(NetLogWithSource netlog, SdchProblemCode problem);
200
197 static std::unique_ptr<DictionarySet> CreateEmptyDictionarySetForTesting(); 201 static std::unique_ptr<DictionarySet> CreateEmptyDictionarySetForTesting();
198 202
199 private: 203 private:
200 struct BlacklistInfo { 204 struct BlacklistInfo {
201 BlacklistInfo() : count(0), exponential_count(0), reason(SDCH_OK) {} 205 BlacklistInfo() : count(0), exponential_count(0), reason(SDCH_OK) {}
202 206
203 int count; // # of times to refuse SDCH advertisement. 207 int count; // # of times to refuse SDCH advertisement.
204 int exponential_count; // Current exponential backoff ratchet. 208 int exponential_count; // Current exponential backoff ratchet.
205 SdchProblemCode reason; // Why domain was blacklisted. 209 SdchProblemCode reason; // Why domain was blacklisted.
206 }; 210 };
(...skipping 26 matching lines...) Expand all
233 base::ObserverList<SdchObserver, true> observers_; 237 base::ObserverList<SdchObserver, true> observers_;
234 238
235 base::ThreadChecker thread_checker_; 239 base::ThreadChecker thread_checker_;
236 240
237 DISALLOW_COPY_AND_ASSIGN(SdchManager); 241 DISALLOW_COPY_AND_ASSIGN(SdchManager);
238 }; 242 };
239 243
240 } // namespace net 244 } // namespace net
241 245
242 #endif // NET_BASE_SDCH_MANAGER_H_ 246 #endif // NET_BASE_SDCH_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/sdch_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698