| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/socket/websocket_transport_client_socket_pool.h" | 5 #include "net/socket/websocket_transport_client_socket_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 LoadState WebSocketTransportClientSocketPool::GetLoadState( | 425 LoadState WebSocketTransportClientSocketPool::GetLoadState( |
| 426 const std::string& group_name, | 426 const std::string& group_name, |
| 427 const ClientSocketHandle* handle) const { | 427 const ClientSocketHandle* handle) const { |
| 428 if (stalled_request_map_.find(handle) != stalled_request_map_.end()) | 428 if (stalled_request_map_.find(handle) != stalled_request_map_.end()) |
| 429 return LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET; | 429 return LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET; |
| 430 if (pending_callbacks_.count(handle)) | 430 if (pending_callbacks_.count(handle)) |
| 431 return LOAD_STATE_CONNECTING; | 431 return LOAD_STATE_CONNECTING; |
| 432 return LookupConnectJob(handle)->GetLoadState(); | 432 return LookupConnectJob(handle)->GetLoadState(); |
| 433 } | 433 } |
| 434 | 434 |
| 435 base::DictionaryValue* WebSocketTransportClientSocketPool::GetInfoAsValue( | 435 scoped_ptr<base::DictionaryValue> |
| 436 const std::string& name, | 436 WebSocketTransportClientSocketPool::GetInfoAsValue( |
| 437 const std::string& type, | 437 const std::string& name, |
| 438 bool include_nested_pools) const { | 438 const std::string& type, |
| 439 bool include_nested_pools) const { |
| 439 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 440 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 440 dict->SetString("name", name); | 441 dict->SetString("name", name); |
| 441 dict->SetString("type", type); | 442 dict->SetString("type", type); |
| 442 dict->SetInteger("handed_out_socket_count", handed_out_socket_count_); | 443 dict->SetInteger("handed_out_socket_count", handed_out_socket_count_); |
| 443 dict->SetInteger("connecting_socket_count", pending_connects_.size()); | 444 dict->SetInteger("connecting_socket_count", pending_connects_.size()); |
| 444 dict->SetInteger("idle_socket_count", 0); | 445 dict->SetInteger("idle_socket_count", 0); |
| 445 dict->SetInteger("max_socket_count", max_sockets_); | 446 dict->SetInteger("max_socket_count", max_sockets_); |
| 446 dict->SetInteger("max_sockets_per_group", max_sockets_); | 447 dict->SetInteger("max_sockets_per_group", max_sockets_); |
| 447 dict->SetInteger("pool_generation_number", 0); | 448 dict->SetInteger("pool_generation_number", 0); |
| 448 return dict.release(); | 449 return dict.Pass(); |
| 449 } | 450 } |
| 450 | 451 |
| 451 TimeDelta WebSocketTransportClientSocketPool::ConnectionTimeout() const { | 452 TimeDelta WebSocketTransportClientSocketPool::ConnectionTimeout() const { |
| 452 return TimeDelta::FromSeconds(kTransportConnectJobTimeoutInSeconds); | 453 return TimeDelta::FromSeconds(kTransportConnectJobTimeoutInSeconds); |
| 453 } | 454 } |
| 454 | 455 |
| 455 bool WebSocketTransportClientSocketPool::IsStalled() const { | 456 bool WebSocketTransportClientSocketPool::IsStalled() const { |
| 456 return !stalled_request_queue_.empty(); | 457 return !stalled_request_queue_.empty(); |
| 457 } | 458 } |
| 458 | 459 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 const BoundNetLog& net_log) | 635 const BoundNetLog& net_log) |
| 635 : params(params), | 636 : params(params), |
| 636 priority(priority), | 637 priority(priority), |
| 637 handle(handle), | 638 handle(handle), |
| 638 callback(callback), | 639 callback(callback), |
| 639 net_log(net_log) {} | 640 net_log(net_log) {} |
| 640 | 641 |
| 641 WebSocketTransportClientSocketPool::StalledRequest::~StalledRequest() {} | 642 WebSocketTransportClientSocketPool::StalledRequest::~StalledRequest() {} |
| 642 | 643 |
| 643 } // namespace net | 644 } // namespace net |
| OLD | NEW |