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

Side by Side Diff: net/base/net_log.h

Issue 6125001: Fixed first pass at adding http/backend cache events to the NetLog. ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix 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
« no previous file with comments | « net/base/capturing_net_log.cc ('k') | net/base/net_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 NET_BASE_NET_LOG_H_ 5 #ifndef NET_BASE_NET_LOG_H_
6 #define NET_BASE_NET_LOG_H_ 6 #define NET_BASE_NET_LOG_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 // 27 //
28 // To avoid needing to pass in the "source id" to the logging functions, NetLog 28 // To avoid needing to pass in the "source id" to the logging functions, NetLog
29 // is usually accessed through a BoundNetLog, which will always pass in a 29 // is usually accessed through a BoundNetLog, which will always pass in a
30 // specific source ID. 30 // specific source ID.
31 // 31 //
32 // ******** The NetLog (and associated logging) is a work in progress ******** 32 // ******** The NetLog (and associated logging) is a work in progress ********
33 // 33 //
34 // TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods. 34 // TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods.
35 // TODO(eroman): Start a new Source each time net::URLRequest redirects 35 // TODO(eroman): Start a new Source each time net::URLRequest redirects
36 // (simpler to reason about each as a separate entity). 36 // (simpler to reason about each as a separate entity).
37 // TODO(mmenke): Replace EndEvent calls with EndEventWithNetErrorCode, where
38 // appropriate.
37 39
38 class NetLog { 40 class NetLog {
39 public: 41 public:
40 enum EventType { 42 enum EventType {
41 #define EVENT_TYPE(label) TYPE_ ## label, 43 #define EVENT_TYPE(label) TYPE_ ## label,
42 #include "net/base/net_log_event_type_list.h" 44 #include "net/base/net_log_event_type_list.h"
43 #undef EVENT_TYPE 45 #undef EVENT_TYPE
44 }; 46 };
45 47
46 // The 'phase' of an event trace (whether it marks the beginning or end 48 // The 'phase' of an event trace (whether it marks the beginning or end
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // Convenience methods that call through to the NetLog, passing in the 188 // Convenience methods that call through to the NetLog, passing in the
187 // currently bound source, current time, and a fixed "capture phase" 189 // currently bound source, current time, and a fixed "capture phase"
188 // (begin, end, or none). 190 // (begin, end, or none).
189 void AddEvent(NetLog::EventType event_type, 191 void AddEvent(NetLog::EventType event_type,
190 const scoped_refptr<NetLog::EventParameters>& params) const; 192 const scoped_refptr<NetLog::EventParameters>& params) const;
191 void BeginEvent(NetLog::EventType event_type, 193 void BeginEvent(NetLog::EventType event_type,
192 const scoped_refptr<NetLog::EventParameters>& params) const; 194 const scoped_refptr<NetLog::EventParameters>& params) const;
193 void EndEvent(NetLog::EventType event_type, 195 void EndEvent(NetLog::EventType event_type,
194 const scoped_refptr<NetLog::EventParameters>& params) const; 196 const scoped_refptr<NetLog::EventParameters>& params) const;
195 197
198 // Just like EndEvent, except |net_error| is a net error code. If it's
199 // negative, a parameter called "net_error" with a value of |net_error| is
200 // associated with the event. Otherwise, the end event has no parameters.
201 // |net_error| must not be ERR_IO_PENDING, as it's not a true error.
202 void EndEventWithNetErrorCode(NetLog::EventType event_type,
203 int net_error) const;
204
196 NetLog::LogLevel GetLogLevel() const; 205 NetLog::LogLevel GetLogLevel() const;
197 206
198 // Returns true if the log level is LOG_ALL. 207 // Returns true if the log level is LOG_ALL.
199 bool IsLoggingBytes() const; 208 bool IsLoggingBytes() const;
200 209
201 // Returns true if the log level is LOG_ALL or LOG_ALL_BUT_BYTES. 210 // Returns true if the log level is LOG_ALL or LOG_ALL_BUT_BYTES.
202 bool IsLoggingAllEvents() const; 211 bool IsLoggingAllEvents() const;
203 212
204 // Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care 213 // Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care
205 // of creating a unique source ID, and handles the case of NULL net_log. 214 // of creating a unique source ID, and handles the case of NULL net_log.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 299
291 private: 300 private:
292 BoundNetLog net_log_; 301 BoundNetLog net_log_;
293 const NetLog::EventType event_type_; 302 const NetLog::EventType event_type_;
294 scoped_refptr<NetLog::EventParameters> end_event_params_; 303 scoped_refptr<NetLog::EventParameters> end_event_params_;
295 }; 304 };
296 305
297 } // namespace net 306 } // namespace net
298 307
299 #endif // NET_BASE_NET_LOG_H_ 308 #endif // NET_BASE_NET_LOG_H_
OLDNEW
« no previous file with comments | « net/base/capturing_net_log.cc ('k') | net/base/net_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698