| 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 CHROME_BROWSER_NET_CHROME_NET_LOG_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_NET_LOG_H_ |
| 6 #define CHROME_BROWSER_NET_CHROME_NET_LOG_H_ | 6 #define CHROME_BROWSER_NET_CHROME_NET_LOG_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 virtual void SetObserverLogLevel(ThreadSafeObserver* observer, | 35 virtual void SetObserverLogLevel(ThreadSafeObserver* observer, |
| 36 LogLevel log_level) OVERRIDE; | 36 LogLevel log_level) OVERRIDE; |
| 37 virtual void RemoveThreadSafeObserver(ThreadSafeObserver* observer) OVERRIDE; | 37 virtual void RemoveThreadSafeObserver(ThreadSafeObserver* observer) OVERRIDE; |
| 38 | 38 |
| 39 LoadTimingObserver* load_timing_observer() { | 39 LoadTimingObserver* load_timing_observer() { |
| 40 return load_timing_observer_.get(); | 40 return load_timing_observer_.get(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 // NetLog implementation: | 44 // NetLog implementation: |
| 45 virtual void AddEntry(EventType type, | 45 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; |
| 46 const Source& source, | |
| 47 EventPhase phase, | |
| 48 const scoped_refptr<EventParameters>& params) OVERRIDE; | |
| 49 | 46 |
| 50 // Called whenever an observer is added or removed, or has its log level | 47 // Called whenever an observer is added or removed, or has its log level |
| 51 // changed. Must have acquired |lock_| prior to calling. | 48 // changed. Must have acquired |lock_| prior to calling. |
| 52 void UpdateLogLevel(); | 49 void UpdateLogLevel(); |
| 53 | 50 |
| 54 // |lock_| protects access to |observers_|. | 51 // |lock_| protects access to |observers_|. |
| 55 base::Lock lock_; | 52 base::Lock lock_; |
| 56 | 53 |
| 57 // Last assigned source ID. Incremented to get the next one. | 54 // Last assigned source ID. Incremented to get the next one. |
| 58 base::subtle::Atomic32 last_id_; | 55 base::subtle::Atomic32 last_id_; |
| 59 | 56 |
| 60 // The lowest allowed log level, regardless of any ChromeNetLogObservers. | 57 // The lowest allowed log level, regardless of any ChromeNetLogObservers. |
| 61 // Normally defaults to LOG_BASIC, but can be changed with command line flags. | 58 // Normally defaults to LOG_BASIC, but can be changed with command line flags. |
| 62 LogLevel base_log_level_; | 59 LogLevel base_log_level_; |
| 63 | 60 |
| 64 // The current log level. | 61 // The current log level. |
| 65 base::subtle::Atomic32 effective_log_level_; | 62 base::subtle::Atomic32 effective_log_level_; |
| 66 | 63 |
| 67 scoped_ptr<LoadTimingObserver> load_timing_observer_; | 64 scoped_ptr<LoadTimingObserver> load_timing_observer_; |
| 68 scoped_ptr<NetLogLogger> net_log_logger_; | 65 scoped_ptr<NetLogLogger> net_log_logger_; |
| 69 | 66 |
| 70 // |lock_| must be acquired whenever reading or writing to this. | 67 // |lock_| must be acquired whenever reading or writing to this. |
| 71 ObserverList<ThreadSafeObserver, true> observers_; | 68 ObserverList<ThreadSafeObserver, true> observers_; |
| 72 | 69 |
| 73 DISALLOW_COPY_AND_ASSIGN(ChromeNetLog); | 70 DISALLOW_COPY_AND_ASSIGN(ChromeNetLog); |
| 74 }; | 71 }; |
| 75 | 72 |
| 76 #endif // CHROME_BROWSER_NET_CHROME_NET_LOG_H_ | 73 #endif // CHROME_BROWSER_NET_CHROME_NET_LOG_H_ |
| OLD | NEW |