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

Unified Diff: net/base/net_log.cc

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
Index: net/base/net_log.cc
===================================================================
--- net/base/net_log.cc (revision 67848)
+++ net/base/net_log.cc (working copy)
@@ -194,4 +194,28 @@
return dict;
}
+ScopedNetLogEvent::ScopedNetLogEvent(
+ const BoundNetLog& net_log,
+ NetLog::EventType event_type,
+ const scoped_refptr<NetLog::EventParameters>& params)
+ : net_log_(net_log),
+ event_type_(event_type),
+ end_event_parameters_(NULL) {
eroman 2010/12/09 02:00:14 nit: I have always seen this omitted in chrome cod
mmenke 2010/12/09 15:12:01 Done.
+ net_log_.BeginEvent(event_type, params);
+}
+
+ScopedNetLogEvent::~ScopedNetLogEvent() {
+ net_log_.EndEvent(event_type_, end_event_parameters_);
+}
+
+void ScopedNetLogEvent::SetEndEventParameters(
+ const scoped_refptr<NetLog::EventParameters>& end_event_parameters) {
+ DCHECK(!end_event_parameters_.get());
+ end_event_parameters_ = end_event_parameters;
+}
+
+const BoundNetLog& ScopedNetLogEvent::net_log() const {
+ return net_log_;
+}
+
} // namespace net
« no previous file with comments | « net/base/net_log.h ('k') | net/base/net_log_unittest.cc » ('j') | net/base/net_log_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698