1// Copyright (c) 2011 The Chromium Authors. All rights reserved.
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#pragma once
8
9namespace net {
10
11// These states correspond to the lengthy periods of time that a resource load
12// may be blocked and unable to make progress.
13enum LoadState {
14  // This is the default state.  It corresponds to a resource load that has
15  // either not yet begun or is idle waiting for the consumer to do something
16  // to move things along (e.g., the consumer of an URLRequest may not have
17  // called Read yet).
18  LOAD_STATE_IDLE,
19
20  // This state corresponds to a resource load that is blocked waiting for
21  // access to a resource in the cache.  If multiple requests are made for the
22  // same resource, the first request will be responsible for writing (or
23  // updating) the cache entry and the second request will be deferred until
24  // the first completes.  This may be done to optimize for cache reuse.
25  LOAD_STATE_WAITING_FOR_CACHE,
26
27  // This state corresponds to a resource load that is blocked waiting for a
28  // proxy autoconfig script to return a proxy server to use.  This state may
29  // take a while if the proxy script needs to resolve the IP address of the
30  // host before deciding what proxy to use.
31  LOAD_STATE_RESOLVING_PROXY_FOR_URL,
32
33  // This state indicates that we're in the process of establishing a tunnel
34  // through the proxy server.
35  LOAD_STATE_ESTABLISHING_PROXY_TUNNEL,
36
37  // This state corresponds to a resource load that is blocked waiting for a
38  // host name to be resolved.  This could either indicate resolution of the
39  // origin server corresponding to the resource or to the host name of a proxy
40  // server used to fetch the resource.
41  LOAD_STATE_RESOLVING_HOST,
42
43  // This state corresponds to a resource load that is blocked waiting for a
44  // TCP connection (or other network connection) to be established.  HTTP
45  // requests that reuse a keep-alive connection skip this state.
46  LOAD_STATE_CONNECTING,
47
48  // This state corresponds to a resource load that is blocked waiting for the
49  // SSL handshake to complete.
50  LOAD_STATE_SSL_HANDSHAKE,
51
52  // This state corresponds to a resource load that is blocked waiting to
53  // completely upload a request to a server.  In the case of a HTTP POST
54  // request, this state includes the period of time during which the message
55  // body is being uploaded.
56  LOAD_STATE_SENDING_REQUEST,
57
58  // This state corresponds to a resource load that is blocked waiting for the
59  // response to a network request.  In the case of a HTTP transaction, this
60  // corresponds to the period after the request is sent and before all of the
61  // response headers have been received.
62  LOAD_STATE_WAITING_FOR_RESPONSE,
63
64  // This state corresponds to a resource load that is blocked waiting for a
65  // read to complete.  In the case of a HTTP transaction, this corresponds to
66  // the period after the response headers have been received and before all of
67  // the response body has been downloaded.  (NOTE: This state only applies for
68  // an URLRequest while there is an outstanding Read operation.)
69  LOAD_STATE_READING_RESPONSE,
70};
71
72}  // namespace net
73
74#endif  // NET_BASE_LOAD_STATES_H__
75