From e8188fe70d217c47204c09396143c2dcb8b9a521 Mon Sep 17 00:00:00 2001 From: "mmenke@chromium.org" Date: Thu, 9 Dec 2010 17:33:21 +0000 Subject: 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 --- net/base/net_log.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'net/base/net_log.h') 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& 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& end_event_params); + + const BoundNetLog& net_log() const; + + private: + BoundNetLog net_log_; + const NetLog::EventType event_type_; + scoped_refptr end_event_params_; +}; + } // namespace net #endif // NET_BASE_NET_LOG_H_ -- cgit v1.1