summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/http/http_network_transaction.cc3
-rw-r--r--net/url_request/url_request_view_net_internal_job.cc68
2 files changed, 66 insertions, 5 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 4af1fa3..f81b9e2 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -625,7 +625,8 @@ int HttpNetworkTransaction::DoInitConnection() {
}
int rv = connection_.Init(connection_group, resolve_info, request_->priority,
- &io_callback_, session_->tcp_socket_pool(), NULL);
+ &io_callback_, session_->tcp_socket_pool(),
+ load_log_);
return rv;
}
diff --git a/net/url_request/url_request_view_net_internal_job.cc b/net/url_request/url_request_view_net_internal_job.cc
index d2185c4..a18d378 100644
--- a/net/url_request/url_request_view_net_internal_job.cc
+++ b/net/url_request/url_request_view_net_internal_job.cc
@@ -14,6 +14,7 @@
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/proxy/proxy_service.h"
+#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
namespace {
@@ -262,14 +263,73 @@ class HostResolverSubSection : public SubSection {
}
};
+// Helper for the URLRequest "outstanding" and "live" sections.
+void OutputURLAndLoadLog(const GURL& url,
+ const net::LoadLog* log,
+ std::string* out) {
+ out->append("<li>");
+ out->append("<nobr>");
+ out->append(EscapeForHTML(url.spec()));
+ out->append("</nobr>");
+ if (log)
+ OutputTextInPre(net::LoadLogUtil::PrettyPrintAsEventTree(log), out);
+ out->append("</li>");
+}
+
+class URLRequestLiveSubSection : public SubSection {
+ public:
+ URLRequestLiveSubSection(SubSection* parent)
+ : SubSection(parent, "outstanding", "Outstanding requests") {
+ }
+
+ virtual void OutputBody(URLRequestContext* /*context*/, std::string* out) {
+ URLRequest::InstanceTracker* tracker = URLRequest::InstanceTracker::Get();
+
+ // Note that these are the requests across ALL contexts.
+ std::vector<URLRequest*> requests = tracker->GetLiveRequests();
+
+ out->append("<ol>");
+ for (size_t i = 0; i < requests.size(); ++i) {
+ // Reverse the list order, so we dispay from most recent to oldest.
+ size_t index = requests.size() - i - 1;
+ OutputURLAndLoadLog(requests[index]->original_url(),
+ requests[index]->load_log(),
+ out);
+ }
+ out->append("</ol>");
+ }
+};
+
+class URLRequestRecentSubSection : public SubSection {
+ public:
+ URLRequestRecentSubSection(SubSection* parent)
+ : SubSection(parent, "recent", "Recently completed requests") {
+ }
+
+ virtual void OutputBody(URLRequestContext* /*context*/, std::string* out) {
+ URLRequest::InstanceTracker* tracker = URLRequest::InstanceTracker::Get();
+
+ // Note that these are the recently completed requests across ALL contexts.
+ URLRequest::InstanceTracker::RecentRequestInfoList recent =
+ tracker->GetRecentlyDeceased();
+
+ out->append("<ol>");
+ for (size_t i = 0; i < recent.size(); ++i) {
+ // Reverse the list order, so we dispay from most recent to oldest.
+ size_t index = recent.size() - i - 1;
+ OutputURLAndLoadLog(recent[index].original_url,
+ recent[index].load_log, out);
+ }
+ out->append("</ol>");
+ }
+};
+
class URLRequestSubSection : public SubSection {
public:
URLRequestSubSection(SubSection* parent)
: SubSection(parent, "urlrequest", "URLRequest") {
- }
-
- virtual void OutputBody(URLRequestContext* context, std::string* out) {
- out->append("TODO");
+ AddSubSection(new URLRequestLiveSubSection(this));
+ AddSubSection(new URLRequestRecentSubSection(this));
}
};