blob: 2b4e86cda6e9be3d3862f5de033d3d465d4821cc [file] [log] [blame]
Hiroshige Hayashizakib3ff61d2025-08-12 06:28:081// Copyright 2025 The Chromium Authors
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_BROWSER_PRELOADING_PREFETCH_PREFETCH_SERVABLE_STATE_H_
6#define CONTENT_BROWSER_PRELOADING_PREFETCH_PREFETCH_SERVABLE_STATE_H_
7
8#include <ostream>
9
10#include "content/common/content_export.h"
11
12namespace content {
13
14// TODO(crbug.com/372186548): Revisit the shape of `PrefetchServableState`.
15//
16// See also https://crrev.com/c/5831122
17enum class PrefetchServableState {
18 // `PrefetchService` is checking eligibility of the prefetch or waiting load
19 // start after eligibility check.
20 //
21 // Prefetch matching process should block until eligibility is got (and load
22 // start) not to fall back normal navigation without waiting prefetch ahead of
23 // prerender and send a duplicated fetch request.
24 //
25 // This state occurs only if `kPrerender2FallbackPrefetchSpecRules` is
26 // enabled. Otherwise, `kNotServable` is returned for this period.
27 kShouldBlockUntilEligibilityGot,
28
29 // The load is started but non redirect header is not received yet.
30 //
31 // Prefetch matching process should block until the head of this is received
32 // on a navigation to a matching URL, as a server can send a response header
33 // including NoVarySearch header that contradicts NoVarySearch hint.
34 kShouldBlockUntilHeadReceived,
35
36 // This received non redirect header and is not expired.
37 //
38 // Note that it needs more checks to serve, e.g. cookie check. See also e.g.
39 // `PrefetchMatchResolver::OnDeterminedHead()`.
40 kServable,
41
42 // Not other states.
43 kNotServable,
44};
45
46CONTENT_EXPORT std::ostream& operator<<(std::ostream& ostream,
47 PrefetchServableState servable_state);
48
49} // namespace content
50
51#endif // CONTENT_BROWSER_PRELOADING_PREFETCH_PREFETCH_SERVABLE_STATE_H_