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

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

Issue 647883002: git cl format the final third of the net/base directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
(...skipping 24 matching lines...) Expand all
35 // 35 //
36 // All methods are thread safe, with the exception that no NetLog or 36 // All methods are thread safe, with the exception that no NetLog or
37 // NetLog::ThreadSafeObserver functions may be called by an observer's 37 // NetLog::ThreadSafeObserver functions may be called by an observer's
38 // OnAddEntry() method. Doing so will result in a deadlock. 38 // OnAddEntry() method. Doing so will result in a deadlock.
39 // 39 //
40 // For a broader introduction see the design document: 40 // For a broader introduction see the design document:
41 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/netwo rk-stack/netlog 41 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/netwo rk-stack/netlog
42 class NET_EXPORT NetLog { 42 class NET_EXPORT NetLog {
43 public: 43 public:
44 enum EventType { 44 enum EventType {
45 #define EVENT_TYPE(label) TYPE_ ## label, 45 #define EVENT_TYPE(label) TYPE_##label,
46 #include "net/base/net_log_event_type_list.h" 46 #include "net/base/net_log_event_type_list.h"
47 #undef EVENT_TYPE 47 #undef EVENT_TYPE
48 EVENT_COUNT 48 EVENT_COUNT
49 }; 49 };
50 50
51 // The 'phase' of an event trace (whether it marks the beginning or end 51 // The 'phase' of an event trace (whether it marks the beginning or end
52 // of an event.). 52 // of an event.).
53 enum EventPhase { 53 enum EventPhase {
54 PHASE_NONE, 54 PHASE_NONE,
55 PHASE_BEGIN, 55 PHASE_BEGIN,
56 PHASE_END, 56 PHASE_END,
57 }; 57 };
58 58
59 // The "source" identifies the entity that generated the log message. 59 // The "source" identifies the entity that generated the log message.
60 enum SourceType { 60 enum SourceType {
61 #define SOURCE_TYPE(label) SOURCE_ ## label, 61 #define SOURCE_TYPE(label) SOURCE_##label,
62 #include "net/base/net_log_source_type_list.h" 62 #include "net/base/net_log_source_type_list.h"
63 #undef SOURCE_TYPE 63 #undef SOURCE_TYPE
64 SOURCE_COUNT 64 SOURCE_COUNT
65 }; 65 };
66 66
67 // Specifies the granularity of events that should be emitted to the log. 67 // Specifies the granularity of events that should be emitted to the log.
68 // 68 //
69 // Since the LogLevel may be read and set on any thread without locking, it 69 // Since the LogLevel may be read and set on any thread without locking, it
70 // may be possible for an Observer to receive an event or parameters that 70 // may be possible for an Observer to receive an event or parameters that
71 // normally wouldn't be logged at the currently active log level. 71 // normally wouldn't be logged at the currently active log level.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 // Just like EndEvent, except |net_error| is a net error code. If it's 363 // Just like EndEvent, except |net_error| is a net error code. If it's
364 // negative, a parameter called "net_error" with a value of |net_error| is 364 // negative, a parameter called "net_error" with a value of |net_error| is
365 // associated with the event. Otherwise, the end event has no parameters. 365 // associated with the event. Otherwise, the end event has no parameters.
366 // |net_error| must not be ERR_IO_PENDING, as it's not a true error. 366 // |net_error| must not be ERR_IO_PENDING, as it's not a true error.
367 void EndEventWithNetErrorCode(NetLog::EventType event_type, 367 void EndEventWithNetErrorCode(NetLog::EventType event_type,
368 int net_error) const; 368 int net_error) const;
369 369
370 // Logs a byte transfer event to the NetLog. Determines whether to log the 370 // Logs a byte transfer event to the NetLog. Determines whether to log the
371 // received bytes or not based on the current logging level. 371 // received bytes or not based on the current logging level.
372 void AddByteTransferEvent(NetLog::EventType event_type, 372 void AddByteTransferEvent(NetLog::EventType event_type,
373 int byte_count, const char* bytes) const; 373 int byte_count,
374 const char* bytes) const;
374 375
375 NetLog::LogLevel GetLogLevel() const; 376 NetLog::LogLevel GetLogLevel() const;
376 377
377 // Shortcut for NetLog::IsLoggingBytes(this->GetLogLevel()). 378 // Shortcut for NetLog::IsLoggingBytes(this->GetLogLevel()).
378 bool IsLoggingBytes() const; 379 bool IsLoggingBytes() const;
379 380
380 // Shortcut for NetLog::IsLogging(this->GetLogLevel()). 381 // Shortcut for NetLog::IsLogging(this->GetLogLevel()).
381 bool IsLogging() const; 382 bool IsLogging() const;
382 383
383 // Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care 384 // Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care
384 // of creating a unique source ID, and handles the case of NULL net_log. 385 // of creating a unique source ID, and handles the case of NULL net_log.
385 static BoundNetLog Make(NetLog* net_log, NetLog::SourceType source_type); 386 static BoundNetLog Make(NetLog* net_log, NetLog::SourceType source_type);
386 387
387 const NetLog::Source& source() const { return source_; } 388 const NetLog::Source& source() const { return source_; }
388 NetLog* net_log() const { return net_log_; } 389 NetLog* net_log() const { return net_log_; }
389 390
390 private: 391 private:
391 BoundNetLog(const NetLog::Source& source, NetLog* net_log) 392 BoundNetLog(const NetLog::Source& source, NetLog* net_log)
392 : source_(source), net_log_(net_log) { 393 : source_(source), net_log_(net_log) {}
mef 2014/10/10 20:38:17 Hmm, in many cases it seems to split {} into 2 lin
393 }
394 394
395 NetLog::Source source_; 395 NetLog::Source source_;
396 NetLog* net_log_; 396 NetLog* net_log_;
397 }; 397 };
398 398
399 } // namespace net 399 } // namespace net
400 400
401 #endif // NET_BASE_NET_LOG_H_ 401 #endif // NET_BASE_NET_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698