blob: 78b9a61316f6b5d07e8b4753e1b7fb04669d03c0 [file] [log] [blame]
Daniel Chenge0555e192018-01-18 20:00:051// Copyright 2017 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 CONTENT_COMMON_RESOURCE_TIMING_INFO_H_
6#define CONTENT_COMMON_RESOURCE_TIMING_INFO_H_
7
8#include <stdint.h>
9
10#include <string>
11#include <vector>
12
13#include "base/optional.h"
14
15namespace content {
16
17// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
18// duplicated in //content and //third_party/WebKit.
19// See blink::WebServerTimingInfo for more information about this struct's
20// fields.
21struct ServerTimingInfo {
22 ServerTimingInfo();
23 ServerTimingInfo(const ServerTimingInfo&);
24 ~ServerTimingInfo();
25
26 std::string name;
27 double duration = 0.0;
28 std::string description;
29};
30
31// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
32// duplicated in //content and //third_party/WebKit.
33// See blink::WebURLLoadTiming for more information about this struct's fields.
34struct ResourceLoadTiming {
35 ResourceLoadTiming();
36 ResourceLoadTiming(const ResourceLoadTiming&);
37 ~ResourceLoadTiming();
38
39 double request_time = 0.0;
40 double proxy_start = 0.0;
41 double proxy_end = 0.0;
42 double dns_start = 0.0;
43 double dns_end = 0.0;
44 double connect_start = 0.0;
45 double connect_end = 0.0;
46 double worker_start = 0.0;
47 double worker_ready = 0.0;
48 double send_start = 0.0;
49 double send_end = 0.0;
50 double receive_headers_end = 0.0;
51 double ssl_start = 0.0;
52 double ssl_end = 0.0;
53 double push_start = 0.0;
54 double push_end = 0.0;
55};
56
57// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
58// duplicated in //content and //third_party/WebKit.
59// See blink::WebResourceTimingInfo for more information about this struct's
60// fields.
61struct ResourceTimingInfo {
62 ResourceTimingInfo();
63 ResourceTimingInfo(const ResourceTimingInfo&);
64 ~ResourceTimingInfo();
65
66 std::string name;
67 double start_time = 0.0;
68 std::string initiator_type;
69 std::string alpn_negotiated_protocol;
70 std::string connection_info;
71 base::Optional<ResourceLoadTiming> timing;
72 double last_redirect_end_time = 0.0;
73 double finish_time = 0.0;
74 uint64_t transfer_size = 0;
75 uint64_t encoded_body_size = 0;
76 uint64_t decoded_body_size = 0;
77 bool did_reuse_connection = false;
78 bool allow_timing_details = false;
79 bool allow_redirect_details = false;
80 bool allow_negative_values = false;
81 std::vector<ServerTimingInfo> server_timing;
82};
83
84} // namespace content
85
86#endif // CONTENT_COMMON_RESOURCE_TIMING_INFO_H_