summaryrefslogtreecommitdiff
path: root/chromium/content/common/resource_timing_info.h
blob: 78b9a61316f6b5d07e8b4753e1b7fb04669d03c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_COMMON_RESOURCE_TIMING_INFO_H_
#define CONTENT_COMMON_RESOURCE_TIMING_INFO_H_

#include <stdint.h>

#include <string>
#include <vector>

#include "base/optional.h"

namespace content {

// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
// duplicated in //content and //third_party/WebKit.
// See blink::WebServerTimingInfo for more information about this struct's
// fields.
struct ServerTimingInfo {
  ServerTimingInfo();
  ServerTimingInfo(const ServerTimingInfo&);
  ~ServerTimingInfo();

  std::string name;
  double duration = 0.0;
  std::string description;
};

// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
// duplicated in //content and //third_party/WebKit.
// See blink::WebURLLoadTiming for more information about this struct's fields.
struct ResourceLoadTiming {
  ResourceLoadTiming();
  ResourceLoadTiming(const ResourceLoadTiming&);
  ~ResourceLoadTiming();

  double request_time = 0.0;
  double proxy_start = 0.0;
  double proxy_end = 0.0;
  double dns_start = 0.0;
  double dns_end = 0.0;
  double connect_start = 0.0;
  double connect_end = 0.0;
  double worker_start = 0.0;
  double worker_ready = 0.0;
  double send_start = 0.0;
  double send_end = 0.0;
  double receive_headers_end = 0.0;
  double ssl_start = 0.0;
  double ssl_end = 0.0;
  double push_start = 0.0;
  double push_end = 0.0;
};

// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
// duplicated in //content and //third_party/WebKit.
// See blink::WebResourceTimingInfo for more information about this struct's
// fields.
struct ResourceTimingInfo {
  ResourceTimingInfo();
  ResourceTimingInfo(const ResourceTimingInfo&);
  ~ResourceTimingInfo();

  std::string name;
  double start_time = 0.0;
  std::string initiator_type;
  std::string alpn_negotiated_protocol;
  std::string connection_info;
  base::Optional<ResourceLoadTiming> timing;
  double last_redirect_end_time = 0.0;
  double finish_time = 0.0;
  uint64_t transfer_size = 0;
  uint64_t encoded_body_size = 0;
  uint64_t decoded_body_size = 0;
  bool did_reuse_connection = false;
  bool allow_timing_details = false;
  bool allow_redirect_details = false;
  bool allow_negative_values = false;
  std::vector<ServerTimingInfo> server_timing;
};

}  // namespace content

#endif  // CONTENT_COMMON_RESOURCE_TIMING_INFO_H_