| 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 // WebSocket live experiment task. | 5 // WebSocket live experiment task. |
| 6 // It will try the following scenario. | 6 // It will try the following scenario. |
| 7 // | 7 // |
| 8 // - Fetch |http_url| within |url_fetch_deadline_ms| msec. | 8 // - Fetch |http_url| within |url_fetch_deadline_ms| msec. |
| 9 // If failed, the task is aborted (no http reachability) | 9 // If failed, the task is aborted (no http reachability) |
| 10 // | 10 // |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 STATE_WEBSOCKET_RECV_HELLO, | 66 STATE_WEBSOCKET_RECV_HELLO, |
| 67 STATE_WEBSOCKET_KEEP_IDLE, | 67 STATE_WEBSOCKET_KEEP_IDLE, |
| 68 STATE_WEBSOCKET_KEEP_IDLE_COMPLETE, | 68 STATE_WEBSOCKET_KEEP_IDLE_COMPLETE, |
| 69 STATE_WEBSOCKET_RECV_PUSH_MESSAGE, | 69 STATE_WEBSOCKET_RECV_PUSH_MESSAGE, |
| 70 STATE_WEBSOCKET_ECHO_BACK_MESSAGE, | 70 STATE_WEBSOCKET_ECHO_BACK_MESSAGE, |
| 71 STATE_WEBSOCKET_RECV_BYE, | 71 STATE_WEBSOCKET_RECV_BYE, |
| 72 STATE_WEBSOCKET_CLOSE, | 72 STATE_WEBSOCKET_CLOSE, |
| 73 STATE_WEBSOCKET_CLOSE_COMPLETE, | 73 STATE_WEBSOCKET_CLOSE_COMPLETE, |
| 74 NUM_STATES, | 74 NUM_STATES, |
| 75 }; | 75 }; |
| 76 |
| 76 class Config { | 77 class Config { |
| 77 public: | 78 public: |
| 78 Config(); | 79 Config(); |
| 80 ~Config(); |
| 79 | 81 |
| 80 GURL url; | 82 GURL url; |
| 81 std::string ws_protocol; | 83 std::string ws_protocol; |
| 82 std::string ws_origin; | 84 std::string ws_origin; |
| 83 std::string ws_location; | 85 std::string ws_location; |
| 84 net::WebSocket::ProtocolVersion protocol_version; | 86 net::WebSocket::ProtocolVersion protocol_version; |
| 85 | 87 |
| 86 GURL http_url; | 88 GURL http_url; |
| 87 | 89 |
| 88 int64 url_fetch_deadline_ms; | 90 int64 url_fetch_deadline_ms; |
| 89 int64 websocket_onopen_deadline_ms; | 91 int64 websocket_onopen_deadline_ms; |
| 90 std::string websocket_hello_message; | 92 std::string websocket_hello_message; |
| 91 int64 websocket_hello_echoback_deadline_ms; | 93 int64 websocket_hello_echoback_deadline_ms; |
| 92 int64 websocket_idle_ms; | 94 int64 websocket_idle_ms; |
| 93 int64 websocket_receive_push_message_deadline_ms; | 95 int64 websocket_receive_push_message_deadline_ms; |
| 94 std::string websocket_bye_message; | 96 std::string websocket_bye_message; |
| 95 int64 websocket_bye_deadline_ms; | 97 int64 websocket_bye_deadline_ms; |
| 96 int64 websocket_close_deadline_ms; | 98 int64 websocket_close_deadline_ms; |
| 97 }; | 99 }; |
| 100 |
| 98 class Context { | 101 class Context { |
| 99 public: | 102 public: |
| 100 Context() {} | 103 Context() {} |
| 101 virtual ~Context() {} | 104 virtual ~Context() {} |
| 102 | 105 |
| 103 virtual URLFetcher* CreateURLFetcher( | 106 virtual URLFetcher* CreateURLFetcher( |
| 104 const Config& config, URLFetcher::Delegate* delegate); | 107 const Config& config, URLFetcher::Delegate* delegate); |
| 105 virtual net::WebSocket* CreateWebSocket( | 108 virtual net::WebSocket* CreateWebSocket( |
| 106 const Config& config, net::WebSocketDelegate* delegate); | 109 const Config& config, net::WebSocketDelegate* delegate); |
| 107 | 110 |
| 108 private: | 111 private: |
| 109 DISALLOW_COPY_AND_ASSIGN(Context); | 112 DISALLOW_COPY_AND_ASSIGN(Context); |
| 110 }; | 113 }; |
| 114 |
| 111 class Result { | 115 class Result { |
| 112 public: | 116 public: |
| 113 Result() | 117 Result() |
| 114 : last_result(net::OK), | 118 : last_result(net::OK), |
| 115 last_state(STATE_NONE) {} | 119 last_state(STATE_NONE) {} |
| 116 int last_result; | 120 int last_result; |
| 117 State last_state; | 121 State last_state; |
| 118 | 122 |
| 119 base::TimeDelta url_fetch; | 123 base::TimeDelta url_fetch; |
| 120 base::TimeDelta websocket_connect; | 124 base::TimeDelta websocket_connect; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 base::TimeTicks websocket_connect_start_time_; | 205 base::TimeTicks websocket_connect_start_time_; |
| 202 base::TimeTicks websocket_echo_start_time_; | 206 base::TimeTicks websocket_echo_start_time_; |
| 203 base::TimeTicks websocket_idle_start_time_; | 207 base::TimeTicks websocket_idle_start_time_; |
| 204 | 208 |
| 205 DISALLOW_COPY_AND_ASSIGN(WebSocketExperimentTask); | 209 DISALLOW_COPY_AND_ASSIGN(WebSocketExperimentTask); |
| 206 }; | 210 }; |
| 207 | 211 |
| 208 } // namespace chrome_browser_net | 212 } // namespace chrome_browser_net |
| 209 | 213 |
| 210 #endif // CHROME_BROWSER_NET_WEBSOCKET_EXPERIMENT_WEBSOCKET_EXPERIMENT_TASK_H_ | 214 #endif // CHROME_BROWSER_NET_WEBSOCKET_EXPERIMENT_WEBSOCKET_EXPERIMENT_TASK_H_ |
| OLD | NEW |