OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // Convenience methods that call through to the NetLog, passing in the | 236 // Convenience methods that call through to the NetLog, passing in the |
237 // currently bound source, current time, and a fixed "capture phase" | 237 // currently bound source, current time, and a fixed "capture phase" |
238 // (begin, end, or none). | 238 // (begin, end, or none). |
239 void AddEvent(NetLog::EventType event_type, | 239 void AddEvent(NetLog::EventType event_type, |
240 const scoped_refptr<NetLog::EventParameters>& params) const; | 240 const scoped_refptr<NetLog::EventParameters>& params) const; |
241 void BeginEvent(NetLog::EventType event_type, | 241 void BeginEvent(NetLog::EventType event_type, |
242 const scoped_refptr<NetLog::EventParameters>& params) const; | 242 const scoped_refptr<NetLog::EventParameters>& params) const; |
243 void EndEvent(NetLog::EventType event_type, | 243 void EndEvent(NetLog::EventType event_type, |
244 const scoped_refptr<NetLog::EventParameters>& params) const; | 244 const scoped_refptr<NetLog::EventParameters>& params) const; |
245 | 245 |
| 246 // Just like AddEvent, except |net_error| is a net error code. A parameter |
| 247 // called "net_error" with the indicated value will be recorded for the event. |
| 248 // |net_error| must be negative, and not ERR_IO_PENDING, as it's not a true |
| 249 // error. |
| 250 void AddEventWithNetErrorCode(NetLog::EventType event_type, |
| 251 int net_error) const; |
| 252 |
246 // Just like EndEvent, except |net_error| is a net error code. If it's | 253 // Just like EndEvent, except |net_error| is a net error code. If it's |
247 // negative, a parameter called "net_error" with a value of |net_error| is | 254 // negative, a parameter called "net_error" with a value of |net_error| is |
248 // associated with the event. Otherwise, the end event has no parameters. | 255 // associated with the event. Otherwise, the end event has no parameters. |
249 // |net_error| must not be ERR_IO_PENDING, as it's not a true error. | 256 // |net_error| must not be ERR_IO_PENDING, as it's not a true error. |
250 void EndEventWithNetErrorCode(NetLog::EventType event_type, | 257 void EndEventWithNetErrorCode(NetLog::EventType event_type, |
251 int net_error) const; | 258 int net_error) const; |
252 | 259 |
253 // Logs a byte transfer event to the NetLog. Determines whether to log the | 260 // Logs a byte transfer event to the NetLog. Determines whether to log the |
254 // received bytes or not based on the current logging level. | 261 // received bytes or not based on the current logging level. |
255 void AddByteTransferEvent(NetLog::EventType event_type, | 262 void AddByteTransferEvent(NetLog::EventType event_type, |
256 int byte_count, char* bytes) const; | 263 int byte_count, const char* bytes) const; |
257 | 264 |
258 NetLog::LogLevel GetLogLevel() const; | 265 NetLog::LogLevel GetLogLevel() const; |
259 | 266 |
260 // Returns true if the log level is LOG_ALL. | 267 // Returns true if the log level is LOG_ALL. |
261 bool IsLoggingBytes() const; | 268 bool IsLoggingBytes() const; |
262 | 269 |
263 // Returns true if the log level is LOG_ALL or LOG_ALL_BUT_BYTES. | 270 // Returns true if the log level is LOG_ALL or LOG_ALL_BUT_BYTES. |
264 bool IsLoggingAllEvents() const; | 271 bool IsLoggingAllEvents() const; |
265 | 272 |
266 // Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care | 273 // Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 359 |
353 private: | 360 private: |
354 BoundNetLog net_log_; | 361 BoundNetLog net_log_; |
355 const NetLog::EventType event_type_; | 362 const NetLog::EventType event_type_; |
356 scoped_refptr<NetLog::EventParameters> end_event_params_; | 363 scoped_refptr<NetLog::EventParameters> end_event_params_; |
357 }; | 364 }; |
358 | 365 |
359 } // namespace net | 366 } // namespace net |
360 | 367 |
361 #endif // NET_BASE_NET_LOG_H_ | 368 #endif // NET_BASE_NET_LOG_H_ |
OLD | NEW |