Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1140)

Side by Side Diff: net/socket/client_socket_pool_base.cc

Issue 1158193006: Converted bare pointer to scoped_ptr<> in net/socket and net/http (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed failed net unit tests Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/client_socket_pool_base.h ('k') | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/client_socket_pool_base.h" 5 #include "net/socket/client_socket_pool_base.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/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 if (group.HasConnectJobForHandle(handle)) { 588 if (group.HasConnectJobForHandle(handle)) {
589 // Just return the state of the oldest ConnectJob. 589 // Just return the state of the oldest ConnectJob.
590 return (*group.jobs().begin())->GetLoadState(); 590 return (*group.jobs().begin())->GetLoadState();
591 } 591 }
592 592
593 if (group.CanUseAdditionalSocketSlot(max_sockets_per_group_)) 593 if (group.CanUseAdditionalSocketSlot(max_sockets_per_group_))
594 return LOAD_STATE_WAITING_FOR_STALLED_SOCKET_POOL; 594 return LOAD_STATE_WAITING_FOR_STALLED_SOCKET_POOL;
595 return LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET; 595 return LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET;
596 } 596 }
597 597
598 base::DictionaryValue* ClientSocketPoolBaseHelper::GetInfoAsValue( 598 scoped_ptr<base::DictionaryValue> ClientSocketPoolBaseHelper::GetInfoAsValue(
599 const std::string& name, const std::string& type) const { 599 const std::string& name, const std::string& type) const {
600 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 600 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
601 dict->SetString("name", name); 601 dict->SetString("name", name);
602 dict->SetString("type", type); 602 dict->SetString("type", type);
603 dict->SetInteger("handed_out_socket_count", handed_out_socket_count_); 603 dict->SetInteger("handed_out_socket_count", handed_out_socket_count_);
604 dict->SetInteger("connecting_socket_count", connecting_socket_count_); 604 dict->SetInteger("connecting_socket_count", connecting_socket_count_);
605 dict->SetInteger("idle_socket_count", idle_socket_count_); 605 dict->SetInteger("idle_socket_count", idle_socket_count_);
606 dict->SetInteger("max_socket_count", max_sockets_); 606 dict->SetInteger("max_socket_count", max_sockets_);
607 dict->SetInteger("max_sockets_per_group", max_sockets_per_group_); 607 dict->SetInteger("max_sockets_per_group", max_sockets_per_group_);
608 dict->SetInteger("pool_generation_number", pool_generation_number_); 608 dict->SetInteger("pool_generation_number", pool_generation_number_);
609 609
610 if (group_map_.empty()) 610 if (group_map_.empty())
611 return dict.release(); 611 return dict.Pass();
612 612
613 base::DictionaryValue* all_groups_dict = new base::DictionaryValue(); 613 base::DictionaryValue* all_groups_dict = new base::DictionaryValue();
614 for (GroupMap::const_iterator it = group_map_.begin(); 614 for (GroupMap::const_iterator it = group_map_.begin();
615 it != group_map_.end(); it++) { 615 it != group_map_.end(); it++) {
616 const Group* group = it->second; 616 const Group* group = it->second;
617 base::DictionaryValue* group_dict = new base::DictionaryValue(); 617 base::DictionaryValue* group_dict = new base::DictionaryValue();
618 618
619 group_dict->SetInteger("pending_request_count", 619 group_dict->SetInteger("pending_request_count",
620 group->pending_request_count()); 620 group->pending_request_count());
621 if (group->has_pending_requests()) { 621 if (group->has_pending_requests()) {
(...skipping 23 matching lines...) Expand all
645 group_dict->Set("connect_jobs", connect_jobs_list); 645 group_dict->Set("connect_jobs", connect_jobs_list);
646 646
647 group_dict->SetBoolean("is_stalled", group->CanUseAdditionalSocketSlot( 647 group_dict->SetBoolean("is_stalled", group->CanUseAdditionalSocketSlot(
648 max_sockets_per_group_)); 648 max_sockets_per_group_));
649 group_dict->SetBoolean("backup_job_timer_is_running", 649 group_dict->SetBoolean("backup_job_timer_is_running",
650 group->BackupJobTimerIsRunning()); 650 group->BackupJobTimerIsRunning());
651 651
652 all_groups_dict->SetWithoutPathExpansion(it->first, group_dict); 652 all_groups_dict->SetWithoutPathExpansion(it->first, group_dict);
653 } 653 }
654 dict->Set("groups", all_groups_dict); 654 dict->Set("groups", all_groups_dict);
655 return dict.release(); 655 return dict.Pass();
656 } 656 }
657 657
658 bool ClientSocketPoolBaseHelper::IdleSocket::IsUsable() const { 658 bool ClientSocketPoolBaseHelper::IdleSocket::IsUsable() const {
659 if (socket->WasEverUsed()) 659 if (socket->WasEverUsed())
660 return socket->IsConnectedAndIdle(); 660 return socket->IsConnectedAndIdle();
661 return socket->IsConnected(); 661 return socket->IsConnected();
662 } 662 }
663 663
664 bool ClientSocketPoolBaseHelper::IdleSocket::ShouldCleanup( 664 bool ClientSocketPoolBaseHelper::IdleSocket::ShouldCleanup(
665 base::TimeTicks now, 665 base::TimeTicks now,
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 // If there are no more requests, kill the backup timer. 1337 // If there are no more requests, kill the backup timer.
1338 if (pending_requests_.empty()) 1338 if (pending_requests_.empty())
1339 backup_job_timer_.Stop(); 1339 backup_job_timer_.Stop();
1340 request->CrashIfInvalid(); 1340 request->CrashIfInvalid();
1341 return request.Pass(); 1341 return request.Pass();
1342 } 1342 }
1343 1343
1344 } // namespace internal 1344 } // namespace internal
1345 1345
1346 } // namespace net 1346 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base.h ('k') | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698