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
content / public / browser / global_request_id.h [blame]
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_GLOBAL_REQUEST_ID_H_
#define CONTENT_PUBLIC_BROWSER_GLOBAL_REQUEST_ID_H_
#include <compare>
#include "base/numerics/safe_conversions.h"
#include "content/common/content_export.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"
namespace content {
// Uniquely identifies a net::URLRequest.
struct CONTENT_EXPORT GlobalRequestID {
GlobalRequestID() = default;
GlobalRequestID(base::StrictNumeric<int32_t> child_id,
base::StrictNumeric<int32_t> request_id)
: child_id(child_id), request_id(request_id) {}
// The unique ID of the child process (different from OS's PID).
int32_t child_id = -1;
// The request ID (unique for the child).
int32_t request_id = -1;
// Returns a Request ID for browser-initiated requests. Crashes if called more
// than (2**31 - 2) times.
static GlobalRequestID MakeBrowserInitiated();
auto operator<=>(const GlobalRequestID& other) const = default;
void WriteIntoTrace(perfetto::TracedValue context) const;
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_GLOBAL_REQUEST_ID_H_