diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 17:33:21 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 17:33:21 +0000 |
commit | e8188fe70d217c47204c09396143c2dcb8b9a521 (patch) | |
tree | 14cce2cd6f5e36c96b66f3c372538f71fea9f6a9 /net/base/net_log.cc | |
parent | 82cceaf8775c7512a7f3c3fd60949b1b3fcb5380 (diff) | |
download | chromium_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.cc')
-rw-r--r-- | net/base/net_log.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/base/net_log.cc b/net/base/net_log.cc index 1499d72..c9e7319 100644 --- a/net/base/net_log.cc +++ b/net/base/net_log.cc @@ -194,4 +194,27 @@ Value* NetLogSourceParameter::ToValue() const { 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) { + net_log_.BeginEvent(event_type, params); +} + +ScopedNetLogEvent::~ScopedNetLogEvent() { + net_log_.EndEvent(event_type_, end_event_params_); +} + +void ScopedNetLogEvent::SetEndEventParameters( + const scoped_refptr<NetLog::EventParameters>& end_event_params) { + DCHECK(!end_event_params_.get()); + end_event_params_ = end_event_params; +} + +const BoundNetLog& ScopedNetLogEvent::net_log() const { + return net_log_; +} + } // namespace net |