15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This is the list of load states and their values. For the enum values,
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// include the file "net/base/load_states.h".
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Here we define the values using a macro LOAD_STATE, so it can be
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// expanded differently in some places (for example, to automatically
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// map a load flag value to its symbolic name).
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This is the default state.  It corresponds to a resource load that has
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// either not yet begun or is idle waiting for the consumer to do something
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// to move things along (e.g., the consumer of an URLRequest may not have
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// called Read yet).
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(IDLE)
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
18ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// When a socket pool group is below the maximum number of sockets allowed per
19ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// group, but a new socket cannot be created due to the per-pool socket limit,
20ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// this state is returned by all requests for the group waiting on an idle
21ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// connection, except those that may be serviced by a pending new connection.
22ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochLOAD_STATE(WAITING_FOR_STALLED_SOCKET_POOL)
23ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch
24ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// When a socket pool group has reached the maximum number of sockets allowed
25ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// per group, this state is returned for all requests that don't have a socket,
26ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// except those that correspond to a pending new connection.
27ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochLOAD_STATE(WAITING_FOR_AVAILABLE_SOCKET)
28ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state indicates that the URLRequest delegate has chosen to block this
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// request before it was sent over the network. When in this state, the
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// delegate should set a load state parameter on the URLRequest describing
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the nature of the delay (i.e. "Waiting for <description given by
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// delegate>").
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(WAITING_FOR_DELEGATE)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting for
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// access to a resource in the cache.  If multiple requests are made for the
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// same resource, the first request will be responsible for writing (or
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// updating) the cache entry and the second request will be deferred until
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the first completes.  This may be done to optimize for cache reuse.
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(WAITING_FOR_CACHE)
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting for
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// access to a resource in the AppCache.
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Note: This is a layering violation, but being the only one it's not that
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// bad. TODO(rvargas): Reconsider what to do if we need to add more.
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(WAITING_FOR_APPCACHE)
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// This state corresponds to a resource being blocked waiting for the
502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// PAC script to be downloaded.
512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)LOAD_STATE(DOWNLOADING_PROXY_SCRIPT)
522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting for a
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// proxy autoconfig script to return a proxy server to use.
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(RESOLVING_PROXY_FOR_URL)
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting for a
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// proxy autoconfig script to return a proxy server to use, but that proxy
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// script is busy resolving the IP address of a host.
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(RESOLVING_HOST_IN_PROXY_SCRIPT)
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state indicates that we're in the process of establishing a tunnel
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// through the proxy server.
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(ESTABLISHING_PROXY_TUNNEL)
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting for a
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// host name to be resolved.  This could either indicate resolution of the
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// origin server corresponding to the resource or to the host name of a proxy
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// server used to fetch the resource.
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(RESOLVING_HOST)
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting for a
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// TCP connection (or other network connection) to be established.  HTTP
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// requests that reuse a keep-alive connection skip this state.
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(CONNECTING)
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting for the
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// SSL handshake to complete.
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(SSL_HANDSHAKE)
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting to
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// completely upload a request to a server.  In the case of a HTTP POST
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// request, this state includes the period of time during which the message
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// body is being uploaded.
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(SENDING_REQUEST)
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting for the
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// response to a network request.  In the case of a HTTP transaction, this
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// corresponds to the period after the request is sent and before all of the
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// response headers have been received.
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(WAITING_FOR_RESPONSE)
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This state corresponds to a resource load that is blocked waiting for a
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// read to complete.  In the case of a HTTP transaction, this corresponds to
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the period after the response headers have been received and before all of
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the response body has been downloaded.  (NOTE: This state only applies for
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// an URLRequest while there is an outstanding Read operation.)
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LOAD_STATE(READING_RESPONSE)
99