xref: /aosp_15_r20/external/cronet/net/base/load_states.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2011 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 NET_BASE_LOAD_STATES_H__
6 #define NET_BASE_LOAD_STATES_H__
7 
8 #include <string>
9 
10 
11 namespace net {
12 
13 // These states correspond to the lengthy periods of time that a resource load
14 // may be blocked and unable to make progress.
15 enum LoadState {
16 
17 #define LOAD_STATE(label, value) LOAD_STATE_##label,
18 #include "net/base/load_states_list.h"
19 #undef LOAD_STATE
20 
21 };
22 
23 // Some states, like LOAD_STATE_WAITING_FOR_DELEGATE, are associated with extra
24 // data that describes more precisely what the delegate (for example) is doing.
25 // This class provides an easy way to hold a load state with an extra parameter.
26 struct LoadStateWithParam {
27   LoadState state;
28   std::u16string param;
LoadStateWithParamLoadStateWithParam29   LoadStateWithParam() : state(LOAD_STATE_IDLE) {}
LoadStateWithParamLoadStateWithParam30   LoadStateWithParam(LoadState state, const std::u16string& param)
31       : state(state), param(param) {}
32 };
33 
34 }  // namespace net
35 
36 #endif  // NET_BASE_LOAD_STATES_H__
37