blob: 9de87d7a00ad52b97dbe758ac164bca4973e31cf [file] [log] [blame]
mikecironef22f9812016-10-04 03:40:191// 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
mikecironef22f9812016-10-04 03:40:198#include "base/time/time.h"
Eric Roman06bd9742019-07-13 15:19:139#include "base/values.h"
mikecironef22f9812016-10-04 03:40:1910#include "net/base/net_export.h"
mikecironef22f9812016-10-04 03:40:1911#include "net/log/net_log_event_type.h"
mikecironef22f9812016-10-04 03:40:1912#include "net/log/net_log_source.h"
13
14namespace base {
15class Value;
16}
17
18namespace net {
19
Eric Roman79cc7552019-07-19 02:17:5420// Represents an event that was sent to a NetLog observer, including the
21// materialized parameters.
Eric Roman06bd9742019-07-13 15:19:1322struct 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 Roman79cc7552019-07-19 02:17:5432 // Moveable.
33 NetLogEntry(NetLogEntry&& entry);
34 NetLogEntry& operator=(NetLogEntry&& entry);
35
Eric Roman06bd9742019-07-13 15:19:1336 // Serializes the specified event to a Value.
37 base::Value ToValue() const;
mikecironef22f9812016-10-04 03:40:1938
Eric Roman79cc7552019-07-19 02:17:5439 // NetLogEntry is not copy constructible, however copying is useful for
40 // unittests.
41 NetLogEntry Clone() const;
mikecironef22f9812016-10-04 03:40:1942
Eric Roman79cc7552019-07-19 02:17:5443 // 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;
mikecironef22f9812016-10-04 03:40:1951};
52
53} // namespace net
54
55#endif // NET_LOG_NET_LOG_ENTRY_H_