summaryrefslogtreecommitdiffstats
path: root/net/base/net_log.h
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-09 17:33:21 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-09 17:33:21 +0000
commite8188fe70d217c47204c09396143c2dcb8b9a521 (patch)
tree14cce2cd6f5e36c96b66f3c372538f71fea9f6a9 /net/base/net_log.h
parent82cceaf8775c7512a7f3c3fd60949b1b3fcb5380 (diff)
downloadchromium_src-e8188fe70d217c47204c09396143c2dcb8b9a521.zip
chromium_src-e8188fe70d217c47204c09396143c2dcb8b9a521.tar.gz
chromium_src-e8188fe70d217c47204c09396143c2dcb8b9a521.tar.bz2
A ScopedNetLogEvent that logs a NetLog begin event on creation,
and the corresponding end event on destruction. BUG=64981 TEST=NetLog.ScopedNetLogEventTest Review URL: http://codereview.chromium.org/5560013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_log.h')
-rw-r--r--net/base/net_log.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/net/base/net_log.h b/net/base/net_log.h
index 5a8f197..b8f903d 100644
--- a/net/base/net_log.h
+++ b/net/base/net_log.h
@@ -270,6 +270,30 @@ class NetLogSourceParameter : public NetLog::EventParameters {
const NetLog::Source value_;
};
+// ScopedNetLogEvent logs a begin event on creation, and the corresponding end
+// event on destruction.
+class ScopedNetLogEvent {
+ public:
+ ScopedNetLogEvent(const BoundNetLog& net_log,
+ NetLog::EventType event_type,
+ const scoped_refptr<NetLog::EventParameters>& params);
+
+ ~ScopedNetLogEvent();
+
+ // Sets the parameters that will logged on object destruction. Can be called
+ // at most once for a given ScopedNetLogEvent object. If not called, the end
+ // event will have no parameters.
+ void SetEndEventParameters(
+ const scoped_refptr<NetLog::EventParameters>& end_event_params);
+
+ const BoundNetLog& net_log() const;
+
+ private:
+ BoundNetLog net_log_;
+ const NetLog::EventType event_type_;
+ scoped_refptr<NetLog::EventParameters> end_event_params_;
+};
+
} // namespace net
#endif // NET_BASE_NET_LOG_H_