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

Unified Diff: net/socket/socket_test_util.h

Issue 1892323002: Change scoped_ptr to std::unique_ptr in //net/socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/socket_posix.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_test_util.h
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index f942a3511be62891f4e952e356bfd6bf5e991b37..c731cc5553cd0f619f24784dd5ee7e639a0876a5 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -10,14 +10,15 @@
#include <cstring>
#include <deque>
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
@@ -454,7 +455,7 @@ class SequencedSocketData : public SocketDataProvider {
bool is_using_tcp_fast_open_;
// Used by RunUntilPaused. NULL at all other times.
- scoped_ptr<base::RunLoop> run_until_paused_run_loop_;
+ std::unique_ptr<base::RunLoop> run_until_paused_run_loop_;
base::WeakPtrFactory<SequencedSocketData> weak_factory_;
@@ -515,18 +516,18 @@ class MockClientSocketFactory : public ClientSocketFactory {
}
// ClientSocketFactory
- scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket(
+ std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket(
DatagramSocket::BindType bind_type,
const RandIntCallback& rand_int_cb,
NetLog* net_log,
const NetLog::Source& source) override;
- scoped_ptr<StreamSocket> CreateTransportClientSocket(
+ std::unique_ptr<StreamSocket> CreateTransportClientSocket(
const AddressList& addresses,
- scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher,
+ std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher,
NetLog* net_log,
const NetLog::Source& source) override;
- scoped_ptr<SSLClientSocket> CreateSSLClientSocket(
- scoped_ptr<ClientSocketHandle> transport_socket,
+ std::unique_ptr<SSLClientSocket> CreateSSLClientSocket(
+ std::unique_ptr<ClientSocketHandle> transport_socket,
const HostPortPair& host_and_port,
const SSLConfig& ssl_config,
const SSLClientSocketContext& context) override;
@@ -675,7 +676,7 @@ class MockTCPClientSocket : public MockClientSocket, public AsyncSocket {
class MockSSLClientSocket : public MockClientSocket, public AsyncSocket {
public:
- MockSSLClientSocket(scoped_ptr<ClientSocketHandle> transport_socket,
+ MockSSLClientSocket(std::unique_ptr<ClientSocketHandle> transport_socket,
const HostPortPair& host_and_port,
const SSLConfig& ssl_config,
SSLSocketDataProvider* socket);
@@ -720,7 +721,7 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket {
const CompletionCallback& callback,
int rv);
- scoped_ptr<ClientSocketHandle> transport_;
+ std::unique_ptr<ClientSocketHandle> transport_;
SSLSocketDataProvider* data_;
DISALLOW_COPY_AND_ASSIGN(MockSSLClientSocket);
@@ -841,7 +842,7 @@ class ClientSocketPoolTest {
DCHECK(socket_pool);
TestSocketRequest* request(
new TestSocketRequest(&request_order_, &completion_count_));
- requests_.push_back(make_scoped_ptr(request));
+ requests_.push_back(base::WrapUnique(request));
int rv = request->handle()->Init(group_name, socket_params, priority,
respect_limits, request->callback(),
socket_pool, BoundNetLog());
@@ -868,11 +869,13 @@ class ClientSocketPoolTest {
TestSocketRequest* request(int i) { return requests_[i].get(); }
size_t requests_size() const { return requests_.size(); }
- std::vector<scoped_ptr<TestSocketRequest>>* requests() { return &requests_; }
+ std::vector<std::unique_ptr<TestSocketRequest>>* requests() {
+ return &requests_;
+ }
size_t completion_count() const { return completion_count_; }
private:
- std::vector<scoped_ptr<TestSocketRequest>> requests_;
+ std::vector<std::unique_ptr<TestSocketRequest>> requests_;
std::vector<TestSocketRequest*> request_order_;
size_t completion_count_;
@@ -894,7 +897,7 @@ class MockTransportClientSocketPool : public TransportClientSocketPool {
class MockConnectJob {
public:
- MockConnectJob(scoped_ptr<StreamSocket> socket,
+ MockConnectJob(std::unique_ptr<StreamSocket> socket,
ClientSocketHandle* handle,
const CompletionCallback& callback);
~MockConnectJob();
@@ -905,7 +908,7 @@ class MockTransportClientSocketPool : public TransportClientSocketPool {
private:
void OnConnect(int rv);
- scoped_ptr<StreamSocket> socket_;
+ std::unique_ptr<StreamSocket> socket_;
ClientSocketHandle* handle_;
CompletionCallback user_callback_;
@@ -936,12 +939,12 @@ class MockTransportClientSocketPool : public TransportClientSocketPool {
void CancelRequest(const std::string& group_name,
ClientSocketHandle* handle) override;
void ReleaseSocket(const std::string& group_name,
- scoped_ptr<StreamSocket> socket,
+ std::unique_ptr<StreamSocket> socket,
int id) override;
private:
ClientSocketFactory* client_socket_factory_;
- std::vector<scoped_ptr<MockConnectJob>> job_list_;
+ std::vector<std::unique_ptr<MockConnectJob>> job_list_;
RequestPriority last_request_priority_;
int release_count_;
int cancel_count_;
@@ -969,7 +972,7 @@ class MockSOCKSClientSocketPool : public SOCKSClientSocketPool {
void CancelRequest(const std::string& group_name,
ClientSocketHandle* handle) override;
void ReleaseSocket(const std::string& group_name,
- scoped_ptr<StreamSocket> socket,
+ std::unique_ptr<StreamSocket> socket,
int id) override;
private:
« no previous file with comments | « net/socket/socket_posix.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698