summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 19:58:14 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 19:58:14 +0000
commit465aeb94531f3d73959412b2c8033005fb7c44d7 (patch)
tree39d71fab356d8816ac83b5bb819ce455027c3906 /net/base
parent26783d056f3639d6310c41d1f499d5a9b13bbf90 (diff)
downloadchromium_src-465aeb94531f3d73959412b2c8033005fb7c44d7.zip
chromium_src-465aeb94531f3d73959412b2c8033005fb7c44d7.tar.gz
chromium_src-465aeb94531f3d73959412b2c8033005fb7c44d7.tar.bz2
Add actual bytes sent/received to net-internals.
BUG=54745 TEST=manual Review URL: http://codereview.chromium.org/3582007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/capturing_net_log.h2
-rw-r--r--net/base/forwarding_net_log.cc2
-rw-r--r--net/base/net_log.cc6
-rw-r--r--net/base/net_log.h10
-rw-r--r--net/base/net_log_event_type_list.h8
5 files changed, 22 insertions, 6 deletions
diff --git a/net/base/capturing_net_log.h b/net/base/capturing_net_log.h
index 6e0f620..ff7cf16 100644
--- a/net/base/capturing_net_log.h
+++ b/net/base/capturing_net_log.h
@@ -52,7 +52,7 @@ class CapturingNetLog : public NetLog {
EventPhase phase,
EventParameters* extra_parameters);
virtual uint32 NextID();
- virtual LogLevel GetLogLevel() const { return LOG_ALL; }
+ virtual LogLevel GetLogLevel() const { return LOG_ALL_BUT_BYTES; }
// Returns the list of all entries in the log.
const EntryList& entries() const { return entries_; }
diff --git a/net/base/forwarding_net_log.cc b/net/base/forwarding_net_log.cc
index efe6eff..7cfd6a9 100644
--- a/net/base/forwarding_net_log.cc
+++ b/net/base/forwarding_net_log.cc
@@ -89,7 +89,7 @@ uint32 ForwardingNetLog::NextID() {
NetLog::LogLevel ForwardingNetLog::GetLogLevel() const {
// Can't forward a synchronous API.
CHECK(false) << "Not supported";
- return LOG_ALL;
+ return LOG_ALL_BUT_BYTES;
}
} // namespace net
diff --git a/net/base/net_log.cc b/net/base/net_log.cc
index f9f31c7..1499d72 100644
--- a/net/base/net_log.cc
+++ b/net/base/net_log.cc
@@ -131,10 +131,14 @@ NetLog::LogLevel BoundNetLog::GetLogLevel() const {
return NetLog::LOG_BASIC;
}
-bool BoundNetLog::IsLoggingAll() const {
+bool BoundNetLog::IsLoggingBytes() const {
return GetLogLevel() == NetLog::LOG_ALL;
}
+bool BoundNetLog::IsLoggingAllEvents() const {
+ return GetLogLevel() <= NetLog::LOG_ALL_BUT_BYTES;
+}
+
void BoundNetLog::AddEvent(
NetLog::EventType event_type,
const scoped_refptr<NetLog::EventParameters>& params) const {
diff --git a/net/base/net_log.h b/net/base/net_log.h
index f240105..aa0b70e5 100644
--- a/net/base/net_log.h
+++ b/net/base/net_log.h
@@ -98,8 +98,13 @@ class NetLog {
// Specifies the granularity of events that should be emitted to the log.
enum LogLevel {
// Log everything possible, even if it is slow and memory expensive.
+ // Includes logging of transferred bytes.
LOG_ALL,
+ // Log all events, but do not include the actual transferred bytes as
+ // parameters for bytes sent/received events.
+ LOG_ALL_BUT_BYTES,
+
// Only log events which are cheap, and don't consume much memory.
LOG_BASIC,
};
@@ -194,7 +199,10 @@ class BoundNetLog {
NetLog::LogLevel GetLogLevel() const;
// Returns true if the log level is LOG_ALL.
- bool IsLoggingAll() const;
+ bool IsLoggingBytes() const;
+
+ // Returns true if the log level is LOG_ALL or LOG_ALL_BUT_BYTES.
+ bool IsLoggingAllEvents() const;
// Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care
// of creating a unique source ID, and handles the case of NULL net_log.
diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h
index b0b4d4b..398f7c1 100644
--- a/net/base/net_log_event_type_list.h
+++ b/net/base/net_log_event_type_list.h
@@ -347,14 +347,18 @@ EVENT_TYPE(SSL_NSS_ERROR)
// The specified number of bytes were sent on the socket.
// The following parameters are attached:
// {
-// "num_bytes": <Number of bytes that were just sent>
+// "byte_count": <Number of bytes that were just sent>,
+// "hex_encoded_bytes": <The exact bytes sent, as a hexadecimal string.
+// Only present when byte logging is enabled>
// }
EVENT_TYPE(SOCKET_BYTES_SENT)
// The specified number of bytes were received on the socket.
// The following parameters are attached:
// {
-// "num_bytes": <Number of bytes that were just sent>
+// "byte_count": <Number of bytes that were just received>,
+// "hex_encoded_bytes": <The exact bytes received, as a hexadecimal string.
+// Only present when byte logging is enabled>
// }
EVENT_TYPE(SOCKET_BYTES_RECEIVED)