// 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.
module network.mojom;
import "mojo/public/mojom/base/time.mojom";
// Type of sources.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum ServiceWorkerRouterSourceType {
// Network is used as a source.
kNetwork = 0,
// Race network and fetch handler.
kRace = 1,
// Fetch Event is used as a source.
kFetchEvent = 2,
// Cache is used as a source.
kCache = 3,
};
// The initial status of service worker on navigation request.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(ServiceWorkerStatus)
enum ServiceWorkerStatus {
kRunning = 0,
kStarting = 1,
kStopping = 2,
kStopped = 3,
kWarmingUp = 4,
kWarmedUp = 5,
};
// LINT.ThenChange(//tools/metrics/histograms/enums.xml:ServiceWorkerStatus)
// Represents information about ServiceWorker Static Routing API, especially,
// details of the matched static router rule.
struct ServiceWorkerRouterInfo {
// ID of the rule matched. If there is a matched rule, this field will be set,
// otherwise no value will be set.
uint32? rule_id_matched = 0;
// The router source of the matched rule. If there is a matched rule, this
// field will be set, otherwise no value will be set.
ServiceWorkerRouterSourceType? matched_source_type;
// The actual router type used.
ServiceWorkerRouterSourceType? actual_source_type;
// Total number of router rules.
uint64 route_rule_num = 0;
// The router evaluation time calculated in us.
mojo_base.mojom.TimeDelta router_evaluation_time;
// The state of the service worker when conducting router evaluation.
ServiceWorkerStatus? evaluation_worker_status;
};