OLD | NEW |
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 Loading... |
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_ |
OLD | NEW |