File: page_load_metrics_mojom_traits.cc

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (81 lines) | stat: -rw-r--r-- 3,520 bytes parent folder | download | duplicates (5)
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 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/page_load_metrics/common/page_load_metrics_mojom_traits.h"

#include "mojo/public/cpp/base/time_mojom_traits.h"

namespace mojo {

// static
bool StructTraits<page_load_metrics::mojom::SubresourceLoadMetricsDataView,
                  blink::SubresourceLoadMetrics>::
    Read(page_load_metrics::mojom::SubresourceLoadMetricsDataView data,
         blink::SubresourceLoadMetrics* out) {
  out->number_of_subresources_loaded = data.number_of_subresources_loaded();
  out->number_of_subresource_loads_handled_by_service_worker =
      data.number_of_subresource_loads_handled_by_service_worker();
  return data.ReadServiceWorkerSubresourceLoadMetrics(
      &out->service_worker_subresource_load_metrics);
}

// static
bool StructTraits<
    page_load_metrics::mojom::ServiceWorkerSubresourceLoadMetricsDataView,
    blink::ServiceWorkerSubresourceLoadMetrics>::
    Read(page_load_metrics::mojom::ServiceWorkerSubresourceLoadMetricsDataView
             data,
         blink::ServiceWorkerSubresourceLoadMetrics* out) {
  out->image_handled = data.image_handled();
  out->image_fallback = data.image_fallback();
  out->css_handled = data.css_handled();
  out->css_fallback = data.css_fallback();
  out->script_handled = data.script_handled();
  out->script_fallback = data.script_fallback();
  out->font_handled = data.font_handled();
  out->font_fallback = data.font_fallback();
  out->raw_handled = data.raw_handled();
  out->raw_fallback = data.raw_fallback();
  out->svg_handled = data.svg_handled();
  out->svg_fallback = data.svg_fallback();
  out->xsl_handled = data.xsl_handled();
  out->xsl_fallback = data.xsl_fallback();
  out->link_prefetch_handled = data.link_prefetch_handled();
  out->link_prefetch_fallback = data.link_prefetch_fallback();
  out->text_track_handled = data.text_track_handled();
  out->text_track_fallback = data.text_track_fallback();
  out->audio_handled = data.audio_handled();
  out->audio_fallback = data.audio_fallback();
  out->video_handled = data.video_handled();
  out->video_fallback = data.video_fallback();
  out->manifest_handled = data.manifest_handled();
  out->manifest_fallback = data.manifest_fallback();
  out->speculation_rules_handled = data.speculation_rules_handled();
  out->speculation_rules_fallback = data.speculation_rules_fallback();
  out->mock_handled = data.mock_handled();
  out->mock_fallback = data.mock_fallback();
  out->dictionary_handled = data.dictionary_handled();
  out->dictionary_fallback = data.dictionary_fallback();
  out->matched_cache_router_source_count =
      data.matched_cache_router_source_count();
  out->matched_fetch_event_router_source_count =
      data.matched_fetch_event_router_source_count();
  out->matched_network_router_source_count =
      data.matched_network_router_source_count();
  out->matched_race_network_and_fetch_router_source_count =
      data.matched_race_network_and_fetch_router_source_count();
  out->matched_race_network_and_cache_router_source_count =
      data.matched_race_network_and_cache_router_source_count();
  if (!data.ReadTotalRouterEvaluationTimeForSubresources(
          &out->total_router_evaluation_time_for_subresources)) {
    return false;
  }
  if (!data.ReadTotalCacheLookupTimeForSubresources(
          &out->total_cache_lookup_time_for_subresources)) {
    return false;
  }
  return true;
}

}  // namespace mojo