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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/net_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_NET_LOG_H_ 5 #ifndef NET_BASE_NET_LOG_H_
6 #define NET_BASE_NET_LOG_H_ 6 #define NET_BASE_NET_LOG_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return value_; 263 return value_;
264 } 264 }
265 265
266 virtual Value* ToValue() const; 266 virtual Value* ToValue() const;
267 267
268 private: 268 private:
269 const char* name_; 269 const char* name_;
270 const NetLog::Source value_; 270 const NetLog::Source value_;
271 }; 271 };
272 272
273 // ScopedNetLogEvent logs a begin event on creation, and the corresponding end
274 // event on destruction.
275 class ScopedNetLogEvent {
276 public:
277 ScopedNetLogEvent(const BoundNetLog& net_log,
278 NetLog::EventType event_type,
279 const scoped_refptr<NetLog::EventParameters>& params);
280
281 ~ScopedNetLogEvent();
282
283 // Sets the parameters that will logged on object destruction. Can be called
284 // at most once for a given ScopedNetLogEvent object. If not called, the end
285 // event will have no parameters.
286 void SetEndEventParameters(
287 const scoped_refptr<NetLog::EventParameters>& end_event_params);
288
289 const BoundNetLog& net_log() const;
290
291 private:
292 BoundNetLog net_log_;
293 const NetLog::EventType event_type_;
294 scoped_refptr<NetLog::EventParameters> end_event_params_;
295 };
296
273 } // namespace net 297 } // namespace net
274 298
275 #endif // NET_BASE_NET_LOG_H_ 299 #endif // NET_BASE_NET_LOG_H_
OLDNEW
« 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