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

Unified Diff: net/base/sdch_manager.h

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_error_list.h ('k') | net/base/sdch_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_manager.h
diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h
index 0948b4c71782764569ee988726320a371752a263..c83d3a41ce59263466b7928eda2b3788bfde5ccb 100644
--- a/net/base/sdch_manager.h
+++ b/net/base/sdch_manager.h
@@ -59,11 +59,6 @@ class NET_EXPORT SdchManager {
typedef std::map<std::string, scoped_refptr<base::RefCountedData<Dictionary>>>
DictionaryMap;
- // Use the following static limits to block DOS attacks until we implement
- // a cached dictionary evicition strategy.
- static const size_t kMaxDictionarySize;
- static const size_t kMaxDictionaryCount;
-
class NET_EXPORT_PRIVATE Dictionary {
public:
// Construct a vc-diff usable dictionary from the dictionary_text starting
@@ -72,6 +67,7 @@ class NET_EXPORT SdchManager {
Dictionary(const std::string& dictionary_text,
size_t offset,
const std::string& client_hash,
+ const std::string& server_hash,
const GURL& url,
const std::string& domain,
const std::string& path,
@@ -85,6 +81,7 @@ class NET_EXPORT SdchManager {
const GURL& url() const { return url_; }
const std::string& client_hash() const { return client_hash_; }
+ const std::string& server_hash() const { return server_hash_; }
const std::string& domain() const { return domain_; }
const std::string& path() const { return path_; }
const base::Time& expiration() const { return expiration_; }
@@ -128,6 +125,10 @@ class NET_EXPORT SdchManager {
// it has a specific dictionary pre-cached.
std::string client_hash_;
+ // Part of the hash of text_ that the server uses to identify the
+ // dictionary it wants used for decoding.
+ std::string server_hash_;
+
// The GURL that arrived with the text_ in a URL request to specify where
// this dictionary may be used.
const GURL url_;
@@ -233,6 +234,10 @@ class NET_EXPORT SdchManager {
SdchProblemCode OnGetDictionary(const GURL& request_url,
const GURL& dictionary_url);
+ // Send out appropriate events notifying observers that a dictionary
+ // was successfully used to decode a request.
+ void OnDictionaryUsed(const std::string& server_hash);
+
// Get a handle to the available dictionaries that might be used
// for encoding responses for the given URL. The return set will not
// include expired dictionaries. If no dictionaries
@@ -270,10 +275,16 @@ class NET_EXPORT SdchManager {
// dictionaries. This addition will fail if addition is illegal
// (data in the dictionary is not acceptable from the
// dictionary_url; dictionary already added, etc.).
+ // If |server_hash| is non-null, returns the server hash that may be
+ // used as an argument to GetDictionarySetByHash.
// Returns SDCH_OK if the addition was successfull, and corresponding error
// code otherwise.
SdchProblemCode AddSdchDictionary(const std::string& dictionary_text,
- const GURL& dictionary_url);
+ const GURL& dictionary_url,
+ std::string* server_hash_p);
+
+ // Remove an SDCH dictionary
+ SdchProblemCode RemoveSdchDictionary(const std::string& server_hash);
// Registration for events generated by the SDCH subsystem.
void AddObserver(SdchObserver* observer);
« no previous file with comments | « net/base/net_error_list.h ('k') | net/base/sdch_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698