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

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

Issue 12209080: Cleanup: Remove deprecated base::Value methods from net. Use base::Value too. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/spdy/spdy_session.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 <math.h> 7 #include <math.h>
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void ConnectJob::set_socket(StreamSocket* socket) { 106 void ConnectJob::set_socket(StreamSocket* socket) {
107 if (socket) { 107 if (socket) {
108 net_log().AddEvent(NetLog::TYPE_CONNECT_JOB_SET_SOCKET, 108 net_log().AddEvent(NetLog::TYPE_CONNECT_JOB_SET_SOCKET,
109 socket->NetLog().source().ToEventParametersCallback()); 109 socket->NetLog().source().ToEventParametersCallback());
110 } 110 }
111 socket_.reset(socket); 111 socket_.reset(socket);
112 } 112 }
113 113
114 void ConnectJob::NotifyDelegateOfCompletion(int rv) { 114 void ConnectJob::NotifyDelegateOfCompletion(int rv) {
115 // The delegate will delete |this|. 115 // The delegate will delete |this|.
116 Delegate *delegate = delegate_; 116 Delegate* delegate = delegate_;
117 delegate_ = NULL; 117 delegate_ = NULL;
118 118
119 LogConnectCompletion(rv); 119 LogConnectCompletion(rv);
120 delegate->OnConnectJobComplete(rv, this); 120 delegate->OnConnectJobComplete(rv, this);
121 } 121 }
122 122
123 void ConnectJob::ResetTimer(base::TimeDelta remaining_time) { 123 void ConnectJob::ResetTimer(base::TimeDelta remaining_time) {
124 timer_.Stop(); 124 timer_.Stop();
125 timer_.Start(FROM_HERE, remaining_time, this, &ConnectJob::OnTimeout); 125 timer_.Start(FROM_HERE, remaining_time, this, &ConnectJob::OnTimeout);
126 } 126 }
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // See http://crbug.com/5077. 582 // See http://crbug.com/5077.
583 return LOAD_STATE_IDLE; 583 return LOAD_STATE_IDLE;
584 } 584 }
585 } 585 }
586 } 586 }
587 587
588 NOTREACHED(); 588 NOTREACHED();
589 return LOAD_STATE_IDLE; 589 return LOAD_STATE_IDLE;
590 } 590 }
591 591
592 DictionaryValue* ClientSocketPoolBaseHelper::GetInfoAsValue( 592 base::DictionaryValue* ClientSocketPoolBaseHelper::GetInfoAsValue(
593 const std::string& name, const std::string& type) const { 593 const std::string& name, const std::string& type) const {
594 DictionaryValue* dict = new DictionaryValue(); 594 base::DictionaryValue* dict = new base::DictionaryValue();
595 dict->SetString("name", name); 595 dict->SetString("name", name);
596 dict->SetString("type", type); 596 dict->SetString("type", type);
597 dict->SetInteger("handed_out_socket_count", handed_out_socket_count_); 597 dict->SetInteger("handed_out_socket_count", handed_out_socket_count_);
598 dict->SetInteger("connecting_socket_count", connecting_socket_count_); 598 dict->SetInteger("connecting_socket_count", connecting_socket_count_);
599 dict->SetInteger("idle_socket_count", idle_socket_count_); 599 dict->SetInteger("idle_socket_count", idle_socket_count_);
600 dict->SetInteger("max_socket_count", max_sockets_); 600 dict->SetInteger("max_socket_count", max_sockets_);
601 dict->SetInteger("max_sockets_per_group", max_sockets_per_group_); 601 dict->SetInteger("max_sockets_per_group", max_sockets_per_group_);
602 dict->SetInteger("pool_generation_number", pool_generation_number_); 602 dict->SetInteger("pool_generation_number", pool_generation_number_);
603 603
604 if (group_map_.empty()) 604 if (group_map_.empty())
605 return dict; 605 return dict;
606 606
607 DictionaryValue* all_groups_dict = new DictionaryValue(); 607 base::DictionaryValue* all_groups_dict = new base::DictionaryValue();
608 for (GroupMap::const_iterator it = group_map_.begin(); 608 for (GroupMap::const_iterator it = group_map_.begin();
609 it != group_map_.end(); it++) { 609 it != group_map_.end(); it++) {
610 const Group* group = it->second; 610 const Group* group = it->second;
611 DictionaryValue* group_dict = new DictionaryValue(); 611 base::DictionaryValue* group_dict = new base::DictionaryValue();
612 612
613 group_dict->SetInteger("pending_request_count", 613 group_dict->SetInteger("pending_request_count",
614 group->pending_requests().size()); 614 group->pending_requests().size());
615 if (!group->pending_requests().empty()) { 615 if (!group->pending_requests().empty()) {
616 group_dict->SetInteger("top_pending_priority", 616 group_dict->SetInteger("top_pending_priority",
617 group->TopPendingPriority()); 617 group->TopPendingPriority());
618 } 618 }
619 619
620 group_dict->SetInteger("active_socket_count", group->active_socket_count()); 620 group_dict->SetInteger("active_socket_count", group->active_socket_count());
621 621
622 ListValue* idle_socket_list = new ListValue(); 622 base::ListValue* idle_socket_list = new base::ListValue();
623 std::list<IdleSocket>::const_iterator idle_socket; 623 std::list<IdleSocket>::const_iterator idle_socket;
624 for (idle_socket = group->idle_sockets().begin(); 624 for (idle_socket = group->idle_sockets().begin();
625 idle_socket != group->idle_sockets().end(); 625 idle_socket != group->idle_sockets().end();
626 idle_socket++) { 626 idle_socket++) {
627 int source_id = idle_socket->socket->NetLog().source().id; 627 int source_id = idle_socket->socket->NetLog().source().id;
628 idle_socket_list->Append(Value::CreateIntegerValue(source_id)); 628 idle_socket_list->Append(new base::FundamentalValue(source_id));
629 } 629 }
630 group_dict->Set("idle_sockets", idle_socket_list); 630 group_dict->Set("idle_sockets", idle_socket_list);
631 631
632 ListValue* connect_jobs_list = new ListValue(); 632 base::ListValue* connect_jobs_list = new base::ListValue();
633 std::set<ConnectJob*>::const_iterator job = group->jobs().begin(); 633 std::set<ConnectJob*>::const_iterator job = group->jobs().begin();
634 for (job = group->jobs().begin(); job != group->jobs().end(); job++) { 634 for (job = group->jobs().begin(); job != group->jobs().end(); job++) {
635 int source_id = (*job)->net_log().source().id; 635 int source_id = (*job)->net_log().source().id;
636 connect_jobs_list->Append(Value::CreateIntegerValue(source_id)); 636 connect_jobs_list->Append(new base::FundamentalValue(source_id));
637 } 637 }
638 group_dict->Set("connect_jobs", connect_jobs_list); 638 group_dict->Set("connect_jobs", connect_jobs_list);
639 639
640 group_dict->SetBoolean("is_stalled", 640 group_dict->SetBoolean("is_stalled",
641 group->IsStalledOnPoolMaxSockets( 641 group->IsStalledOnPoolMaxSockets(
642 max_sockets_per_group_)); 642 max_sockets_per_group_));
643 group_dict->SetBoolean("has_backup_job", group->HasBackupJob()); 643 group_dict->SetBoolean("has_backup_job", group->HasBackupJob());
644 644
645 all_groups_dict->SetWithoutPathExpansion(it->first, group_dict); 645 all_groups_dict->SetWithoutPathExpansion(it->first, group_dict);
646 } 646 }
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 STLDeleteElements(&jobs_); 1239 STLDeleteElements(&jobs_);
1240 unassigned_job_count_ = 0; 1240 unassigned_job_count_ = 0;
1241 1241
1242 // Cancel pending backup job. 1242 // Cancel pending backup job.
1243 weak_factory_.InvalidateWeakPtrs(); 1243 weak_factory_.InvalidateWeakPtrs();
1244 } 1244 }
1245 1245
1246 } // namespace internal 1246 } // namespace internal
1247 1247
1248 } // namespace net 1248 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698