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

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

Issue 1898133002: Add reprioritization to socket pools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated comments. Created 3 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
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/socks_client_socket_pool.h » ('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/socket_test_util.h" 5 #include "net/socket/socket_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 last_request_priority_ = priority; 1643 last_request_priority_ = priority;
1644 std::unique_ptr<StreamSocket> socket = 1644 std::unique_ptr<StreamSocket> socket =
1645 client_socket_factory_->CreateTransportClientSocket( 1645 client_socket_factory_->CreateTransportClientSocket(
1646 AddressList(), NULL, net_log.net_log(), NetLogSource()); 1646 AddressList(), NULL, net_log.net_log(), NetLogSource());
1647 MockConnectJob* job = new MockConnectJob(std::move(socket), handle, callback); 1647 MockConnectJob* job = new MockConnectJob(std::move(socket), handle, callback);
1648 job_list_.push_back(base::WrapUnique(job)); 1648 job_list_.push_back(base::WrapUnique(job));
1649 handle->set_pool_id(1); 1649 handle->set_pool_id(1);
1650 return job->Connect(); 1650 return job->Connect();
1651 } 1651 }
1652 1652
1653 void MockTransportClientSocketPool::SetPriority(const std::string& group_name,
1654 ClientSocketHandle* handle,
1655 RequestPriority priority) {
1656 // TODO: Implement.
1657 }
1658
1653 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, 1659 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name,
1654 ClientSocketHandle* handle) { 1660 ClientSocketHandle* handle) {
1655 for (std::unique_ptr<MockConnectJob>& it : job_list_) { 1661 for (std::unique_ptr<MockConnectJob>& it : job_list_) {
1656 if (it->CancelHandle(handle)) { 1662 if (it->CancelHandle(handle)) {
1657 cancel_count_++; 1663 cancel_count_++;
1658 break; 1664 break;
1659 } 1665 }
1660 } 1666 }
1661 } 1667 }
1662 1668
(...skipping 24 matching lines...) Expand all
1687 RequestPriority priority, 1693 RequestPriority priority,
1688 RespectLimits respect_limits, 1694 RespectLimits respect_limits,
1689 ClientSocketHandle* handle, 1695 ClientSocketHandle* handle,
1690 const CompletionCallback& callback, 1696 const CompletionCallback& callback,
1691 const NetLogWithSource& net_log) { 1697 const NetLogWithSource& net_log) {
1692 return transport_pool_->RequestSocket(group_name, socket_params, priority, 1698 return transport_pool_->RequestSocket(group_name, socket_params, priority,
1693 respect_limits, handle, callback, 1699 respect_limits, handle, callback,
1694 net_log); 1700 net_log);
1695 } 1701 }
1696 1702
1703 void MockSOCKSClientSocketPool::SetPriority(const std::string& group_name,
1704 ClientSocketHandle* handle,
1705 RequestPriority priority) {
1706 transport_pool_->SetPriority(group_name, handle, priority);
1707 }
1708
1697 void MockSOCKSClientSocketPool::CancelRequest( 1709 void MockSOCKSClientSocketPool::CancelRequest(
1698 const std::string& group_name, 1710 const std::string& group_name,
1699 ClientSocketHandle* handle) { 1711 ClientSocketHandle* handle) {
1700 return transport_pool_->CancelRequest(group_name, handle); 1712 return transport_pool_->CancelRequest(group_name, handle);
1701 } 1713 }
1702 1714
1703 void MockSOCKSClientSocketPool::ReleaseSocket( 1715 void MockSOCKSClientSocketPool::ReleaseSocket(
1704 const std::string& group_name, 1716 const std::string& group_name,
1705 std::unique_ptr<StreamSocket> socket, 1717 std::unique_ptr<StreamSocket> socket,
1706 int id) { 1718 int id) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 } 1756 }
1745 1757
1746 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { 1758 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) {
1747 int64_t total = 0; 1759 int64_t total = 0;
1748 for (const MockWrite* write = writes; write != writes + writes_size; ++write) 1760 for (const MockWrite* write = writes; write != writes + writes_size; ++write)
1749 total += write->data_len; 1761 total += write->data_len;
1750 return total; 1762 return total;
1751 } 1763 }
1752 1764
1753 } // namespace net 1765 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/socks_client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698