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

Unified Diff: chrome/browser/net/view_net_internals_job_factory.cc

Issue 1560025: Initialize the new net internals page using the passively collected log entri... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add missing unittest file Created 10 years, 8 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: chrome/browser/net/view_net_internals_job_factory.cc
===================================================================
--- chrome/browser/net/view_net_internals_job_factory.cc (revision 44225)
+++ chrome/browser/net/view_net_internals_job_factory.cc (working copy)
@@ -30,6 +30,10 @@
const char kViewHttpCacheSubPath[] = "view-cache";
+// TODO(eroman): Delete this file. It should be replaced by
+// chrome/browser/dom_ui/net_internals_ui.cc once the porting is
+// complete.
+
PassiveLogCollector* GetPassiveLogCollector(URLRequestContext* context) {
// Really this is the same as:
// g_browser_process->io_thread()->globals()->
@@ -67,6 +71,25 @@
return GURL(std::string(chrome::kNetworkViewInternalsURL) + details);
}
+// Converts a PassiveLogCollector::EntryList to a CapturingNetLog::EntryList.
+//
+// They are basically the same thing, except PassiveLogCollector has an extra
+// "order" field which we will drop.
+net::CapturingNetLog::EntryList ConvertEntryList(
+ const PassiveLogCollector::EntryList& input) {
+ net::CapturingNetLog::EntryList result;
+ for (size_t i = 0; i < input.size(); ++i) {
+ result.push_back(
+ net::CapturingNetLog::Entry(
+ input[i].type,
+ input[i].time,
+ input[i].source,
+ input[i].phase,
+ input[i].extra_parameters));
+ }
+ return result;
+}
+
// A job subclass that implements a protocol to inspect the internal
// state of the network stack.
class ViewNetInternalsJob : public URLRequestSimpleJob {
@@ -259,8 +282,11 @@
}
virtual void OutputBody(URLRequestContext* context, std::string* out) {
- OutputTextInPre(net::NetLogUtil::PrettyPrintAsEventTree(
- GetInitProxyResolverTracker(context)->entries(), 0), out);
+ OutputTextInPre(
+ net::NetLogUtil::PrettyPrintAsEventTree(
+ ConvertEntryList(GetInitProxyResolverTracker(context)->entries()),
+ 0),
+ out);
}
};
@@ -480,7 +506,7 @@
out->append("</nobr>");
OutputTextInPre(
net::NetLogUtil::PrettyPrintAsEventTree(
- request.entries,
+ ConvertEntryList(request.entries),
request.num_entries_truncated),
out);
out->append("</li>");
« no previous file with comments | « chrome/browser/net/passive_log_collector_unittest.cc ('k') | chrome/browser/resources/net_internals/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698