summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/public/platform/web_resource_timing_info.h
blob: 65e7f2912ad9184e8a7fff63c169b66090f05765 (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
// 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 THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RESOURCE_TIMING_INFO_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RESOURCE_TIMING_INFO_H_

#include <stdint.h>

#include "base/time/time.h"
#include "third_party/blink/public/platform/web_common.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url_load_timing.h"
#include "third_party/blink/public/platform/web_vector.h"

namespace blink {

// The browser-side equivalent to this struct is content::ServerTimingInfo.
// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
// duplicated in //content and //third_party/blink.
struct WebServerTimingInfo {
  WebServerTimingInfo(const WebString& name,
                      double duration,
                      const WebString& description)
      : name(name), duration(duration), description(description) {}

  WebString name;
  double duration;
  WebString description;
};

// This struct holds the information from PerformanceResourceTiming that needs
// to be passed between processes. This is currently used to send timing
// information about cross-process iframes for window.performance. The
// browser-side equivalent to this struct is content::ResourceTimingInfo.
// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
// duplicated in //content and //third_party/blink.
struct WebResourceTimingInfo {
  // The name to associate with the performance entry. For iframes, this is
  // typically the initial URL of the iframe resource.
  WebString name;
  base::TimeTicks start_time;

  WebString alpn_negotiated_protocol;
  WebString connection_info;

  WebURLLoadTiming timing;
  base::TimeTicks last_redirect_end_time;
  base::TimeTicks finish_time;

  uint64_t transfer_size;
  uint64_t encoded_body_size;
  uint64_t decoded_body_size;

  bool did_reuse_connection;
  bool is_secure_context;

  // TODO(dcheng): The way this code works is fairly confusing: it might seem
  // unusual to store policy members like |allow_timing_details| inline, rather
  // than just clearing the fields. The reason for this complexity is because
  // PerformanceNavigationTiming inherits and shares many of the same fields
  // exposed by PerformanceResourceTiming, but the underlying behavior is a
  // little different.
  bool allow_timing_details;
  bool allow_redirect_details;

  // Normally, the timestamps are relative to the time origin. In most cases,
  // these timestamps should be positive value, so 0 is used to mark invalid
  // negative values.
  //
  // However, ServiceWorker navigation preloads may be negative, since these
  // requests may be started before the service worker started. In those cases,
  // this flag should be set to true.
  bool allow_negative_values;

  WebVector<WebServerTimingInfo> server_timing;
};

}  // namespace blink

#endif