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

Side by Side Diff: chrome/browser/net/net_log_logger.h

Issue 6025017: Adds the ability to load JSON log files to about:net-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix a minor issue, log data on event type errors. Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_NET_LOG_LOGGER_H_ 5 #ifndef CHROME_BROWSER_NET_NET_LOG_LOGGER_H_
6 #define CHROME_BROWSER_NET_NET_LOG_LOGGER_H_ 6 #define CHROME_BROWSER_NET_NET_LOG_LOGGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/scoped_handle.h"
9 #include "chrome/browser/net/chrome_net_log.h" 10 #include "chrome/browser/net/chrome_net_log.h"
10 11
12 class FilePath;
13
11 // NetLogLogger watches the NetLog event stream, and sends all entries to 14 // NetLogLogger watches the NetLog event stream, and sends all entries to
12 // VLOG(1). This is to debug errors that prevent getting to the 15 // VLOG(1) or a path specified on creation. This is to debug errors that
13 // about:net-internals page. 16 // prevent getting to the about:net-internals page.
17 //
18 // Relies on ChromeNetLog only calling an Observer once at a time for
19 // thread-safety.
14 class NetLogLogger : public ChromeNetLog::ThreadSafeObserver { 20 class NetLogLogger : public ChromeNetLog::ThreadSafeObserver {
15 public: 21 public:
16 NetLogLogger(); 22 // If |log_path| is empty or file creation fails, writes to VLOG(1) using
eroman 2011/01/24 20:45:56 I think this comment needs to be updated, no longe
mmenke 2011/01/25 20:08:13 Done.
23 // pretty formatting. Otherwise, writes to |log_path| using one line per
24 // entry, for easy parsing.
25 explicit NetLogLogger(const FilePath &log_path);
17 ~NetLogLogger(); 26 ~NetLogLogger();
18 27
19 // ThreadSafeObserver implementation: 28 // ThreadSafeObserver implementation:
20 virtual void OnAddEntry(net::NetLog::EventType type, 29 virtual void OnAddEntry(net::NetLog::EventType type,
21 const base::TimeTicks& time, 30 const base::TimeTicks& time,
22 const net::NetLog::Source& source, 31 const net::NetLog::Source& source,
23 net::NetLog::EventPhase phase, 32 net::NetLog::EventPhase phase,
24 net::NetLog::EventParameters* params); 33 net::NetLog::EventParameters* params);
25 34
26 private: 35 private:
36 ScopedStdioHandle file_;
37
27 DISALLOW_COPY_AND_ASSIGN(NetLogLogger); 38 DISALLOW_COPY_AND_ASSIGN(NetLogLogger);
28 }; 39 };
29 40
30 #endif // CHROME_BROWSER_NET_NET_LOG_LOGGER_H_ 41 #endif // CHROME_BROWSER_NET_NET_LOG_LOGGER_H_
31 42
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698