mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef NET_LOG_NET_LOG_ENTRY_H_ |
| 6 | #define NET_LOG_NET_LOG_ENTRY_H_ |
| 7 | |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 8 | #include "base/time/time.h" |
Eric Roman | 06bd974 | 2019-07-13 15:19:13 | [diff] [blame] | 9 | #include "base/values.h" |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 10 | #include "net/base/net_export.h" |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 11 | #include "net/log/net_log_event_type.h" |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 12 | #include "net/log/net_log_source.h" |
| 13 | |
| 14 | namespace base { |
| 15 | class Value; |
| 16 | } |
| 17 | |
| 18 | namespace net { |
| 19 | |
Eric Roman | 79cc755 | 2019-07-19 02:17:54 | [diff] [blame] | 20 | // Represents an event that was sent to a NetLog observer, including the |
| 21 | // materialized parameters. |
Eric Roman | 06bd974 | 2019-07-13 15:19:13 | [diff] [blame] | 22 | struct NET_EXPORT NetLogEntry { |
| 23 | public: |
| 24 | NetLogEntry(NetLogEventType type, |
| 25 | NetLogSource source, |
| 26 | NetLogEventPhase phase, |
| 27 | base::TimeTicks time, |
| 28 | base::Value params); |
| 29 | |
| 30 | ~NetLogEntry(); |
| 31 | |
Eric Roman | 79cc755 | 2019-07-19 02:17:54 | [diff] [blame] | 32 | // Moveable. |
| 33 | NetLogEntry(NetLogEntry&& entry); |
| 34 | NetLogEntry& operator=(NetLogEntry&& entry); |
| 35 | |
Eric Roman | 06bd974 | 2019-07-13 15:19:13 | [diff] [blame] | 36 | // Serializes the specified event to a Value. |
| 37 | base::Value ToValue() const; |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 38 | |
Eric Roman | 79cc755 | 2019-07-19 02:17:54 | [diff] [blame] | 39 | // NetLogEntry is not copy constructible, however copying is useful for |
| 40 | // unittests. |
| 41 | NetLogEntry Clone() const; |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 42 | |
Eric Roman | 79cc755 | 2019-07-19 02:17:54 | [diff] [blame] | 43 | // Returns true if the entry has value for |params|. |
| 44 | bool HasParams() const; |
| 45 | |
| 46 | NetLogEventType type; |
| 47 | NetLogSource source; |
| 48 | NetLogEventPhase phase; |
| 49 | base::TimeTicks time; |
| 50 | base::Value params; |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | } // namespace net |
| 54 | |
| 55 | #endif // NET_LOG_NET_LOG_ENTRY_H_ |