Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_BASE_LOAD_STATES_H__ | 5 #ifndef NET_BASE_LOAD_STATES_H__ |
| 6 #define NET_BASE_LOAD_STATES_H__ | 6 #define NET_BASE_LOAD_STATES_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | |
| 10 | |
| 9 namespace net { | 11 namespace net { |
| 10 | 12 |
| 11 // These states correspond to the lengthy periods of time that a resource load | 13 // These states correspond to the lengthy periods of time that a resource load |
| 12 // may be blocked and unable to make progress. | 14 // may be blocked and unable to make progress. |
| 13 enum LoadState { | 15 enum LoadState { |
| 14 // This is the default state. It corresponds to a resource load that has | 16 // 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 | 17 // 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 | 18 // to move things along (e.g., the consumer of an URLRequest may not have |
| 17 // called Read yet). | 19 // called Read yet). |
| 18 LOAD_STATE_IDLE, | 20 LOAD_STATE_IDLE, |
| 19 | 21 |
| 22 // This state indicates that the URLRequest delegate has chosen to block this | |
| 23 // request before it was sent over the network. When in this state, the | |
| 24 // delegate should set a load state parameter on the URLRequest describing | |
| 25 // the nature of the delay (i.e. "Waiting for <description given by | |
| 26 // delegate>"). | |
| 27 LOAD_STATE_WAITING_FOR_DELEGATE, | |
| 28 | |
| 20 // This state corresponds to a resource load that is blocked waiting for | 29 // 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 | 30 // 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 | 31 // same resource, the first request will be responsible for writing (or |
| 23 // updating) the cache entry and the second request will be deferred until | 32 // 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. | 33 // the first completes. This may be done to optimize for cache reuse. |
| 25 LOAD_STATE_WAITING_FOR_CACHE, | 34 LOAD_STATE_WAITING_FOR_CACHE, |
| 26 | 35 |
| 27 // This state corresponds to a resource load that is blocked waiting for a | 36 // 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 | 37 // 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 | 38 // take a while if the proxy script needs to resolve the IP address of the |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 LOAD_STATE_WAITING_FOR_RESPONSE, | 71 LOAD_STATE_WAITING_FOR_RESPONSE, |
| 63 | 72 |
| 64 // This state corresponds to a resource load that is blocked waiting for a | 73 // 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 | 74 // 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 | 75 // 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 | 76 // the response body has been downloaded. (NOTE: This state only applies for |
| 68 // an URLRequest while there is an outstanding Read operation.) | 77 // an URLRequest while there is an outstanding Read operation.) |
| 69 LOAD_STATE_READING_RESPONSE, | 78 LOAD_STATE_READING_RESPONSE, |
| 70 }; | 79 }; |
| 71 | 80 |
| 81 // Some states, like LOAD_STATE_WAITING_FOR_DELEGATE, are associated with extra | |
| 82 // data that describes more precisely what the delegate (for example) is doing. | |
| 83 // This class provides an easy way to hold a load state with an extra parameter. | |
| 84 struct LoadStateWithParam { | |
| 85 LoadState state; | |
| 86 std::string param; | |
|
eroman
2011/08/05 01:54:22
Can you make this a string16? Seems there are alre
Matt Perry
2011/08/08 22:14:33
Done.
| |
| 87 LoadStateWithParam() {} | |
| 88 LoadStateWithParam(LoadState state, const std::string& param) | |
| 89 : state(state), param(param) {} | |
| 90 }; | |
| 91 | |
| 72 } // namespace net | 92 } // namespace net |
| 73 | 93 |
| 74 #endif // NET_BASE_LOAD_STATES_H__ | 94 #endif // NET_BASE_LOAD_STATES_H__ |
| OLD | NEW |