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

Unified Diff: net/base/net_log.h

Issue 5560013: A scoped NetLog event that automatically logs an end event on destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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
« no previous file with comments | « no previous file | net/base/net_log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_log.h
===================================================================
--- net/base/net_log.h (revision 67851)
+++ net/base/net_log.h (working copy)
@@ -270,6 +270,30 @@
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_
« no previous file with comments | « no previous file | net/base/net_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698