Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_BASE_TRACE_NET_LOG_OBSERVER_H_ | |
| 6 #define NET_BASE_TRACE_NET_LOG_OBSERVER_H_ | |
| 7 | |
| 8 #include "base/debug/trace_event_impl.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "net/base/net_export.h" | |
| 11 #include "net/base/net_log.h" | |
| 12 | |
| 13 namespace net { | |
| 14 | |
| 15 // TraceNetLogObserver watches for Trace enable, and sends NetLog | |
| 16 // events to TraceLog if it is enabled. | |
| 17 class NET_EXPORT TraceNetLogObserver | |
| 18 : public NetLog::ThreadSafeObserver, | |
| 19 public base::debug::TraceLog::EnabledStateObserver { | |
| 20 public: | |
| 21 TraceNetLogObserver(); | |
| 22 virtual ~TraceNetLogObserver(); | |
| 23 | |
| 24 // net::NetLog::ThreadSafeObserver implementation: | |
| 25 virtual void OnAddEntry(const NetLog::Entry& entry) OVERRIDE; | |
| 26 | |
| 27 // Start to watch for TraceLog enable and disable events. | |
| 28 // This can't be called if TraceNetLogObserver is currently watching. | |
|
mmenke
2014/09/02 21:28:59
Maybe:
Start to watch for TraceLog enable and dis
xunjieli
2014/09/02 23:57:17
Done.
| |
| 29 void WatchForTraceStart(NetLog* net_log); | |
| 30 | |
| 31 // Stop watching for TraceLog enable and disable events. | |
| 32 // If WatchForTraceStart is called, this should be called before | |
|
mmenke
2014/09/02 21:28:59
should -> must
xunjieli
2014/09/02 23:57:17
Done.
| |
| 33 // TraceNetLogObserver is destroyed. | |
| 34 void StopWatchForTraceStart(); | |
| 35 | |
| 36 // base::debug::TraceLog::EnabledStateChangedObserver implementation: | |
| 37 virtual void OnTraceLogEnabled() OVERRIDE; | |
| 38 virtual void OnTraceLogDisabled() OVERRIDE; | |
| 39 | |
| 40 private: | |
| 41 NetLog* net_log_to_watch_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(TraceNetLogObserver); | |
| 44 }; | |
| 45 | |
| 46 } // namespace net | |
| 47 | |
| 48 #endif // NET_BASE_TRACE_NET_LOG_OBSERVER_H_ | |
| OLD | NEW |