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

Unified Diff: net/base/sdch_manager.h

Issue 423813002: Sdch view for net-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
Index: net/base/sdch_manager.h
diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h
index 6f2ea5af6de0a637e70a395164fe5f80fdd09af3..56f2aee396ccfd6f4ff40c35a45490cf971ca827 100644
--- a/net/base/sdch_manager.h
+++ b/net/base/sdch_manager.h
@@ -23,6 +23,7 @@
#include <map>
#include <set>
#include <string>
+#include <vector>
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
@@ -32,6 +33,11 @@
#include "net/base/net_export.h"
#include "url/gurl.h"
+namespace base {
+class Value;
+class DictionaryValue;
+}
+
namespace net {
//------------------------------------------------------------------------------
@@ -200,11 +206,12 @@ class NET_EXPORT SdchManager : public NON_EXPORTED_BASE(base::NonThreadSafe) {
// Security methods to check if we can establish a new dictionary with the
// given data, that arrived in response to get of dictionary_url.
static bool CanSet(const std::string& domain, const std::string& path,
- const std::set<int>& ports, const GURL& dictionary_url);
+ const std::set<int>& ports, const GURL& dictionary_url,
+ SdchManager* sdch_manager);
// Security method to check if we can use a dictionary to decompress a
// target that arrived with a reference to this dictionary.
- bool CanUse(const GURL& referring_url);
+ bool CanUse(const GURL& referring_url, SdchManager* sdch_manager);
// Compare paths to see if they "match" for dictionary use.
static bool PathMatch(const std::string& path,
@@ -213,6 +220,7 @@ class NET_EXPORT SdchManager : public NON_EXPORTED_BASE(base::NonThreadSafe) {
// Compare domains to see if the "match" for dictionary use.
static bool DomainMatch(const GURL& url, const std::string& restriction);
+ base::DictionaryValue* DictionaryInfoToValue() const;
// The actual text of the dictionary.
std::string text_;
@@ -243,7 +251,7 @@ class NET_EXPORT SdchManager : public NON_EXPORTED_BASE(base::NonThreadSafe) {
void ClearData();
// Record stats on various errors.
- static void SdchErrorRecovery(ProblemCodes problem);
+ void SdchErrorRecovery(ProblemCodes problem, const GURL& url) const;
// Register a fetcher that this class can use to obtain dictionaries.
void set_sdch_fetcher(SdchFetcher* fetcher);
@@ -336,6 +344,8 @@ class NET_EXPORT SdchManager : public NON_EXPORTED_BASE(base::NonThreadSafe) {
void SetAllowLatencyExperiment(const GURL& url, bool enable);
+ base::Value* SdchInfoToValue() const;
+
private:
typedef std::map<std::string, int> DomainCounter;
typedef std::set<std::string> ExperimentSet;
@@ -343,6 +353,9 @@ class NET_EXPORT SdchManager : public NON_EXPORTED_BASE(base::NonThreadSafe) {
// A map of dictionaries info indexed by the hash that the server provides.
typedef std::map<std::string, scoped_refptr<Dictionary> > DictionaryMap;
+ // List of urls and encountered SDCH problems.
+ typedef std::vector<std::pair<std::string, ProblemCodes> > Problems;
+
// Support SDCH compression, by advertising in headers.
static bool g_sdch_enabled_;
@@ -370,6 +383,8 @@ class NET_EXPORT SdchManager : public NON_EXPORTED_BASE(base::NonThreadSafe) {
// round trip test has recently passed).
ExperimentSet allow_latency_experiment_;
+ mutable Problems problems_;
+
DISALLOW_COPY_AND_ASSIGN(SdchManager);
};

Powered by Google App Engine
This is Rietveld 408576698