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

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: Created 6 years, 4 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..31ffeddba2b7b32602605f0a762303e7ab2d5b91
--- /dev/null
+++ b/net/base/trace_net_log_observer.h
@@ -0,0 +1,50 @@
+// 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 <stdio.h>
mmenke 2014/08/15 20:42:54 not used.
xunjieli 2014/08/15 21:55:16 Done. Sorry! I copied over another file. Should to
+
+#include "base/debug/trace_event_impl.h"
+#include "base/files/scoped_file.h"
mmenke 2014/08/15 20:42:54 Not used.
xunjieli 2014/08/15 21:55:16 Done.
+#include "net/base/net_log.h"
+
+namespace net {
+
+class NET_EXPORT TraceNetLogObserver : public NetLog::ThreadSafeObserver,
mmenke 2014/08/15 20:42:54 Should include net/base/net_export.h
xunjieli 2014/08/15 21:55:16 Done. I see! Thanks!
+ public base::debug::TraceLog::EnabledStateObserver {
mmenke 2014/08/15 20:42:54 All parent classes should line up, so this should
xunjieli 2014/08/15 21:55:16 Done. Thanks! I will keep that in mind next time.
+ public:
+ TraceNetLogObserver();
+ virtual ~TraceNetLogObserver();
+
+ void set_log_level(NetLog::LogLevel log_level);
mmenke 2014/08/15 20:42:54 Only use this naming scheme when functions are inl
xunjieli 2014/08/15 21:55:16 Acknowledged. Also, I don't think we need the sett
+
+ void StartObserving(NetLog* net_log);
+
+ // Stops observing net_log(). Must already be watching.
+ void StopObserving();
+
+ // net::NetLog::ThreadSafeObserver implementation:
+ virtual void OnAddEntry(const NetLog::Entry& entry) OVERRIDE;
+
+ void WatchForTraceStart(NetLog* net_log);
+
+ void StopWatchForTraceStart();
+
+ // base::debug::TraceLog::EnabledStateChangedObserver overrides:
mmenke 2014/08/15 20:42:54 nit: overrides -> implementation, to be consiste
xunjieli 2014/08/15 21:55:16 Done.
+ virtual void OnTraceLogEnabled() OVERRIDE;
+ virtual void OnTraceLogDisabled() OVERRIDE;
+ private:
+ // The LogLevel to log at.
+ NetLog::LogLevel log_level_;
+
+ NetLog* net_log_;
+
+ DISALLOW_COPY_AND_ASSIGN(TraceNetLogObserver);
mmenke 2014/08/15 20:42:54 Should include base/macros.h for this and OVERRIDE
xunjieli 2014/08/15 21:55:16 Partially done. How should I "OVERRIDE" on this?
mmenke 2014/08/15 21:59:15 Sorry, I meant macros.h makes sure the "OVERRIDE"
xunjieli 2014/08/20 22:00:42 I see. That makes sense. Thank you! On 2014/08/15
+};
+
+} // namespace net
+
+#endif // NET_BASE_TRACE_NET_LOG_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698