| OLD | NEW |
| 1 // Copyright (c) 2010 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 #include "chrome/browser/net/websocket_experiment/websocket_experiment_task.h" | 5 #include "chrome/browser/net/websocket_experiment/websocket_experiment_task.h" |
| 6 | 6 |
| 7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/net/url_request_context_getter.h" | 11 #include "chrome/common/net/url_request_context_getter.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // in websocket_experiment_def.txt on server. So, client expects idle | 107 // in websocket_experiment_def.txt on server. So, client expects idle |
| 108 // at least 1 sec and expects a message arrival within next 1 sec. | 108 // at least 1 sec and expects a message arrival within next 1 sec. |
| 109 websocket_idle_ms(kWebSocketIdleSec * 1000), | 109 websocket_idle_ms(kWebSocketIdleSec * 1000), |
| 110 websocket_receive_push_message_deadline_ms( | 110 websocket_receive_push_message_deadline_ms( |
| 111 kWebSocketPushDeadlineSec * 1000), | 111 kWebSocketPushDeadlineSec * 1000), |
| 112 websocket_bye_message("Bye"), | 112 websocket_bye_message("Bye"), |
| 113 websocket_bye_deadline_ms(kWebSocketByeDeadlineSec * 1000), | 113 websocket_bye_deadline_ms(kWebSocketByeDeadlineSec * 1000), |
| 114 websocket_close_deadline_ms(kWebSocketCloseDeadlineSec * 1000) { | 114 websocket_close_deadline_ms(kWebSocketCloseDeadlineSec * 1000) { |
| 115 } | 115 } |
| 116 | 116 |
| 117 WebSocketExperimentTask::Config::~Config() {} |
| 118 |
| 117 WebSocketExperimentTask::WebSocketExperimentTask( | 119 WebSocketExperimentTask::WebSocketExperimentTask( |
| 118 const Config& config, | 120 const Config& config, |
| 119 net::CompletionCallback* callback) | 121 net::CompletionCallback* callback) |
| 120 : config_(config), | 122 : config_(config), |
| 121 context_(ALLOW_THIS_IN_INITIALIZER_LIST(new Context())), | 123 context_(ALLOW_THIS_IN_INITIALIZER_LIST(new Context())), |
| 122 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 124 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 123 callback_(callback), | 125 callback_(callback), |
| 124 next_state_(STATE_NONE), | 126 next_state_(STATE_NONE), |
| 125 last_websocket_error_(net::OK) { | 127 last_websocket_error_(net::OK) { |
| 126 } | 128 } |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 if (websocket) | 647 if (websocket) |
| 646 websocket->DetachDelegate(); | 648 websocket->DetachDelegate(); |
| 647 DVLOG(1) << "Finish WebSocket experiment for " << config_.url | 649 DVLOG(1) << "Finish WebSocket experiment for " << config_.url |
| 648 << " " << GetProtocolVersionName(config_.protocol_version) | 650 << " " << GetProtocolVersionName(config_.protocol_version) |
| 649 << " next_state=" << next_state_ | 651 << " next_state=" << next_state_ |
| 650 << " result=" << net::ErrorToString(result); | 652 << " result=" << net::ErrorToString(result); |
| 651 callback_->Run(result); // will release this. | 653 callback_->Run(result); // will release this. |
| 652 } | 654 } |
| 653 | 655 |
| 654 } // namespace chrome_browser_net | 656 } // namespace chrome_browser_net |
| OLD | NEW |