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 // 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 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 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 #include "net/log/net_log_with_source.h" |
| 30 | 30 |
| 31 class GURL; | 31 class GURL; |
| 32 | 32 |
| 33 namespace base { | 33 namespace base { |
| 34 class Value; | 34 class Value; |
| 35 | |
| 36 namespace trace_event { | |
| 37 class MemoryAllocatorDump; | |
| 38 } | |
| 35 } | 39 } |
| 36 | 40 |
| 37 namespace net { | 41 namespace net { |
| 38 | 42 |
| 39 class SdchObserver; | 43 class SdchObserver; |
| 40 | 44 |
| 41 // Provides global database of differential decompression dictionaries for the | 45 // Provides global database of differential decompression dictionaries for the |
| 42 // SDCH filter (processes sdch enconded content). | 46 // SDCH filter (processes sdch enconded content). |
| 43 // | 47 // |
| 44 // The SdchManager maintains a collection of memory resident dictionaries. It | 48 // The SdchManager maintains a collection of memory resident dictionaries. It |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 const GURL& dictionary_url, | 192 const GURL& dictionary_url, |
| 189 std::string* server_hash_p); | 193 std::string* server_hash_p); |
| 190 | 194 |
| 191 // Remove an SDCH dictionary | 195 // Remove an SDCH dictionary |
| 192 SdchProblemCode RemoveSdchDictionary(const std::string& server_hash); | 196 SdchProblemCode RemoveSdchDictionary(const std::string& server_hash); |
| 193 | 197 |
| 194 // Registration for events generated by the SDCH subsystem. | 198 // Registration for events generated by the SDCH subsystem. |
| 195 void AddObserver(SdchObserver* observer); | 199 void AddObserver(SdchObserver* observer); |
| 196 void RemoveObserver(SdchObserver* observer); | 200 void RemoveObserver(SdchObserver* observer); |
| 197 | 201 |
| 202 // Called by URLRequestContext to dump memory allocation stats. | |
| 203 // |url_request_context_dump| is the associated URLRequestContext memory dump. | |
|
eroman
2016/12/01 21:04:37
Would calling this parent_dump (or something like
| |
| 204 void DumpMemoryStats( | |
| 205 base::trace_event::MemoryAllocatorDump* url_request_context_dump) const; | |
| 206 | |
| 198 // Logs an SDCH failure to UMA and |netlog|. | 207 // Logs an SDCH failure to UMA and |netlog|. |
| 199 static void LogSdchProblem(NetLogWithSource netlog, SdchProblemCode problem); | 208 static void LogSdchProblem(NetLogWithSource netlog, SdchProblemCode problem); |
| 200 | 209 |
| 201 static std::unique_ptr<DictionarySet> CreateEmptyDictionarySetForTesting(); | 210 static std::unique_ptr<DictionarySet> CreateEmptyDictionarySetForTesting(); |
| 202 | 211 |
| 203 private: | 212 private: |
| 204 struct BlacklistInfo { | 213 struct BlacklistInfo { |
| 205 BlacklistInfo() : count(0), exponential_count(0), reason(SDCH_OK) {} | 214 BlacklistInfo() : count(0), exponential_count(0), reason(SDCH_OK) {} |
| 206 | 215 |
| 207 int count; // # of times to refuse SDCH advertisement. | 216 int count; // # of times to refuse SDCH advertisement. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 237 base::ObserverList<SdchObserver, true> observers_; | 246 base::ObserverList<SdchObserver, true> observers_; |
| 238 | 247 |
| 239 base::ThreadChecker thread_checker_; | 248 base::ThreadChecker thread_checker_; |
| 240 | 249 |
| 241 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 250 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
| 242 }; | 251 }; |
| 243 | 252 |
| 244 } // namespace net | 253 } // namespace net |
| 245 | 254 |
| 246 #endif // NET_BASE_SDCH_MANAGER_H_ | 255 #endif // NET_BASE_SDCH_MANAGER_H_ |
| OLD | NEW |