| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 10 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 // Returns true if |log_level| indicates that all events should be logged, | 290 // Returns true if |log_level| indicates that all events should be logged, |
| 291 // including frequently occuring ones that may impact performances. | 291 // including frequently occuring ones that may impact performances. |
| 292 // This is the case when |log_level| is LOG_ALL or LOG_ALL_BUT_BYTES. | 292 // This is the case when |log_level| is LOG_ALL or LOG_ALL_BUT_BYTES. |
| 293 static bool IsLoggingAllEvents(LogLevel log_level); | 293 static bool IsLoggingAllEvents(LogLevel log_level); |
| 294 | 294 |
| 295 // Creates a ParametersCallback that encapsulates a single integer. | 295 // Creates a ParametersCallback that encapsulates a single integer. |
| 296 // Warning: |name| must remain valid for the life of the callback. | 296 // Warning: |name| must remain valid for the life of the callback. |
| 297 static ParametersCallback IntegerCallback(const char* name, int value); | 297 static ParametersCallback IntegerCallback(const char* name, int value); |
| 298 | 298 |
| 299 // Creates a ParametersCallback that encapsulates a single UTF8 string. Takes |
| 300 // |value| as a pointer to avoid copying, and emphasize it must be valid for |
| 301 // the life of the callback. |value| may not be NULL. |
| 302 // Warning: |name| and |value| must remain valid for the life of the callback. |
| 303 static ParametersCallback StringCallback(const char* name, |
| 304 const std::string* value); |
| 305 |
| 299 protected: | 306 protected: |
| 300 // Child classes should respond to the new entry here. This includes | 307 // Child classes should respond to the new entry here. This includes |
| 301 // creating the Entry object and alerting their observers. | 308 // creating the Entry object and alerting their observers. |
| 302 virtual void OnAddEntry(const Entry& entry) = 0; | 309 virtual void OnAddEntry(const Entry& entry) = 0; |
| 303 | 310 |
| 304 // Subclasses must call these in the corresponding functions to set an | 311 // Subclasses must call these in the corresponding functions to set an |
| 305 // observer's |net_log_| and |log_level_| values. | 312 // observer's |net_log_| and |log_level_| values. |
| 306 void OnAddObserver(ThreadSafeObserver* observer, LogLevel log_level); | 313 void OnAddObserver(ThreadSafeObserver* observer, LogLevel log_level); |
| 307 void OnSetObserverLogLevel(ThreadSafeObserver* observer, | 314 void OnSetObserverLogLevel(ThreadSafeObserver* observer, |
| 308 LogLevel log_level); | 315 LogLevel log_level); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 virtual ~NetLogSourceParameter() {} | 472 virtual ~NetLogSourceParameter() {} |
| 466 | 473 |
| 467 private: | 474 private: |
| 468 const char* name_; | 475 const char* name_; |
| 469 const NetLog::Source value_; | 476 const NetLog::Source value_; |
| 470 }; | 477 }; |
| 471 | 478 |
| 472 } // namespace net | 479 } // namespace net |
| 473 | 480 |
| 474 #endif // NET_BASE_NET_LOG_H_ | 481 #endif // NET_BASE_NET_LOG_H_ |
| OLD | NEW |