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

Unified Diff: net/base/net_log_util.cc

Issue 423813002: Sdch view for net-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary include Created 6 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 side-by-side diff with in-line comments
Download patch
Index: net/base/net_log_util.cc
diff --git a/net/base/net_log_util.cc b/net/base/net_log_util.cc
index b8816bad919441a12428d49f79ffb19ddb6027bc..ce7979796f212ea5ff02e05a396d7fef48636330 100644
--- a/net/base/net_log_util.cc
+++ b/net/base/net_log_util.cc
@@ -15,6 +15,7 @@
#include "net/base/load_states.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
+#include "net/base/sdch_manager.h"
#include "net/disk_cache/disk_cache.h"
#include "net/dns/host_cache.h"
#include "net/dns/host_resolver.h"
@@ -66,6 +67,12 @@ const short kNetErrors[] = {
#undef NET_ERROR
};
+const StringToConstant kSdchProblems[] = {
+#define SDCH_PROBLEM_CODE(label, value) { #label, value },
+#include "net/base/sdch_problem_code_list.h"
+#undef SDCH_PROBLEM_CODE
+};
+
const char* NetInfoSourceToString(NetInfoSource source) {
switch (source) {
#define NET_INFO_SOURCE(label, string, value) \
@@ -187,6 +194,17 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() {
constants_dict->Set("quicRstStreamError", dict);
}
+ // Add information on the relationship between SDCH problem codes and their
+ // symbolic names.
+ {
+ base::DictionaryValue* dict = new base::DictionaryValue();
+
+ for (size_t i = 0; i < arraysize(kSdchProblems); i++)
+ dict->SetInteger(kSdchProblems[i].name, kSdchProblems[i].constant);
+
+ constants_dict->Set("sdchProblemCode", dict);
+ }
+
// Information about the relationship between event phase enums and their
// symbolic names.
{
@@ -455,6 +473,18 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo(
info_dict);
}
+ if (info_sources & NET_INFO_SDCH) {
+ base::Value* info_dict = nullptr;
mmenke 2014/10/30 21:18:52 nit: No need to initialize. We're in trouble if
+ SdchManager* sdch_manager = context->sdch_manager();
+ if (sdch_manager) {
+ info_dict = sdch_manager->SdchInfoToValue();
+ } else {
+ info_dict = new base::DictionaryValue();
+ }
+ net_info_dict->Set(NetInfoSourceToString(NET_INFO_SDCH),
+ info_dict);
+ }
+
return net_info_dict.Pass();
}

Powered by Google App Engine
This is Rietveld 408576698