summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/chrome_net_log.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/net/chrome_net_log.cc')
-rw-r--r--chrome/browser/net/chrome_net_log.cc69
1 files changed, 2 insertions, 67 deletions
diff --git a/chrome/browser/net/chrome_net_log.cc b/chrome/browser/net/chrome_net_log.cc
index b1594dc..7e9a2fc 100644
--- a/chrome/browser/net/chrome_net_log.cc
+++ b/chrome/browser/net/chrome_net_log.cc
@@ -16,10 +16,7 @@
#include "chrome/common/chrome_switches.h"
ChromeNetLog::ChromeNetLog()
- : last_id_(0),
- base_log_level_(LOG_NONE),
- effective_log_level_(LOG_NONE),
- net_log_temp_file_(new NetLogTempFile(this)) {
+ : net_log_temp_file_(new NetLogTempFile(this)) {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
// Adjust base log level based on command line switch, if present.
// This is done before adding any observers so the call to UpdateLogLevel when
@@ -31,7 +28,7 @@ ChromeNetLog::ChromeNetLog()
if (base::StringToInt(log_level_string, &command_line_log_level) &&
command_line_log_level >= LOG_ALL &&
command_line_log_level <= LOG_NONE) {
- base_log_level_ = static_cast<LogLevel>(command_line_log_level);
+ SetBaseLogLevel(static_cast<LogLevel>(command_line_log_level));
}
}
@@ -68,65 +65,3 @@ ChromeNetLog::~ChromeNetLog() {
RemoveThreadSafeObserver(net_log_logger_.get());
}
-void ChromeNetLog::OnAddEntry(const net::NetLog::Entry& entry) {
- base::AutoLock lock(lock_);
-
- // Notify all of the log observers.
- FOR_EACH_OBSERVER(ThreadSafeObserver, observers_, OnAddEntry(entry));
-}
-
-uint32 ChromeNetLog::NextID() {
- return base::subtle::NoBarrier_AtomicIncrement(&last_id_, 1);
-}
-
-net::NetLog::LogLevel ChromeNetLog::GetLogLevel() const {
- base::subtle::Atomic32 log_level =
- base::subtle::NoBarrier_Load(&effective_log_level_);
- return static_cast<net::NetLog::LogLevel>(log_level);
-}
-
-void ChromeNetLog::AddThreadSafeObserver(
- net::NetLog::ThreadSafeObserver* observer,
- LogLevel log_level) {
- base::AutoLock lock(lock_);
-
- observers_.AddObserver(observer);
- OnAddObserver(observer, log_level);
- UpdateLogLevel();
-}
-
-void ChromeNetLog::SetObserverLogLevel(
- net::NetLog::ThreadSafeObserver* observer,
- LogLevel log_level) {
- base::AutoLock lock(lock_);
-
- DCHECK(observers_.HasObserver(observer));
- OnSetObserverLogLevel(observer, log_level);
- UpdateLogLevel();
-}
-
-void ChromeNetLog::RemoveThreadSafeObserver(
- net::NetLog::ThreadSafeObserver* observer) {
- base::AutoLock lock(lock_);
-
- DCHECK(observers_.HasObserver(observer));
- observers_.RemoveObserver(observer);
- OnRemoveObserver(observer);
- UpdateLogLevel();
-}
-
-void ChromeNetLog::UpdateLogLevel() {
- lock_.AssertAcquired();
-
- // Look through all the observers and find the finest granularity
- // log level (higher values of the enum imply *lower* log levels).
- LogLevel new_effective_log_level = base_log_level_;
- ObserverListBase<ThreadSafeObserver>::Iterator it(observers_);
- ThreadSafeObserver* observer;
- while ((observer = it.GetNext()) != NULL) {
- new_effective_log_level =
- std::min(new_effective_log_level, observer->log_level());
- }
- base::subtle::NoBarrier_Store(&effective_log_level_,
- new_effective_log_level);
-}