Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1508)

Unified Diff: net/base/trace_net_log_observer.h

Issue 468083004: Use NESTABLE_ASYNC APIs to get NetLog data into Tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Separated trace changes Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/trace_net_log_observer.h
diff --git a/net/base/trace_net_log_observer.h b/net/base/trace_net_log_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..52268576d68f23da38f83e95bf171f47ef89ac18
--- /dev/null
+++ b/net/base/trace_net_log_observer.h
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_BASE_TRACE_NET_LOG_OBSERVER_H_
+#define NET_BASE_TRACE_NET_LOG_OBSERVER_H_
+
+#include "base/debug/trace_event_impl.h"
+#include "base/macros.h"
+#include "net/base/net_export.h"
+#include "net/base/net_log.h"
+
+namespace net {
+
+// TraceNetLogObserver watches for Trace enable, and sends NetLog
+// events to TraceLog if it is enabled.
+class NET_EXPORT TraceNetLogObserver
+ : public NetLog::ThreadSafeObserver,
+ public base::debug::TraceLog::EnabledStateObserver {
+ public:
+ TraceNetLogObserver();
+ virtual ~TraceNetLogObserver();
+
+ // net::NetLog::ThreadSafeObserver implementation:
+ virtual void OnAddEntry(const NetLog::Entry& entry) OVERRIDE;
+
+ // Start to watch for TraceLog enable and disable events.
+ // 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.
+ void WatchForTraceStart(NetLog* net_log);
+
+ // Stop watching for TraceLog enable and disable events.
+ // 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.
+ // TraceNetLogObserver is destroyed.
+ void StopWatchForTraceStart();
+
+ // base::debug::TraceLog::EnabledStateChangedObserver implementation:
+ virtual void OnTraceLogEnabled() OVERRIDE;
+ virtual void OnTraceLogDisabled() OVERRIDE;
+
+ private:
+ NetLog* net_log_to_watch_;
+
+ DISALLOW_COPY_AND_ASSIGN(TraceNetLogObserver);
+};
+
+} // namespace net
+
+#endif // NET_BASE_TRACE_NET_LOG_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698