diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-01 20:38:10 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-01 20:38:10 +0000 |
commit | f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8 (patch) | |
tree | 6ccdd87ccfc89adbcb372c517559fa61fbc6c6b2 /net/socket | |
parent | d1666539b57bf8552e203d355fd09909d36f9732 (diff) | |
download | chromium_src-f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8.zip chromium_src-f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8.tar.gz chromium_src-f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8.tar.bz2 |
Begin CompletionCallback switchover.
Rename CompletionCallback to OldCompletionCallback in preparation for introducing a new CompletionCallback based on base::Callback.
Also renames other CompletionCallback types like CancelableCompletionCallback and TestCompletionCallback and CompletionCallbackImpl. All using sed with s/CompletionCallback/OldCompletionCallback/g.
BUG=98719
TEST=none
Review URL: http://codereview.chromium.org/8070013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103650 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
60 files changed, 438 insertions, 438 deletions
diff --git a/net/socket/client_socket_handle.cc b/net/socket/client_socket_handle.cc index 29b5bd3..8309c3f 100644 --- a/net/socket/client_socket_handle.cc +++ b/net/socket/client_socket_handle.cc @@ -73,7 +73,7 @@ LoadState ClientSocketHandle::GetLoadState() const { } void ClientSocketHandle::OnIOComplete(int result) { - CompletionCallback* callback = user_callback_; + OldCompletionCallback* callback = user_callback_; user_callback_ = NULL; HandleInitCompletion(result); callback->Run(result); diff --git a/net/socket/client_socket_handle.h b/net/socket/client_socket_handle.h index 3f75ccb..cab6ef6 100644 --- a/net/socket/client_socket_handle.h +++ b/net/socket/client_socket_handle.h @@ -74,7 +74,7 @@ class NET_EXPORT ClientSocketHandle { int Init(const std::string& group_name, const scoped_refptr<SocketParams>& socket_params, RequestPriority priority, - CompletionCallback* callback, + OldCompletionCallback* callback, PoolType* pool, const BoundNetLog& net_log); @@ -167,8 +167,8 @@ class NET_EXPORT ClientSocketHandle { scoped_ptr<StreamSocket> socket_; std::string group_name_; bool is_reused_; - CompletionCallbackImpl<ClientSocketHandle> callback_; - CompletionCallback* user_callback_; + OldCompletionCallbackImpl<ClientSocketHandle> callback_; + OldCompletionCallback* user_callback_; base::TimeDelta idle_time_; int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation. bool is_ssl_error_; @@ -187,7 +187,7 @@ template <typename SocketParams, typename PoolType> int ClientSocketHandle::Init(const std::string& group_name, const scoped_refptr<SocketParams>& socket_params, RequestPriority priority, - CompletionCallback* callback, + OldCompletionCallback* callback, PoolType* pool, const BoundNetLog& net_log) { requesting_source_ = net_log.source(); diff --git a/net/socket/client_socket_pool.h b/net/socket/client_socket_pool.h index 0c6b8a4..82d7390 100644 --- a/net/socket/client_socket_pool.h +++ b/net/socket/client_socket_pool.h @@ -67,7 +67,7 @@ class NET_EXPORT ClientSocketPool { const void* params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log) = 0; // RequestSockets is used to request that |num_sockets| be connected in the @@ -87,7 +87,7 @@ class NET_EXPORT ClientSocketPool { // Called to cancel a RequestSocket call that returned ERR_IO_PENDING. The // same handle parameter must be passed to this method as was passed to the - // RequestSocket call being cancelled. The associated CompletionCallback is + // RequestSocket call being cancelled. The associated OldCompletionCallback is // not run. However, for performance, we will let one ConnectJob complete // and go idle. virtual void CancelRequest(const std::string& group_name, diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 75fd528..231254a 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -157,7 +157,7 @@ namespace internal { ClientSocketPoolBaseHelper::Request::Request( ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestPriority priority, bool ignore_limits, Flags flags, @@ -1027,7 +1027,7 @@ bool ClientSocketPoolBaseHelper::CloseOneIdleSocketExceptInGroup( } void ClientSocketPoolBaseHelper::InvokeUserCallbackLater( - ClientSocketHandle* handle, CompletionCallback* callback, int rv) { + ClientSocketHandle* handle, OldCompletionCallback* callback, int rv) { CHECK(!ContainsKey(pending_callback_map_, handle)); pending_callback_map_[handle] = CallbackResultPair(callback, rv); MessageLoop::current()->PostTask( @@ -1046,7 +1046,7 @@ void ClientSocketPoolBaseHelper::InvokeUserCallback( return; CHECK(!handle->is_initialized()); - CompletionCallback* callback = it->second.callback; + OldCompletionCallback* callback = it->second.callback; int result = it->second.result; pending_callback_map_.erase(it); callback->Run(result); diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index 3ccf5bd..864369b 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -188,7 +188,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper class NET_EXPORT_PRIVATE Request { public: Request(ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestPriority priority, bool ignore_limits, Flags flags, @@ -197,7 +197,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper virtual ~Request(); ClientSocketHandle* handle() const { return handle_; } - CompletionCallback* callback() const { return callback_; } + OldCompletionCallback* callback() const { return callback_; } RequestPriority priority() const { return priority_; } bool ignore_limits() const { return ignore_limits_; } Flags flags() const { return flags_; } @@ -205,7 +205,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper private: ClientSocketHandle* const handle_; - CompletionCallback* const callback_; + OldCompletionCallback* const callback_; const RequestPriority priority_; bool ignore_limits_; const Flags flags_; @@ -419,10 +419,10 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper struct CallbackResultPair { CallbackResultPair() : callback(NULL), result(OK) {} - CallbackResultPair(CompletionCallback* callback_in, int result_in) + CallbackResultPair(OldCompletionCallback* callback_in, int result_in) : callback(callback_in), result(result_in) {} - CompletionCallback* callback; + OldCompletionCallback* callback; int result; }; @@ -518,7 +518,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper // current message loop. Inserts |callback| into |pending_callback_map_|, // keyed by |handle|. void InvokeUserCallbackLater( - ClientSocketHandle* handle, CompletionCallback* callback, int rv); + ClientSocketHandle* handle, OldCompletionCallback* callback, int rv); // Invokes the user callback for |handle|. By the time this task has run, // it's possible that the request has been cancelled, so |handle| may not @@ -582,7 +582,7 @@ class ClientSocketPoolBase { class Request : public internal::ClientSocketPoolBaseHelper::Request { public: Request(ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestPriority priority, internal::ClientSocketPoolBaseHelper::Flags flags, bool ignore_limits, @@ -642,7 +642,7 @@ class ClientSocketPoolBase { const scoped_refptr<SocketParams>& params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log) { Request* request = new Request(handle, callback, priority, diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 6d35fe7..2be05b1 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -51,13 +51,13 @@ class MockClientSocket : public StreamSocket { // Socket methods: virtual int Read( - IOBuffer* /* buf */, int len, CompletionCallback* /* callback */) { + IOBuffer* /* buf */, int len, OldCompletionCallback* /* callback */) { num_bytes_read_ += len; return len; } virtual int Write( - IOBuffer* /* buf */, int len, CompletionCallback* /* callback */) { + IOBuffer* /* buf */, int len, OldCompletionCallback* /* callback */) { was_used_to_convey_data_ = true; return len; } @@ -66,7 +66,7 @@ class MockClientSocket : public StreamSocket { // StreamSocket methods: - virtual int Connect(CompletionCallback* callback) { + virtual int Connect(OldCompletionCallback* callback) { connected_ = true; return OK; } @@ -410,7 +410,7 @@ class TestClientSocketPool : public ClientSocketPool { const void* params, net::RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log) { const scoped_refptr<TestSocketParams>* casted_socket_params = static_cast<const scoped_refptr<TestSocketParams>*>(params); @@ -747,7 +747,7 @@ TEST_F(ClientSocketPoolBaseTest, ConnectJob_TimedOut) { TEST_F(ClientSocketPoolBaseTest, BasicSynchronous) { CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; CapturingBoundNetLog log(CapturingNetLog::kUnbounded); @@ -785,7 +785,7 @@ TEST_F(ClientSocketPoolBaseTest, InitConnectionFailure) { CapturingBoundNetLog log(CapturingNetLog::kUnbounded); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; // Set the additional error state members to ensure that they get cleared. handle.set_is_ssl_error(true); HttpResponseInfo info; @@ -1029,7 +1029,7 @@ TEST_F(ClientSocketPoolBaseTest, StallAndThenCancelAndTriggerAvailableSocket) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, @@ -1040,7 +1040,7 @@ TEST_F(ClientSocketPoolBaseTest, StallAndThenCancelAndTriggerAvailableSocket) { ClientSocketHandle handles[4]; for (size_t i = 0; i < arraysize(handles); ++i) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handles[i].Init("b", params_, @@ -1063,7 +1063,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelStalledSocketAtSocketLimit) { { ClientSocketHandle handles[kDefaultMaxSockets]; - TestCompletionCallback callbacks[kDefaultMaxSockets]; + TestOldCompletionCallback callbacks[kDefaultMaxSockets]; for (int i = 0; i < kDefaultMaxSockets; ++i) { EXPECT_EQ(OK, handles[i].Init(base::IntToString(i), params_, @@ -1075,7 +1075,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelStalledSocketAtSocketLimit) { // Force a stalled group. ClientSocketHandle stalled_handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, stalled_handle.Init("foo", params_, kDefaultPriority, @@ -1103,7 +1103,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelPendingSocketAtSocketLimit) { { ClientSocketHandle handles[kDefaultMaxSockets]; for (int i = 0; i < kDefaultMaxSockets; ++i) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handles[i].Init(base::IntToString(i), params_, kDefaultPriority, @@ -1115,7 +1115,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelPendingSocketAtSocketLimit) { // Force a stalled group. connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle stalled_handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, stalled_handle.Init("foo", params_, kDefaultPriority, @@ -1151,11 +1151,11 @@ TEST_F(ClientSocketPoolBaseTest, WaitForStalledSocketAtSocketLimit) { connect_job_factory_->set_job_type(TestConnectJob::kMockJob); ClientSocketHandle stalled_handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; { ClientSocketHandle handles[kDefaultMaxSockets]; for (int i = 0; i < kDefaultMaxSockets; ++i) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(OK, handles[i].Init(base::StringPrintf( "Take 2: %d", i), params_, @@ -1195,7 +1195,7 @@ TEST_F(ClientSocketPoolBaseTest, CloseIdleSocketAtSocketLimitDeleteGroup) { for (int i = 0; i < kDefaultMaxSockets; ++i) { ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(OK, handle.Init(base::IntToString(i), params_, kDefaultPriority, @@ -1211,7 +1211,7 @@ TEST_F(ClientSocketPoolBaseTest, CloseIdleSocketAtSocketLimitDeleteGroup) { // reuse a socket. connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; // "0" is special here, since it should be the first entry in the sorted map, // which is the one which we would close an idle socket for. We shouldn't @@ -1289,7 +1289,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelRequestClearGroup) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, kDefaultPriority, @@ -1304,7 +1304,7 @@ TEST_F(ClientSocketPoolBaseTest, ConnectCancelConnect) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, @@ -1315,7 +1315,7 @@ TEST_F(ClientSocketPoolBaseTest, ConnectCancelConnect) { handle.Reset(); - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, @@ -1395,7 +1395,7 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { MessageLoop::current()->RunAllPending(); } within_callback_ = true; - TestCompletionCallback next_job_callback; + TestOldCompletionCallback next_job_callback; scoped_refptr<TestSocketParams> params(new TestSocketParams()); int rv = handle_->Init("a", params, @@ -1440,7 +1440,7 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { bool within_callback_; TestConnectJobFactory* const test_connect_job_factory_; TestConnectJob::JobType next_job_type_; - TestCompletionCallback callback_; + TestOldCompletionCallback callback_; }; TEST_F(ClientSocketPoolBaseTest, RequestPendingJobTwice) { @@ -1536,7 +1536,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelActiveRequestThenRequestSocket) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init("a", params_, kDefaultPriority, @@ -1602,7 +1602,7 @@ TEST_F(ClientSocketPoolBaseTest, BasicAsynchronous) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; CapturingBoundNetLog log(CapturingNetLog::kUnbounded); int rv = handle.Init("a", params_, @@ -1639,7 +1639,7 @@ TEST_F(ClientSocketPoolBaseTest, connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; CapturingBoundNetLog log(CapturingNetLog::kUnbounded); // Set the additional error state members to ensure that they get cleared. handle.set_is_ssl_error(true); @@ -1677,9 +1677,9 @@ TEST_F(ClientSocketPoolBaseTest, TwoRequestsCancelOne) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", @@ -1846,7 +1846,7 @@ TEST_F(ClientSocketPoolBaseTest, LoadState) { TestConnectJob::kMockAdvancingLoadStateJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init("a", params_, kDefaultPriority, @@ -1859,7 +1859,7 @@ TEST_F(ClientSocketPoolBaseTest, LoadState) { MessageLoop::current()->RunAllPending(); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; rv = handle2.Init("a", params_, kDefaultPriority, @@ -1875,7 +1875,7 @@ TEST_F(ClientSocketPoolBaseTest, Recoverable) { connect_job_factory_->set_job_type(TestConnectJob::kMockRecoverableJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_PROXY_AUTH_REQUESTED, handle.Init("a", params_, kDefaultPriority, @@ -1891,7 +1891,7 @@ TEST_F(ClientSocketPoolBaseTest, AsyncRecoverable) { connect_job_factory_->set_job_type( TestConnectJob::kMockPendingRecoverableJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, @@ -1911,7 +1911,7 @@ TEST_F(ClientSocketPoolBaseTest, AdditionalErrorStateSynchronous) { TestConnectJob::kMockAdditionalErrorStateJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_CONNECTION_FAILED, handle.Init("a", params_, @@ -1931,7 +1931,7 @@ TEST_F(ClientSocketPoolBaseTest, AdditionalErrorStateAsynchronous) { connect_job_factory_->set_job_type( TestConnectJob::kMockPendingAdditionalErrorStateJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, @@ -1958,7 +1958,7 @@ TEST_F(ClientSocketPoolBaseTest, CleanupTimedOutIdleSockets) { // Startup two mock pending connect jobs, which will sit in the MessageLoop. ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init("a", params_, LOWEST, @@ -1969,7 +1969,7 @@ TEST_F(ClientSocketPoolBaseTest, CleanupTimedOutIdleSockets) { EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", &handle)); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; rv = handle2.Init("a", params_, LOWEST, @@ -2032,7 +2032,7 @@ TEST_F(ClientSocketPoolBaseTest, MultipleReleasingDisconnectedSockets) { // Startup 4 connect jobs. Two of them will be pending. ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init("a", params_, LOWEST, @@ -2042,7 +2042,7 @@ TEST_F(ClientSocketPoolBaseTest, MultipleReleasingDisconnectedSockets) { EXPECT_EQ(OK, rv); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; rv = handle2.Init("a", params_, LOWEST, @@ -2052,7 +2052,7 @@ TEST_F(ClientSocketPoolBaseTest, MultipleReleasingDisconnectedSockets) { EXPECT_EQ(OK, rv); ClientSocketHandle handle3; - TestCompletionCallback callback3; + TestOldCompletionCallback callback3; rv = handle3.Init("a", params_, LOWEST, @@ -2062,7 +2062,7 @@ TEST_F(ClientSocketPoolBaseTest, MultipleReleasingDisconnectedSockets) { EXPECT_EQ(ERR_IO_PENDING, rv); ClientSocketHandle handle4; - TestCompletionCallback callback4; + TestOldCompletionCallback callback4; rv = handle4.Init("a", params_, LOWEST, @@ -2098,9 +2098,9 @@ TEST_F(ClientSocketPoolBaseTest, SocketLimitReleasingSockets) { // Max out the socket limit with 2 per group. ClientSocketHandle handle_a[4]; - TestCompletionCallback callback_a[4]; + TestOldCompletionCallback callback_a[4]; ClientSocketHandle handle_b[4]; - TestCompletionCallback callback_b[4]; + TestOldCompletionCallback callback_b[4]; for (int i = 0; i < 2; ++i) { EXPECT_EQ(OK, handle_a[i].Init("a", @@ -2226,8 +2226,8 @@ class TestReleasingSocketRequest : public CallbackRunner< Tuple1<int> > { bool reset_releasing_handle_; ClientSocketHandle handle_; ClientSocketHandle handle2_; - TestCompletionCallback callback_; - TestCompletionCallback callback2_; + TestOldCompletionCallback callback_; + TestOldCompletionCallback callback2_; }; @@ -2274,7 +2274,7 @@ TEST_F(ClientSocketPoolBaseTest, CallbackThatReleasesPool) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, kDefaultPriority, @@ -2293,7 +2293,7 @@ TEST_F(ClientSocketPoolBaseTest, DoNotReuseSocketAfterFlush) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, kDefaultPriority, @@ -2352,8 +2352,8 @@ class ConnectWithinCallback : public CallbackRunner< Tuple1<int> > { const scoped_refptr<TestSocketParams> params_; TestClientSocketPool* const pool_; ClientSocketHandle handle_; - TestCompletionCallback callback_; - TestCompletionCallback nested_callback_; + TestOldCompletionCallback callback_; + TestOldCompletionCallback nested_callback_; }; TEST_F(ClientSocketPoolBaseTest, AbortAllRequestsOnFlush) { @@ -2390,7 +2390,7 @@ TEST_F(ClientSocketPoolBaseTest, BackupSocketCancelAtMaxSockets) { // timer. connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("bar", params_, kDefaultPriority, @@ -2402,7 +2402,7 @@ TEST_F(ClientSocketPoolBaseTest, BackupSocketCancelAtMaxSockets) { connect_job_factory_->set_job_type(TestConnectJob::kMockJob); ClientSocketHandle handles[kDefaultMaxSockets]; for (int i = 1; i < kDefaultMaxSockets; ++i) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(OK, handles[i].Init("bar", params_, kDefaultPriority, @@ -2432,7 +2432,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelBackupSocketAfterCancelingAllRequests) { // timer. connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("bar", params_, kDefaultPriority, @@ -2461,7 +2461,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelBackupSocketAfterFinishingAllRequests) { // timer. connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("bar", params_, kDefaultPriority, @@ -2470,7 +2470,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelBackupSocketAfterFinishingAllRequests) { BoundNetLog())); connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle2.Init("bar", params_, kDefaultPriority, @@ -2499,7 +2499,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingWaitingForConnect) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle1; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, @@ -2557,7 +2557,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtGroupCapacity) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle1; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, @@ -2617,7 +2617,7 @@ TEST_F(ClientSocketPoolBaseTest, DelayedSocketBindingAtStall) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle1; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, @@ -2680,7 +2680,7 @@ TEST_F(ClientSocketPoolBaseTest, SynchronouslyProcessOnePendingRequest) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, @@ -2694,7 +2694,7 @@ TEST_F(ClientSocketPoolBaseTest, SynchronouslyProcessOnePendingRequest) { // empty. connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; // It'll be ERR_IO_PENDING now, but the TestConnectJob will synchronously fail // when created. EXPECT_EQ(ERR_IO_PENDING, @@ -2718,7 +2718,7 @@ TEST_F(ClientSocketPoolBaseTest, PreferUsedSocketToUnusedSocket) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, kDefaultPriority, @@ -2727,7 +2727,7 @@ TEST_F(ClientSocketPoolBaseTest, PreferUsedSocketToUnusedSocket) { BoundNetLog())); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle2.Init("a", params_, kDefaultPriority, @@ -2735,7 +2735,7 @@ TEST_F(ClientSocketPoolBaseTest, PreferUsedSocketToUnusedSocket) { pool_.get(), BoundNetLog())); ClientSocketHandle handle3; - TestCompletionCallback callback3; + TestOldCompletionCallback callback3; EXPECT_EQ(ERR_IO_PENDING, handle3.Init("a", params_, kDefaultPriority, @@ -2790,7 +2790,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestSockets) { EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, kDefaultPriority, @@ -2799,7 +2799,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestSockets) { BoundNetLog())); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle2.Init("a", params_, kDefaultPriority, @@ -2824,7 +2824,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestSocketsWhenAlreadyHaveAConnectJob) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, kDefaultPriority, @@ -2842,7 +2842,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestSocketsWhenAlreadyHaveAConnectJob) { EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle2.Init("a", params_, kDefaultPriority, @@ -2868,7 +2868,7 @@ TEST_F(ClientSocketPoolBaseTest, connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, kDefaultPriority, @@ -2877,7 +2877,7 @@ TEST_F(ClientSocketPoolBaseTest, BoundNetLog())); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle2.Init("a", params_, kDefaultPriority, @@ -2886,7 +2886,7 @@ TEST_F(ClientSocketPoolBaseTest, BoundNetLog())); ClientSocketHandle handle3; - TestCompletionCallback callback3; + TestOldCompletionCallback callback3; EXPECT_EQ(ERR_IO_PENDING, handle3.Init("a", params_, kDefaultPriority, @@ -2960,7 +2960,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestSocketsCountIdleSockets) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, kDefaultPriority, @@ -2985,7 +2985,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestSocketsCountActiveSockets) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, kDefaultPriority, @@ -3056,7 +3056,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestSocketsMultipleTimesDoesNothing) { EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, kDefaultPriority, @@ -3066,7 +3066,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestSocketsMultipleTimesDoesNothing) { ASSERT_EQ(OK, callback1.WaitForResult()); ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; int rv = handle2.Init("a", params_, kDefaultPriority, @@ -3122,7 +3122,7 @@ TEST_F(ClientSocketPoolBaseTest, PreconnectJobsTakenByNormalRequests) { EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, kDefaultPriority, @@ -3152,7 +3152,7 @@ TEST_F(ClientSocketPoolBaseTest, PreconnectClosesIdleSocketRemovesGroup) { // Set up one idle socket in "a". ClientSocketHandle handle1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("a", params_, kDefaultPriority, @@ -3166,7 +3166,7 @@ TEST_F(ClientSocketPoolBaseTest, PreconnectClosesIdleSocketRemovesGroup) { // Set up two active sockets in "b". ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle1.Init("b", params_, kDefaultPriority, @@ -3251,7 +3251,7 @@ TEST_F(ClientSocketPoolBaseTest, PreconnectWithBackupJob) { // Make the backup job be a pending job, so it completes normally. connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, kDefaultPriority, diff --git a/net/socket/client_socket_pool_manager.cc b/net/socket/client_socket_pool_manager.cc index ec9e2f4..f4b642c 100644 --- a/net/socket/client_socket_pool_manager.cc +++ b/net/socket/client_socket_pool_manager.cc @@ -72,7 +72,7 @@ int InitSocketPoolHelper(const GURL& request_url, const BoundNetLog& net_log, int num_preconnect_streams, ClientSocketHandle* socket_handle, - CompletionCallback* callback) { + OldCompletionCallback* callback) { scoped_refptr<TransportSocketParams> tcp_params; scoped_refptr<HttpProxySocketParams> http_proxy_params; scoped_refptr<SOCKSSocketParams> socks_params; @@ -635,7 +635,7 @@ int ClientSocketPoolManager::InitSocketHandleForHttpRequest( const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, ClientSocketHandle* socket_handle, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(socket_handle); return InitSocketPoolHelper(request_url, request_extra_headers, @@ -663,7 +663,7 @@ int ClientSocketPoolManager::InitSocketHandleForRawConnect( const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, ClientSocketHandle* socket_handle, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(socket_handle); // Synthesize an HttpRequestInfo. GURL request_url = GURL("http://" + host_port_pair.ToString()); diff --git a/net/socket/client_socket_pool_manager.h b/net/socket/client_socket_pool_manager.h index ac4aeea..29393b4 100644 --- a/net/socket/client_socket_pool_manager.h +++ b/net/socket/client_socket_pool_manager.h @@ -131,7 +131,7 @@ class ClientSocketPoolManager : public base::NonThreadSafe, const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, ClientSocketHandle* socket_handle, - CompletionCallback* callback); + OldCompletionCallback* callback); // A helper method that uses the passed in proxy information to initialize a // ClientSocketHandle with the relevant socket pool. Use this method for @@ -145,7 +145,7 @@ class ClientSocketPoolManager : public base::NonThreadSafe, const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, ClientSocketHandle* socket_handle, - CompletionCallback* callback); + OldCompletionCallback* callback); // Similar to InitSocketHandleForHttpRequest except that it initiates the // desired number of preconnect streams from the relevant socket pool. diff --git a/net/socket/deterministic_socket_data_unittest.cc b/net/socket/deterministic_socket_data_unittest.cc index 6261d39..6d8d7e4 100644 --- a/net/socket/deterministic_socket_data_unittest.cc +++ b/net/socket/deterministic_socket_data_unittest.cc @@ -41,8 +41,8 @@ class DeterministicSocketDataTest : public PlatformTest { void AssertAsyncWriteEquals(const char* data, int len); void AssertWriteReturns(const char* data, int len, int rv); - TestCompletionCallback read_callback_; - TestCompletionCallback write_callback_; + TestOldCompletionCallback read_callback_; + TestOldCompletionCallback write_callback_; StreamSocket* sock_; scoped_refptr<DeterministicSocketData> data_; diff --git a/net/socket/dns_cert_provenance_checker.cc b/net/socket/dns_cert_provenance_checker.cc index 5ab0631..38e6bbd 100644 --- a/net/socket/dns_cert_provenance_checker.cc +++ b/net/socket/dns_cert_provenance_checker.cc @@ -200,7 +200,7 @@ class DnsCertProvenanceCheck : public base::NonThreadSafe { std::vector<std::string> der_certs_; RRResponse response_; DnsRRResolver::Handle handle_; - CompletionCallbackImpl<DnsCertProvenanceCheck> callback_; + OldCompletionCallbackImpl<DnsCertProvenanceCheck> callback_; }; SECKEYPublicKey* GetServerPubKey() { diff --git a/net/socket/server_socket.h b/net/socket/server_socket.h index c3e1e8a..5931cf5 100644 --- a/net/socket/server_socket.h +++ b/net/socket/server_socket.h @@ -29,7 +29,7 @@ class NET_EXPORT ServerSocket { // Accept connection. Callback is called when new connection is // accepted. virtual int Accept(scoped_ptr<StreamSocket>* socket, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; private: DISALLOW_COPY_AND_ASSIGN(ServerSocket); diff --git a/net/socket/socket.h b/net/socket/socket.h index 650bfd6..90185a2 100644 --- a/net/socket/socket.h +++ b/net/socket/socket.h @@ -30,7 +30,7 @@ class NET_EXPORT Socket { // closed. If the socket is Disconnected before the read completes, the // callback will not be invoked. virtual int Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; // Writes data, up to |buf_len| bytes, to the socket. Note: data may be // written partially. The number of bytes written is returned, or an error @@ -45,7 +45,7 @@ class NET_EXPORT Socket { // of the actual buffer that is written to the socket. If the socket is // Disconnected before the write completes, the callback will not be invoked. virtual int Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; // Set the receive buffer size (in bytes) for the socket. // Note: changing this value can affect the TCP window size on some platforms. diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index ce64bdc..b815a9f 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -695,14 +695,14 @@ MockClientSocket::GetNextProto(std::string* proto) { MockClientSocket::~MockClientSocket() {} -void MockClientSocket::RunCallbackAsync(net::CompletionCallback* callback, +void MockClientSocket::RunCallbackAsync(net::OldCompletionCallback* callback, int result) { MessageLoop::current()->PostTask(FROM_HERE, method_factory_.NewRunnableMethod( &MockClientSocket::RunCallback, callback, result)); } -void MockClientSocket::RunCallback(net::CompletionCallback* callback, +void MockClientSocket::RunCallback(net::OldCompletionCallback* callback, int result) { if (callback) callback->Run(result); @@ -728,7 +728,7 @@ MockTCPClientSocket::MockTCPClientSocket(const net::AddressList& addresses, } int MockTCPClientSocket::Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { if (!connected_) return net::ERR_UNEXPECTED; @@ -761,7 +761,7 @@ int MockTCPClientSocket::Read(net::IOBuffer* buf, int buf_len, } int MockTCPClientSocket::Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { DCHECK(buf); DCHECK_GT(buf_len, 0); @@ -781,7 +781,7 @@ int MockTCPClientSocket::Write(net::IOBuffer* buf, int buf_len, return write_result.result; } -int MockTCPClientSocket::Connect(net::CompletionCallback* callback) { +int MockTCPClientSocket::Connect(net::OldCompletionCallback* callback) { if (connected_) return net::OK; connected_ = true; @@ -846,7 +846,7 @@ void MockTCPClientSocket::OnReadComplete(const MockRead& data) { // let CompleteRead() schedule a callback. read_data_.async = false; - net::CompletionCallback* callback = pending_callback_; + net::OldCompletionCallback* callback = pending_callback_; int rv = CompleteRead(); RunCallback(callback, rv); } @@ -860,7 +860,7 @@ int MockTCPClientSocket::CompleteRead() { // Save the pending async IO data and reset our |pending_| state. net::IOBuffer* buf = pending_buf_; int buf_len = pending_buf_len_; - net::CompletionCallback* callback = pending_callback_; + net::OldCompletionCallback* callback = pending_callback_; pending_buf_ = NULL; pending_buf_len_ = 0; pending_callback_ = NULL; @@ -942,7 +942,7 @@ int DeterministicMockTCPClientSocket::CompleteRead() { } int DeterministicMockTCPClientSocket::Write( - net::IOBuffer* buf, int buf_len, net::CompletionCallback* callback) { + net::IOBuffer* buf, int buf_len, net::OldCompletionCallback* callback) { DCHECK(buf); DCHECK_GT(buf_len, 0); @@ -966,7 +966,7 @@ int DeterministicMockTCPClientSocket::Write( } int DeterministicMockTCPClientSocket::Read( - net::IOBuffer* buf, int buf_len, net::CompletionCallback* callback) { + net::IOBuffer* buf, int buf_len, net::OldCompletionCallback* callback) { if (!connected_) return net::ERR_UNEXPECTED; @@ -991,7 +991,7 @@ int DeterministicMockTCPClientSocket::Read( // TODO(erikchen): Support connect sequencing. int DeterministicMockTCPClientSocket::Connect( - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { if (connected_) return net::OK; connected_ = true; @@ -1033,13 +1033,13 @@ base::TimeDelta DeterministicMockTCPClientSocket::GetConnectTimeMicros() const { void DeterministicMockTCPClientSocket::OnReadComplete(const MockRead& data) {} class MockSSLClientSocket::ConnectCallback - : public net::CompletionCallbackImpl<MockSSLClientSocket::ConnectCallback> { + : public net::OldCompletionCallbackImpl<MockSSLClientSocket::ConnectCallback> { public: ConnectCallback(MockSSLClientSocket *ssl_client_socket, - net::CompletionCallback* user_callback, + net::OldCompletionCallback* user_callback, int rv) : ALLOW_THIS_IN_INITIALIZER_LIST( - net::CompletionCallbackImpl<MockSSLClientSocket::ConnectCallback>( + net::OldCompletionCallbackImpl<MockSSLClientSocket::ConnectCallback>( this, &ConnectCallback::Wrapper)), ssl_client_socket_(ssl_client_socket), user_callback_(user_callback), @@ -1055,7 +1055,7 @@ class MockSSLClientSocket::ConnectCallback } MockSSLClientSocket* ssl_client_socket_; - net::CompletionCallback* user_callback_; + net::OldCompletionCallback* user_callback_; int rv_; }; @@ -1079,16 +1079,16 @@ MockSSLClientSocket::~MockSSLClientSocket() { } int MockSSLClientSocket::Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { return transport_->socket()->Read(buf, buf_len, callback); } int MockSSLClientSocket::Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { return transport_->socket()->Write(buf, buf_len, callback); } -int MockSSLClientSocket::Connect(net::CompletionCallback* callback) { +int MockSSLClientSocket::Connect(net::OldCompletionCallback* callback) { ConnectCallback* connect_callback = new ConnectCallback( this, callback, data_->connect.result); int rv = transport_->socket()->Connect(connect_callback); @@ -1188,7 +1188,7 @@ MockUDPClientSocket::MockUDPClientSocket(SocketDataProvider* data, MockUDPClientSocket::~MockUDPClientSocket() {} int MockUDPClientSocket::Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { if (!connected_) return net::ERR_UNEXPECTED; @@ -1215,7 +1215,7 @@ int MockUDPClientSocket::Read(net::IOBuffer* buf, int buf_len, } int MockUDPClientSocket::Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { DCHECK(buf); DCHECK_GT(buf_len, 0); @@ -1278,7 +1278,7 @@ void MockUDPClientSocket::OnReadComplete(const MockRead& data) { // let CompleteRead() schedule a callback. read_data_.async = false; - net::CompletionCallback* callback = pending_callback_; + net::OldCompletionCallback* callback = pending_callback_; int rv = CompleteRead(); RunCallback(callback, rv); } @@ -1290,7 +1290,7 @@ int MockUDPClientSocket::CompleteRead() { // Save the pending async IO data and reset our |pending_| state. net::IOBuffer* buf = pending_buf_; int buf_len = pending_buf_len_; - net::CompletionCallback* callback = pending_callback_; + net::OldCompletionCallback* callback = pending_callback_; pending_buf_ = NULL; pending_buf_len_ = 0; pending_callback_ = NULL; @@ -1320,14 +1320,14 @@ int MockUDPClientSocket::CompleteRead() { return result; } -void MockUDPClientSocket::RunCallbackAsync(net::CompletionCallback* callback, +void MockUDPClientSocket::RunCallbackAsync(net::OldCompletionCallback* callback, int result) { MessageLoop::current()->PostTask(FROM_HERE, method_factory_.NewRunnableMethod( &MockUDPClientSocket::RunCallback, callback, result)); } -void MockUDPClientSocket::RunCallback(net::CompletionCallback* callback, +void MockUDPClientSocket::RunCallback(net::OldCompletionCallback* callback, int result) { if (callback) callback->Run(result); @@ -1400,7 +1400,7 @@ void ClientSocketPoolTest::ReleaseAllConnections(KeepAlive keep_alive) { MockTransportClientSocketPool::MockConnectJob::MockConnectJob( StreamSocket* socket, ClientSocketHandle* handle, - CompletionCallback* callback) + OldCompletionCallback* callback) : socket_(socket), handle_(handle), user_callback_(callback), @@ -1441,7 +1441,7 @@ void MockTransportClientSocketPool::MockConnectJob::OnConnect(int rv) { handle_ = NULL; if (user_callback_) { - CompletionCallback* callback = user_callback_; + OldCompletionCallback* callback = user_callback_; user_callback_ = NULL; callback->Run(rv); } @@ -1465,7 +1465,7 @@ int MockTransportClientSocketPool::RequestSocket(const std::string& group_name, const void* socket_params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log) { StreamSocket* socket = client_socket_factory_->CreateTransportClientSocket( AddressList(), net_log.net_log(), net::NetLog::Source()); @@ -1572,7 +1572,7 @@ int MockSOCKSClientSocketPool::RequestSocket(const std::string& group_name, const void* socket_params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log) { return transport_pool_->RequestSocket(group_name, socket_params, diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 6b7cc5c..7e69da8 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -342,7 +342,7 @@ class OrderedSocketData : public StaticSocketDataProvider, MockRead* reads, size_t reads_count, MockWrite* writes, size_t writes_count); - void SetCompletionCallback(CompletionCallback* callback) { + void SetOldCompletionCallback(OldCompletionCallback* callback) { callback_ = callback; } @@ -361,7 +361,7 @@ class OrderedSocketData : public StaticSocketDataProvider, int sequence_number_; int loop_stop_stage_; - CompletionCallback* callback_; + OldCompletionCallback* callback_; bool blocked_; ScopedRunnableMethodFactory<OrderedSocketData> factory_; }; @@ -584,14 +584,14 @@ class MockClientSocket : public net::SSLClientSocket { // Socket methods: virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) = 0; + net::OldCompletionCallback* callback) = 0; virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) = 0; + net::OldCompletionCallback* callback) = 0; virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); // StreamSocket methods: - virtual int Connect(net::CompletionCallback* callback) = 0; + virtual int Connect(net::OldCompletionCallback* callback) = 0; virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -613,8 +613,8 @@ class MockClientSocket : public net::SSLClientSocket { protected: virtual ~MockClientSocket(); - void RunCallbackAsync(net::CompletionCallback* callback, int result); - void RunCallback(net::CompletionCallback*, int result); + void RunCallbackAsync(net::OldCompletionCallback* callback, int result); + void RunCallback(net::OldCompletionCallback*, int result); ScopedRunnableMethodFactory<MockClientSocket> method_factory_; @@ -633,12 +633,12 @@ class MockTCPClientSocket : public MockClientSocket, public AsyncSocket { // Socket methods: virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); // StreamSocket methods: - virtual int Connect(net::CompletionCallback* callback); + virtual int Connect(net::OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -670,7 +670,7 @@ class MockTCPClientSocket : public MockClientSocket, public AsyncSocket { // While an asynchronous IO is pending, we save our user-buffer state. net::IOBuffer* pending_buf_; int pending_buf_len_; - net::CompletionCallback* pending_callback_; + net::OldCompletionCallback* pending_callback_; bool was_used_to_convey_data_; }; @@ -690,12 +690,12 @@ class DeterministicMockTCPClientSocket : public MockClientSocket, // Socket: virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); // StreamSocket: - virtual int Connect(net::CompletionCallback* callback); + virtual int Connect(net::OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -709,7 +709,7 @@ class DeterministicMockTCPClientSocket : public MockClientSocket, private: bool write_pending_; - net::CompletionCallback* write_callback_; + net::OldCompletionCallback* write_callback_; int write_result_; net::MockRead read_data_; @@ -717,7 +717,7 @@ class DeterministicMockTCPClientSocket : public MockClientSocket, net::IOBuffer* read_buf_; int read_buf_len_; bool read_pending_; - net::CompletionCallback* read_callback_; + net::OldCompletionCallback* read_callback_; net::DeterministicSocketData* data_; bool was_used_to_convey_data_; }; @@ -734,12 +734,12 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket { // Socket methods: virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); // StreamSocket methods: - virtual int Connect(net::CompletionCallback* callback); + virtual int Connect(net::OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool WasEverUsed() const; @@ -776,9 +776,9 @@ class MockUDPClientSocket : public DatagramClientSocket, // Socket interface virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -797,8 +797,8 @@ class MockUDPClientSocket : public DatagramClientSocket, private: int CompleteRead(); - void RunCallbackAsync(net::CompletionCallback* callback, int result); - void RunCallback(net::CompletionCallback* callback, int result); + void RunCallbackAsync(net::OldCompletionCallback* callback, int result); + void RunCallback(net::OldCompletionCallback* callback, int result); bool connected_; SocketDataProvider* data_; @@ -809,7 +809,7 @@ class MockUDPClientSocket : public DatagramClientSocket, // While an asynchronous IO is pending, we save our user-buffer state. net::IOBuffer* pending_buf_; int pending_buf_len_; - net::CompletionCallback* pending_callback_; + net::OldCompletionCallback* pending_callback_; BoundNetLog net_log_; @@ -834,7 +834,7 @@ class TestSocketRequest : public CallbackRunner< Tuple1<int> > { ClientSocketHandle handle_; std::vector<TestSocketRequest*>* request_order_; size_t* completion_count_; - TestCompletionCallback callback_; + TestOldCompletionCallback callback_; }; class ClientSocketPoolTest { @@ -898,7 +898,7 @@ class MockTransportClientSocketPool : public TransportClientSocketPool { class MockConnectJob { public: MockConnectJob(StreamSocket* socket, ClientSocketHandle* handle, - CompletionCallback* callback); + OldCompletionCallback* callback); ~MockConnectJob(); int Connect(); @@ -909,8 +909,8 @@ class MockTransportClientSocketPool : public TransportClientSocketPool { scoped_ptr<StreamSocket> socket_; ClientSocketHandle* handle_; - CompletionCallback* user_callback_; - CompletionCallbackImpl<MockConnectJob> connect_callback_; + OldCompletionCallback* user_callback_; + OldCompletionCallbackImpl<MockConnectJob> connect_callback_; DISALLOW_COPY_AND_ASSIGN(MockConnectJob); }; @@ -931,7 +931,7 @@ class MockTransportClientSocketPool : public TransportClientSocketPool { const void* socket_params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log); virtual void CancelRequest(const std::string& group_name, @@ -1010,7 +1010,7 @@ class MockSOCKSClientSocketPool : public SOCKSClientSocketPool { const void* socket_params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log); virtual void CancelRequest(const std::string& group_name, diff --git a/net/socket/socks5_client_socket.cc b/net/socket/socks5_client_socket.cc index 2f5cee4..f106f70 100644 --- a/net/socket/socks5_client_socket.cc +++ b/net/socket/socks5_client_socket.cc @@ -64,7 +64,7 @@ SOCKS5ClientSocket::~SOCKS5ClientSocket() { Disconnect(); } -int SOCKS5ClientSocket::Connect(CompletionCallback* callback) { +int SOCKS5ClientSocket::Connect(OldCompletionCallback* callback) { DCHECK(transport_.get()); DCHECK(transport_->socket()); DCHECK_EQ(STATE_NONE, next_state_); @@ -161,7 +161,7 @@ base::TimeDelta SOCKS5ClientSocket::GetConnectTimeMicros() const { // Read is called by the transport layer above to read. This can only be done // if the SOCKS handshake is complete. int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(completed_handshake_); DCHECK_EQ(STATE_NONE, next_state_); DCHECK(!user_callback_); @@ -172,7 +172,7 @@ int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, // Write is called by the transport layer. This can only be done if the // SOCKS handshake is complete. int SOCKS5ClientSocket::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(completed_handshake_); DCHECK_EQ(STATE_NONE, next_state_); DCHECK(!user_callback_); @@ -194,7 +194,7 @@ void SOCKS5ClientSocket::DoCallback(int result) { // Since Run() may result in Read being called, // clear user_callback_ up front. - CompletionCallback* c = user_callback_; + OldCompletionCallback* c = user_callback_; user_callback_ = NULL; c->Run(result); } diff --git a/net/socket/socks5_client_socket.h b/net/socket/socks5_client_socket.h index 97fa61a..03b17f2 100644 --- a/net/socket/socks5_client_socket.h +++ b/net/socket/socks5_client_socket.h @@ -51,7 +51,7 @@ class NET_EXPORT_PRIVATE SOCKS5ClientSocket : public StreamSocket { // StreamSocket methods: // Does the SOCKS handshake and completes the protocol. - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -64,8 +64,8 @@ class NET_EXPORT_PRIVATE SOCKS5ClientSocket : public StreamSocket { virtual base::TimeDelta GetConnectTimeMicros() const; // Socket methods: - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -117,7 +117,7 @@ class NET_EXPORT_PRIVATE SOCKS5ClientSocket : public StreamSocket { // and return OK on success. int BuildHandshakeWriteBuffer(std::string* handshake) const; - CompletionCallbackImpl<SOCKS5ClientSocket> io_callback_; + OldCompletionCallbackImpl<SOCKS5ClientSocket> io_callback_; // Stores the underlying socket. scoped_ptr<ClientSocketHandle> transport_; @@ -125,7 +125,7 @@ class NET_EXPORT_PRIVATE SOCKS5ClientSocket : public StreamSocket { State next_state_; // Stores the callback to the layer above, called on completing Connect(). - CompletionCallback* user_callback_; + OldCompletionCallback* user_callback_; // This IOBuffer is used by the class to read and write // SOCKS handshake data. The length contains the expected size to diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc index 68125de..9cd45db 100644 --- a/net/socket/socks5_client_socket_unittest.cc +++ b/net/socket/socks5_client_socket_unittest.cc @@ -47,7 +47,7 @@ class SOCKS5ClientSocketTest : public PlatformTest { scoped_ptr<SOCKS5ClientSocket> user_sock_; AddressList address_list_; StreamSocket* tcp_sock_; - TestCompletionCallback callback_; + TestOldCompletionCallback callback_; scoped_ptr<MockHostResolver> host_resolver_; scoped_ptr<SocketDataProvider> data_; @@ -67,7 +67,7 @@ void SOCKS5ClientSocketTest::SetUp() { // Resolve the "localhost" AddressList used by the TCP connection to connect. HostResolver::RequestInfo info(HostPortPair("www.socks-proxy.com", 1080)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = host_resolver_->Resolve(info, &address_list_, &callback, NULL, BoundNetLog()); ASSERT_EQ(ERR_IO_PENDING, rv); @@ -83,7 +83,7 @@ SOCKS5ClientSocket* SOCKS5ClientSocketTest::BuildMockSocket( const std::string& hostname, int port, NetLog* net_log) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; data_.reset(new StaticSocketDataProvider(reads, reads_count, writes, writes_count)); tcp_sock_ = new MockTCPClientSocket(address_list_, net_log, data_.get()); @@ -221,7 +221,7 @@ TEST_F(SOCKS5ClientSocketTest, LargeHostNameFails) { // Try to connect -- should fail (without having read/written anything to // the transport socket first) because the hostname is too long. - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = user_sock_->Connect(&callback); EXPECT_EQ(ERR_SOCKS_CONNECTION_FAILED, rv); } diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc index 4a45b01..d05f1f9 100644 --- a/net/socket/socks_client_socket.cc +++ b/net/socket/socks_client_socket.cc @@ -91,7 +91,7 @@ SOCKSClientSocket::~SOCKSClientSocket() { Disconnect(); } -int SOCKSClientSocket::Connect(CompletionCallback* callback) { +int SOCKSClientSocket::Connect(OldCompletionCallback* callback) { DCHECK(transport_.get()); DCHECK(transport_->socket()); DCHECK_EQ(STATE_NONE, next_state_); @@ -189,7 +189,7 @@ base::TimeDelta SOCKSClientSocket::GetConnectTimeMicros() const { // Read is called by the transport layer above to read. This can only be done // if the SOCKS handshake is complete. int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(completed_handshake_); DCHECK_EQ(STATE_NONE, next_state_); DCHECK(!user_callback_); @@ -200,7 +200,7 @@ int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, // Write is called by the transport layer. This can only be done if the // SOCKS handshake is complete. int SOCKSClientSocket::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(completed_handshake_); DCHECK_EQ(STATE_NONE, next_state_); DCHECK(!user_callback_); @@ -222,7 +222,7 @@ void SOCKSClientSocket::DoCallback(int result) { // Since Run() may result in Read being called, // clear user_callback_ up front. - CompletionCallback* c = user_callback_; + OldCompletionCallback* c = user_callback_; user_callback_ = NULL; DVLOG(1) << "Finished setting up SOCKS handshake"; c->Run(result); diff --git a/net/socket/socks_client_socket.h b/net/socket/socks_client_socket.h index f7929b5..a7aff1c 100644 --- a/net/socket/socks_client_socket.h +++ b/net/socket/socks_client_socket.h @@ -49,7 +49,7 @@ class NET_EXPORT_PRIVATE SOCKSClientSocket : public StreamSocket { // StreamSocket methods: // Does the SOCKS handshake and completes the protocol. - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -62,8 +62,8 @@ class NET_EXPORT_PRIVATE SOCKSClientSocket : public StreamSocket { virtual base::TimeDelta GetConnectTimeMicros() const; // Socket methods: - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -99,7 +99,7 @@ class NET_EXPORT_PRIVATE SOCKSClientSocket : public StreamSocket { const std::string BuildHandshakeWriteBuffer() const; - CompletionCallbackImpl<SOCKSClientSocket> io_callback_; + OldCompletionCallbackImpl<SOCKSClientSocket> io_callback_; // Stores the underlying socket. scoped_ptr<ClientSocketHandle> transport_; @@ -107,7 +107,7 @@ class NET_EXPORT_PRIVATE SOCKSClientSocket : public StreamSocket { State next_state_; // Stores the callback to the layer above, called on completing Connect(). - CompletionCallback* user_callback_; + OldCompletionCallback* user_callback_; // This IOBuffer is used by the class to read and write // SOCKS handshake data. The length contains the expected size to diff --git a/net/socket/socks_client_socket_pool.cc b/net/socket/socks_client_socket_pool.cc index 7b18426..c80bb66 100644 --- a/net/socket/socks_client_socket_pool.cc +++ b/net/socket/socks_client_socket_pool.cc @@ -213,7 +213,7 @@ int SOCKSClientSocketPool::RequestSocket(const std::string& group_name, const void* socket_params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log) { const scoped_refptr<SOCKSSocketParams>* casted_socket_params = static_cast<const scoped_refptr<SOCKSSocketParams>*>(socket_params); diff --git a/net/socket/socks_client_socket_pool.h b/net/socket/socks_client_socket_pool.h index 56b4848..11dbd33 100644 --- a/net/socket/socks_client_socket_pool.h +++ b/net/socket/socks_client_socket_pool.h @@ -98,7 +98,7 @@ class SOCKSConnectJob : public ConnectJob { HostResolver* const resolver_; State next_state_; - CompletionCallbackImpl<SOCKSConnectJob> callback_; + OldCompletionCallbackImpl<SOCKSConnectJob> callback_; scoped_ptr<ClientSocketHandle> transport_socket_handle_; scoped_ptr<StreamSocket> socket_; @@ -122,7 +122,7 @@ class NET_EXPORT_PRIVATE SOCKSClientSocketPool : public ClientSocketPool { const void* connect_params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log); virtual void RequestSockets(const std::string& group_name, diff --git a/net/socket/socks_client_socket_pool_unittest.cc b/net/socket/socks_client_socket_pool_unittest.cc index 431a009..b3658c9 100644 --- a/net/socket/socks_client_socket_pool_unittest.cc +++ b/net/socket/socks_client_socket_pool_unittest.cc @@ -112,7 +112,7 @@ TEST_F(SOCKSClientSocketPoolTest, Async) { SOCKS5MockData data(true); transport_client_socket_factory_.AddSocketDataProvider(data.data_provider()); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("a", ignored_socket_params_, LOW, &callback, &pool_, BoundNetLog()); @@ -143,7 +143,7 @@ TEST_F(SOCKSClientSocketPoolTest, AsyncTransportConnectError) { socket_data->set_connect_data(MockConnect(true, ERR_CONNECTION_REFUSED)); transport_client_socket_factory_.AddSocketDataProvider(socket_data.get()); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("a", ignored_socket_params_, LOW, &callback, &pool_, BoundNetLog()); @@ -184,7 +184,7 @@ TEST_F(SOCKSClientSocketPoolTest, AsyncSOCKSConnectError) { socket_data->set_connect_data(MockConnect(false, 0)); transport_client_socket_factory_.AddSocketDataProvider(socket_data.get()); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; EXPECT_EQ(0, transport_socket_pool_.release_count()); int rv = handle.Init("a", ignored_socket_params_, LOW, &callback, &pool_, diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc index 437d657..ce80719 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc @@ -38,7 +38,7 @@ class SOCKSClientSocketTest : public PlatformTest { scoped_ptr<SOCKSClientSocket> user_sock_; AddressList address_list_; StreamSocket* tcp_sock_; - TestCompletionCallback callback_; + TestOldCompletionCallback callback_; scoped_ptr<MockHostResolver> host_resolver_; scoped_ptr<SocketDataProvider> data_; }; @@ -62,7 +62,7 @@ SOCKSClientSocket* SOCKSClientSocketTest::BuildMockSocket( int port, NetLog* net_log) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; data_.reset(new StaticSocketDataProvider(reads, reads_count, writes, writes_count)); tcp_sock_ = new MockTCPClientSocket(address_list_, net_log, data_.get()); @@ -87,7 +87,7 @@ class HangingHostResolver : public HostResolver { virtual int Resolve(const RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req, const BoundNetLog& net_log) OVERRIDE { DCHECK(addresses); diff --git a/net/socket/ssl_client_socket.h b/net/socket/ssl_client_socket.h index 46865f7..104cca3 100644 --- a/net/socket/ssl_client_socket.h +++ b/net/socket/ssl_client_socket.h @@ -39,7 +39,7 @@ class DNSSECProvider { // some point in the future. Once the callback has been made, this // function will return OK if called again. virtual int GetDNSSECRecords(RRResponse** out, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; private: ~DNSSECProvider() {} diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc index bd13772..97527b8 100644 --- a/net/socket/ssl_client_socket_mac.cc +++ b/net/socket/ssl_client_socket_mac.cc @@ -554,7 +554,7 @@ SSLClientSocketMac::~SSLClientSocketMac() { Disconnect(); } -int SSLClientSocketMac::Connect(CompletionCallback* callback) { +int SSLClientSocketMac::Connect(OldCompletionCallback* callback) { DCHECK(transport_.get()); DCHECK(next_handshake_state_ == STATE_NONE); DCHECK(!user_connect_callback_); @@ -675,7 +675,7 @@ base::TimeDelta SSLClientSocketMac::GetConnectTimeMicros() const { } int SSLClientSocketMac::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(completed_handshake()); DCHECK(!user_read_callback_); DCHECK(!user_read_buf_); @@ -694,7 +694,7 @@ int SSLClientSocketMac::Read(IOBuffer* buf, int buf_len, } int SSLClientSocketMac::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(completed_handshake()); DCHECK(!user_write_callback_); DCHECK(!user_write_buf_); @@ -893,7 +893,7 @@ void SSLClientSocketMac::DoConnectCallback(int rv) { DCHECK(rv != ERR_IO_PENDING); DCHECK(user_connect_callback_); - CompletionCallback* c = user_connect_callback_; + OldCompletionCallback* c = user_connect_callback_; user_connect_callback_ = NULL; c->Run(rv > OK ? OK : rv); } @@ -904,7 +904,7 @@ void SSLClientSocketMac::DoReadCallback(int rv) { // Since Run may result in Read being called, clear user_read_callback_ up // front. - CompletionCallback* c = user_read_callback_; + OldCompletionCallback* c = user_read_callback_; user_read_callback_ = NULL; user_read_buf_ = NULL; user_read_buf_len_ = 0; @@ -917,7 +917,7 @@ void SSLClientSocketMac::DoWriteCallback(int rv) { // Since Run may result in Write being called, clear user_write_callback_ up // front. - CompletionCallback* c = user_write_callback_; + OldCompletionCallback* c = user_write_callback_; user_write_callback_ = NULL; user_write_buf_ = NULL; user_write_buf_len_ = 0; diff --git a/net/socket/ssl_client_socket_mac.h b/net/socket/ssl_client_socket_mac.h index 2a3418e..2f3b1e3 100644 --- a/net/socket/ssl_client_socket_mac.h +++ b/net/socket/ssl_client_socket_mac.h @@ -50,7 +50,7 @@ class SSLClientSocketMac : public SSLClientSocket { virtual NextProtoStatus GetNextProto(std::string* proto); // StreamSocket methods: - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -65,8 +65,8 @@ class SSLClientSocketMac : public SSLClientSocket { virtual base::TimeDelta GetConnectTimeMicros() const; // Socket methods: - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -105,17 +105,17 @@ class SSLClientSocketMac : public SSLClientSocket { const void* data, size_t* data_length); - CompletionCallbackImpl<SSLClientSocketMac> handshake_io_callback_; - CompletionCallbackImpl<SSLClientSocketMac> transport_read_callback_; - CompletionCallbackImpl<SSLClientSocketMac> transport_write_callback_; + OldCompletionCallbackImpl<SSLClientSocketMac> handshake_io_callback_; + OldCompletionCallbackImpl<SSLClientSocketMac> transport_read_callback_; + OldCompletionCallbackImpl<SSLClientSocketMac> transport_write_callback_; scoped_ptr<ClientSocketHandle> transport_; HostPortPair host_and_port_; SSLConfig ssl_config_; - CompletionCallback* user_connect_callback_; - CompletionCallback* user_read_callback_; - CompletionCallback* user_write_callback_; + OldCompletionCallback* user_connect_callback_; + OldCompletionCallback* user_read_callback_; + OldCompletionCallback* user_write_callback_; // Used by Read function. scoped_refptr<IOBuffer> user_read_buf_; diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index 74b031b..79fd69a 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc @@ -586,7 +586,7 @@ SSLClientSocketNSS::GetNextProto(std::string* proto) { #endif } -int SSLClientSocketNSS::Connect(CompletionCallback* callback) { +int SSLClientSocketNSS::Connect(OldCompletionCallback* callback) { EnterFunction(""); DCHECK(transport_.get()); DCHECK(next_handshake_state_ == STATE_NONE); @@ -776,7 +776,7 @@ base::TimeDelta SSLClientSocketNSS::GetConnectTimeMicros() const { } int SSLClientSocketNSS::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { EnterFunction(buf_len); DCHECK(completed_handshake_); DCHECK(next_handshake_state_ == STATE_NONE); @@ -801,7 +801,7 @@ int SSLClientSocketNSS::Read(IOBuffer* buf, int buf_len, } int SSLClientSocketNSS::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { EnterFunction(buf_len); DCHECK(completed_handshake_); DCHECK(next_handshake_state_ == STATE_NONE); @@ -1157,7 +1157,7 @@ void SSLClientSocketNSS::DoReadCallback(int rv) { // Since Run may result in Read being called, clear |user_read_callback_| // up front. - CompletionCallback* c = user_read_callback_; + OldCompletionCallback* c = user_read_callback_; user_read_callback_ = NULL; user_read_buf_ = NULL; user_read_buf_len_ = 0; @@ -1172,7 +1172,7 @@ void SSLClientSocketNSS::DoWriteCallback(int rv) { // Since Run may result in Write being called, clear |user_write_callback_| // up front. - CompletionCallback* c = user_write_callback_; + OldCompletionCallback* c = user_write_callback_; user_write_callback_ = NULL; user_write_buf_ = NULL; user_write_buf_len_ = 0; @@ -1192,7 +1192,7 @@ void SSLClientSocketNSS::DoConnectCallback(int rv) { DCHECK_NE(rv, ERR_IO_PENDING); DCHECK(user_connect_callback_); - CompletionCallback* c = user_connect_callback_; + OldCompletionCallback* c = user_connect_callback_; user_connect_callback_ = NULL; c->Run(rv > OK ? OK : rv); LeaveFunction(""); diff --git a/net/socket/ssl_client_socket_nss.h b/net/socket/ssl_client_socket_nss.h index 6d403f7..4cc681a 100644 --- a/net/socket/ssl_client_socket_nss.h +++ b/net/socket/ssl_client_socket_nss.h @@ -69,7 +69,7 @@ class SSLClientSocketNSS : public SSLClientSocket { virtual NextProtoStatus GetNextProto(std::string* proto); // StreamSocket methods: - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -84,8 +84,8 @@ class SSLClientSocketNSS : public SSLClientSocket { virtual base::TimeDelta GetConnectTimeMicros() const; // Socket methods: - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -193,8 +193,8 @@ class SSLClientSocketNSS : public SSLClientSocket { void EnsureThreadIdAssigned() const; bool CalledOnValidThread() const; - CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_; - CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_; + OldCompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_; + OldCompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_; bool transport_send_busy_; bool transport_recv_busy_; // corked_ is true if we are currently suspending writes to the network. This @@ -205,14 +205,14 @@ class SSLClientSocketNSS : public SSLClientSocket { base::OneShotTimer<SSLClientSocketNSS> uncork_timer_; scoped_refptr<IOBuffer> recv_buffer_; - CompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_; + OldCompletionCallbackImpl<SSLClientSocketNSS> handshake_io_callback_; scoped_ptr<ClientSocketHandle> transport_; HostPortPair host_and_port_; SSLConfig ssl_config_; - CompletionCallback* user_connect_callback_; - CompletionCallback* user_read_callback_; - CompletionCallback* user_write_callback_; + OldCompletionCallback* user_connect_callback_; + OldCompletionCallback* user_read_callback_; + OldCompletionCallback* user_write_callback_; // Used by Read function. scoped_refptr<IOBuffer> user_read_buf_; diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index 52014ea..db9dc78 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -611,7 +611,7 @@ SSLClientSocket::NextProtoStatus SSLClientSocketOpenSSL::GetNextProto( void SSLClientSocketOpenSSL::DoReadCallback(int rv) { // Since Run may result in Read being called, clear |user_read_callback_| // up front. - CompletionCallback* c = user_read_callback_; + OldCompletionCallback* c = user_read_callback_; user_read_callback_ = NULL; user_read_buf_ = NULL; user_read_buf_len_ = 0; @@ -621,7 +621,7 @@ void SSLClientSocketOpenSSL::DoReadCallback(int rv) { void SSLClientSocketOpenSSL::DoWriteCallback(int rv) { // Since Run may result in Write being called, clear |user_write_callback_| // up front. - CompletionCallback* c = user_write_callback_; + OldCompletionCallback* c = user_write_callback_; user_write_callback_ = NULL; user_write_buf_ = NULL; user_write_buf_len_ = 0; @@ -630,7 +630,7 @@ void SSLClientSocketOpenSSL::DoWriteCallback(int rv) { // StreamSocket methods -int SSLClientSocketOpenSSL::Connect(CompletionCallback* callback) { +int SSLClientSocketOpenSSL::Connect(OldCompletionCallback* callback) { net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL); // Set up new ssl object. @@ -988,7 +988,7 @@ void SSLClientSocketOpenSSL::TransportReadComplete(int result) { } void SSLClientSocketOpenSSL::DoConnectCallback(int rv) { - CompletionCallback* c = user_connect_callback_; + OldCompletionCallback* c = user_connect_callback_; user_connect_callback_ = NULL; c->Run(rv > OK ? OK : rv); } @@ -1120,7 +1120,7 @@ base::TimeDelta SSLClientSocketOpenSSL::GetConnectTimeMicros() const { int SSLClientSocketOpenSSL::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { user_read_buf_ = buf; user_read_buf_len_ = buf_len; @@ -1152,7 +1152,7 @@ int SSLClientSocketOpenSSL::DoReadLoop(int result) { int SSLClientSocketOpenSSL::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { user_write_buf_ = buf; user_write_buf_len_ = buf_len; diff --git a/net/socket/ssl_client_socket_openssl.h b/net/socket/ssl_client_socket_openssl.h index e3529a4..81ece4c 100644 --- a/net/socket/ssl_client_socket_openssl.h +++ b/net/socket/ssl_client_socket_openssl.h @@ -62,7 +62,7 @@ class SSLClientSocketOpenSSL : public SSLClientSocket { virtual NextProtoStatus GetNextProto(std::string* proto); // StreamSocket methods: - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -77,8 +77,8 @@ class SSLClientSocketOpenSSL : public SSLClientSocket { virtual base::TimeDelta GetConnectTimeMicros() const; // Socket methods: - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -111,16 +111,16 @@ class SSLClientSocketOpenSSL : public SSLClientSocket { void TransportWriteComplete(int result); void TransportReadComplete(int result); - CompletionCallbackImpl<SSLClientSocketOpenSSL> buffer_send_callback_; - CompletionCallbackImpl<SSLClientSocketOpenSSL> buffer_recv_callback_; + OldCompletionCallbackImpl<SSLClientSocketOpenSSL> buffer_send_callback_; + OldCompletionCallbackImpl<SSLClientSocketOpenSSL> buffer_recv_callback_; bool transport_send_busy_; scoped_refptr<DrainableIOBuffer> send_buffer_; bool transport_recv_busy_; scoped_refptr<IOBuffer> recv_buffer_; - CompletionCallback* user_connect_callback_; - CompletionCallback* user_read_callback_; - CompletionCallback* user_write_callback_; + OldCompletionCallback* user_connect_callback_; + OldCompletionCallback* user_read_callback_; + OldCompletionCallback* user_write_callback_; // Used by Read function. scoped_refptr<IOBuffer> user_read_buf_; @@ -142,7 +142,7 @@ class SSLClientSocketOpenSSL : public SSLClientSocket { CertVerifier* const cert_verifier_; scoped_ptr<SingleRequestCertVerifier> verifier_; - CompletionCallbackImpl<SSLClientSocketOpenSSL> handshake_io_callback_; + OldCompletionCallbackImpl<SSLClientSocketOpenSSL> handshake_io_callback_; // OpenSSL stuff SSL* ssl_; diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 619acdb..4698a3a 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc @@ -498,7 +498,7 @@ int SSLClientSocketPool::RequestSocket(const std::string& group_name, const void* socket_params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log) { const scoped_refptr<SSLSocketParams>* casted_socket_params = static_cast<const scoped_refptr<SSLSocketParams>*>(socket_params); diff --git a/net/socket/ssl_client_socket_pool.h b/net/socket/ssl_client_socket_pool.h index 7d9134d..e29bea5 100644 --- a/net/socket/ssl_client_socket_pool.h +++ b/net/socket/ssl_client_socket_pool.h @@ -153,7 +153,7 @@ class SSLConnectJob : public ConnectJob { const SSLClientSocketContext context_; State next_state_; - CompletionCallbackImpl<SSLConnectJob> callback_; + OldCompletionCallbackImpl<SSLConnectJob> callback_; scoped_ptr<ClientSocketHandle> transport_socket_handle_; scoped_ptr<SSLClientSocket> ssl_socket_; scoped_ptr<SSLHostInfo> ssl_host_info_; @@ -196,7 +196,7 @@ class NET_EXPORT_PRIVATE SSLClientSocketPool const void* connect_params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log); virtual void RequestSockets(const std::string& group_name, diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index 2175e17..de6af006 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -197,7 +197,7 @@ TEST_F(SSLClientSocketPoolTest, TCPFailAsync) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -222,7 +222,7 @@ TEST_F(SSLClientSocketPoolTest, BasicDirect) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(OK, rv); @@ -241,7 +241,7 @@ TEST_F(SSLClientSocketPoolTest, BasicDirectAsync) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -264,7 +264,7 @@ TEST_F(SSLClientSocketPoolTest, DirectCertError) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -287,7 +287,7 @@ TEST_F(SSLClientSocketPoolTest, DirectSSLError) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -313,7 +313,7 @@ TEST_F(SSLClientSocketPoolTest, DirectWithNPN) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -340,7 +340,7 @@ TEST_F(SSLClientSocketPoolTest, DirectNoSPDY) { true); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -366,7 +366,7 @@ TEST_F(SSLClientSocketPoolTest, DirectGotSPDY) { true); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -398,7 +398,7 @@ TEST_F(SSLClientSocketPoolTest, DirectGotBonusSPDY) { true); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -427,7 +427,7 @@ TEST_F(SSLClientSocketPoolTest, SOCKSFail) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_CONNECTION_FAILED, rv); @@ -446,7 +446,7 @@ TEST_F(SSLClientSocketPoolTest, SOCKSFailAsync) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -471,7 +471,7 @@ TEST_F(SSLClientSocketPoolTest, SOCKSBasic) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(OK, rv); @@ -490,7 +490,7 @@ TEST_F(SSLClientSocketPoolTest, SOCKSBasicAsync) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -512,7 +512,7 @@ TEST_F(SSLClientSocketPoolTest, HttpProxyFail) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, rv); @@ -531,7 +531,7 @@ TEST_F(SSLClientSocketPoolTest, HttpProxyFailAsync) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -568,7 +568,7 @@ TEST_F(SSLClientSocketPoolTest, HttpProxyBasic) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(OK, rv); @@ -598,7 +598,7 @@ TEST_F(SSLClientSocketPoolTest, HttpProxyBasicAsync) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -633,7 +633,7 @@ TEST_F(SSLClientSocketPoolTest, NeedProxyAuth) { false); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle.Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -698,7 +698,7 @@ TEST_F(SSLClientSocketPoolTest, IPPooling) { true); scoped_ptr<ClientSocketHandle> handle(new ClientSocketHandle()); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = handle->Init( "a", params, MEDIUM, &callback, pool_.get(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index be91029..ca659b0 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc @@ -73,7 +73,7 @@ TEST_F(SSLClientSocketTest, Connect) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); @@ -117,7 +117,7 @@ TEST_F(SSLClientSocketTest, ConnectExpired) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); @@ -160,7 +160,7 @@ TEST_F(SSLClientSocketTest, ConnectMismatched) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); @@ -205,7 +205,7 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthCertRequested) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); @@ -265,7 +265,7 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthSendNullCert) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); @@ -316,7 +316,7 @@ TEST_F(SSLClientSocketTest, Read) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::StreamSocket* transport = new net::TCPClientSocket( addr, NULL, net::NetLog::Source()); int rv = transport->Connect(&callback); @@ -369,8 +369,8 @@ TEST_F(SSLClientSocketTest, Read_FullDuplex) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; // Used for everything except Write. - TestCompletionCallback callback2; // Used for Write only. + TestOldCompletionCallback callback; // Used for everything except Write. + TestOldCompletionCallback callback2; // Used for Write only. net::StreamSocket* transport = new net::TCPClientSocket( addr, NULL, net::NetLog::Source()); @@ -428,7 +428,7 @@ TEST_F(SSLClientSocketTest, Read_SmallChunks) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::StreamSocket* transport = new net::TCPClientSocket( addr, NULL, net::NetLog::Source()); int rv = transport->Connect(&callback); @@ -478,7 +478,7 @@ TEST_F(SSLClientSocketTest, Read_Interrupted) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::StreamSocket* transport = new net::TCPClientSocket( addr, NULL, net::NetLog::Source()); int rv = transport->Connect(&callback); @@ -525,7 +525,7 @@ TEST_F(SSLClientSocketTest, Read_FullLogging) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); log.SetLogLevel(net::NetLog::LOG_ALL); net::StreamSocket* transport = new net::TCPClientSocket( @@ -588,7 +588,7 @@ TEST_F(SSLClientSocketTest, PrematureApplicationData) { ASSERT_TRUE(test_server.Start()); net::AddressList addr; - TestCompletionCallback callback; + TestOldCompletionCallback callback; static const unsigned char application_data[] = { 0x17, 0x03, 0x01, 0x00, 0x4a, 0x02, 0x00, 0x00, 0x46, 0x03, 0x01, 0x4b, @@ -649,7 +649,7 @@ TEST_F(SSLClientSocketTest, CipherSuiteDisables) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); @@ -718,7 +718,7 @@ TEST_F(SSLClientSocketTest, ClientSocketHandleNotFromPool) { net::AddressList addr; ASSERT_TRUE(test_server.GetAddressList(&addr)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; net::StreamSocket* transport = new net::TCPClientSocket( addr, NULL, net::NetLog::Source()); int rv = transport->Connect(&callback); diff --git a/net/socket/ssl_client_socket_win.cc b/net/socket/ssl_client_socket_win.cc index f1f6ec5..50b24db 100644 --- a/net/socket/ssl_client_socket_win.cc +++ b/net/socket/ssl_client_socket_win.cc @@ -554,7 +554,7 @@ SSLClientSocketWin::GetNextProto(std::string* proto) { return kNextProtoUnsupported; } -int SSLClientSocketWin::Connect(CompletionCallback* callback) { +int SSLClientSocketWin::Connect(OldCompletionCallback* callback) { DCHECK(transport_.get()); DCHECK(next_state_ == STATE_NONE); DCHECK(!user_connect_callback_); @@ -753,7 +753,7 @@ base::TimeDelta SSLClientSocketWin::GetConnectTimeMicros() const { } int SSLClientSocketWin::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(completed_handshake()); DCHECK(!user_read_callback_); @@ -795,7 +795,7 @@ int SSLClientSocketWin::Read(IOBuffer* buf, int buf_len, } int SSLClientSocketWin::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(completed_handshake()); DCHECK(!user_write_callback_); @@ -835,7 +835,7 @@ void SSLClientSocketWin::OnHandshakeIOComplete(int result) { // (which occurs because we are in the middle of a Read when the // renegotiation process starts). So we complete the Read here. if (!user_connect_callback_) { - CompletionCallback* c = user_read_callback_; + OldCompletionCallback* c = user_read_callback_; user_read_callback_ = NULL; user_read_buf_ = NULL; user_read_buf_len_ = 0; @@ -843,7 +843,7 @@ void SSLClientSocketWin::OnHandshakeIOComplete(int result) { return; } net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL); - CompletionCallback* c = user_connect_callback_; + OldCompletionCallback* c = user_connect_callback_; user_connect_callback_ = NULL; c->Run(rv); } @@ -857,7 +857,7 @@ void SSLClientSocketWin::OnReadComplete(int result) { result = DoPayloadDecrypt(); if (result != ERR_IO_PENDING) { DCHECK(user_read_callback_); - CompletionCallback* c = user_read_callback_; + OldCompletionCallback* c = user_read_callback_; user_read_callback_ = NULL; user_read_buf_ = NULL; user_read_buf_len_ = 0; @@ -871,7 +871,7 @@ void SSLClientSocketWin::OnWriteComplete(int result) { int rv = DoPayloadWriteComplete(result); if (rv != ERR_IO_PENDING) { DCHECK(user_write_callback_); - CompletionCallback* c = user_write_callback_; + OldCompletionCallback* c = user_write_callback_; user_write_callback_ = NULL; user_write_buf_ = NULL; user_write_buf_len_ = 0; diff --git a/net/socket/ssl_client_socket_win.h b/net/socket/ssl_client_socket_win.h index fb3d5a7..d4cabf9 100644 --- a/net/socket/ssl_client_socket_win.h +++ b/net/socket/ssl_client_socket_win.h @@ -55,7 +55,7 @@ class SSLClientSocketWin : public SSLClientSocket { virtual NextProtoStatus GetNextProto(std::string* proto); // StreamSocket methods: - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -70,8 +70,8 @@ class SSLClientSocketWin : public SSLClientSocket { virtual base::TimeDelta GetConnectTimeMicros() const; // Socket methods: - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -111,24 +111,24 @@ class SSLClientSocketWin : public SSLClientSocket { void FreeSendBuffer(); // Internal callbacks as async operations complete. - CompletionCallbackImpl<SSLClientSocketWin> handshake_io_callback_; - CompletionCallbackImpl<SSLClientSocketWin> read_callback_; - CompletionCallbackImpl<SSLClientSocketWin> write_callback_; + OldCompletionCallbackImpl<SSLClientSocketWin> handshake_io_callback_; + OldCompletionCallbackImpl<SSLClientSocketWin> read_callback_; + OldCompletionCallbackImpl<SSLClientSocketWin> write_callback_; scoped_ptr<ClientSocketHandle> transport_; HostPortPair host_and_port_; SSLConfig ssl_config_; // User function to callback when the Connect() completes. - CompletionCallback* user_connect_callback_; + OldCompletionCallback* user_connect_callback_; // User function to callback when a Read() completes. - CompletionCallback* user_read_callback_; + OldCompletionCallback* user_read_callback_; scoped_refptr<IOBuffer> user_read_buf_; int user_read_buf_len_; // User function to callback when a Write() completes. - CompletionCallback* user_write_callback_; + OldCompletionCallback* user_write_callback_; scoped_refptr<IOBuffer> user_write_buf_; int user_write_buf_len_; diff --git a/net/socket/ssl_host_info.cc b/net/socket/ssl_host_info.cc index d428911..2f03a1a 100644 --- a/net/socket/ssl_host_info.cc +++ b/net/socket/ssl_host_info.cc @@ -35,7 +35,7 @@ SSLHostInfo::SSLHostInfo( rev_checking_enabled_(ssl_config.rev_checking_enabled), verify_ev_cert_(ssl_config.verify_ev_cert), verifier_(cert_verifier), - callback_(new CancelableCompletionCallback<SSLHostInfo>( + callback_(new CancelableOldCompletionCallback<SSLHostInfo>( ALLOW_THIS_IN_INITIALIZER_LIST(this), &SSLHostInfo::VerifyCallback)), dnsrr_resolver_(NULL), @@ -179,7 +179,7 @@ const CertVerifyResult& SSLHostInfo::cert_verify_result() const { return cert_verify_result_; } -int SSLHostInfo::WaitForCertVerification(CompletionCallback* callback) { +int SSLHostInfo::WaitForCertVerification(OldCompletionCallback* callback) { if (cert_verification_complete_) return cert_verification_error_; DCHECK(!cert_parsing_failed_); @@ -205,7 +205,7 @@ void SSLHostInfo::VerifyCallback(int rv) { cert_verification_complete_ = true; cert_verification_error_ = rv; if (cert_verification_callback_) { - CompletionCallback* callback = cert_verification_callback_; + OldCompletionCallback* callback = cert_verification_callback_; cert_verification_callback_ = NULL; callback->Run(rv); } diff --git a/net/socket/ssl_host_info.h b/net/socket/ssl_host_info.h index 6441e60e..b4884a7 100644 --- a/net/socket/ssl_host_info.h +++ b/net/socket/ssl_host_info.h @@ -49,7 +49,7 @@ class NET_EXPORT_PRIVATE SSLHostInfo { // // |callback| may be NULL, in which case ERR_IO_PENDING may still be returned // but, obviously, a callback will never be made. - virtual int WaitForDataReady(CompletionCallback* callback) = 0; + virtual int WaitForDataReady(OldCompletionCallback* callback) = 0; // Persist allows for the host information to be updated for future users. // This is a fire and forget operation: the caller may drop its reference @@ -89,7 +89,7 @@ class NET_EXPORT_PRIVATE SSLHostInfo { // callback to be called when the verification completes. If the verification // has already finished then WaitForCertVerification returns the result of // that verification. - int WaitForCertVerification(CompletionCallback* callback); + int WaitForCertVerification(OldCompletionCallback* callback); base::TimeTicks verification_start_time() const { return verification_start_time_; @@ -119,7 +119,7 @@ class NET_EXPORT_PRIVATE SSLHostInfo { // This is the hostname that we'll validate the certificates against. const std::string hostname_; bool cert_parsing_failed_; - CompletionCallback* cert_verification_callback_; + OldCompletionCallback* cert_verification_callback_; // These two members are taken from the SSLConfig. bool rev_checking_enabled_; bool verify_ev_cert_; @@ -128,10 +128,10 @@ class NET_EXPORT_PRIVATE SSLHostInfo { CertVerifyResult cert_verify_result_; SingleRequestCertVerifier verifier_; scoped_refptr<X509Certificate> cert_; - scoped_refptr<CancelableCompletionCallback<SSLHostInfo> > callback_; + scoped_refptr<CancelableOldCompletionCallback<SSLHostInfo> > callback_; DnsRRResolver* dnsrr_resolver_; - CompletionCallback* dns_callback_; + OldCompletionCallback* dns_callback_; DnsRRResolver::Handle dns_handle_; RRResponse dns_response_; base::TimeTicks dns_lookup_start_time_; diff --git a/net/socket/ssl_server_socket.h b/net/socket/ssl_server_socket.h index d01ad72..bdf5b80 100644 --- a/net/socket/ssl_server_socket.h +++ b/net/socket/ssl_server_socket.h @@ -32,7 +32,7 @@ class SSLServerSocket : public StreamSocket { // if the process completes asynchronously. If Disconnect is called before // completion then the callback will be silently, as for other StreamSocket // calls. - virtual int Handshake(CompletionCallback* callback) = 0; + virtual int Handshake(OldCompletionCallback* callback) = 0; // Exports data derived from the SSL master-secret (see RFC 5705). // The call will fail with an error if the socket is not connected, or the diff --git a/net/socket/ssl_server_socket_nss.cc b/net/socket/ssl_server_socket_nss.cc index dfec9d2..4316049 100644 --- a/net/socket/ssl_server_socket_nss.cc +++ b/net/socket/ssl_server_socket_nss.cc @@ -92,7 +92,7 @@ SSLServerSocketNSS::~SSLServerSocketNSS() { } } -int SSLServerSocketNSS::Handshake(CompletionCallback* callback) { +int SSLServerSocketNSS::Handshake(OldCompletionCallback* callback) { net_log_.BeginEvent(NetLog::TYPE_SSL_SERVER_HANDSHAKE, NULL); int rv = Init(); @@ -143,13 +143,13 @@ int SSLServerSocketNSS::ExportKeyingMaterial(const base::StringPiece& label, return OK; } -int SSLServerSocketNSS::Connect(CompletionCallback* callback) { +int SSLServerSocketNSS::Connect(OldCompletionCallback* callback) { NOTIMPLEMENTED(); return ERR_NOT_IMPLEMENTED; } int SSLServerSocketNSS::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(!user_read_callback_); DCHECK(!user_handshake_callback_); DCHECK(!user_read_buf_); @@ -172,7 +172,7 @@ int SSLServerSocketNSS::Read(IOBuffer* buf, int buf_len, } int SSLServerSocketNSS::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(!user_write_callback_); DCHECK(!user_write_buf_); DCHECK(nss_bufs_); @@ -706,7 +706,7 @@ int SSLServerSocketNSS::DoHandshake() { void SSLServerSocketNSS::DoHandshakeCallback(int rv) { DCHECK_NE(rv, ERR_IO_PENDING); - CompletionCallback* c = user_handshake_callback_; + OldCompletionCallback* c = user_handshake_callback_; user_handshake_callback_ = NULL; c->Run(rv > OK ? OK : rv); } @@ -717,7 +717,7 @@ void SSLServerSocketNSS::DoReadCallback(int rv) { // Since Run may result in Read being called, clear |user_read_callback_| // up front. - CompletionCallback* c = user_read_callback_; + OldCompletionCallback* c = user_read_callback_; user_read_callback_ = NULL; user_read_buf_ = NULL; user_read_buf_len_ = 0; @@ -730,7 +730,7 @@ void SSLServerSocketNSS::DoWriteCallback(int rv) { // Since Run may result in Write being called, clear |user_write_callback_| // up front. - CompletionCallback* c = user_write_callback_; + OldCompletionCallback* c = user_write_callback_; user_write_callback_ = NULL; user_write_buf_ = NULL; user_write_buf_len_ = 0; diff --git a/net/socket/ssl_server_socket_nss.h b/net/socket/ssl_server_socket_nss.h index 9f13d4a..980464d 100644 --- a/net/socket/ssl_server_socket_nss.h +++ b/net/socket/ssl_server_socket_nss.h @@ -32,7 +32,7 @@ class SSLServerSocketNSS : public SSLServerSocket { virtual ~SSLServerSocketNSS(); // SSLServerSocket interface. - virtual int Handshake(CompletionCallback* callback); + virtual int Handshake(OldCompletionCallback* callback); virtual int ExportKeyingMaterial(const base::StringPiece& label, const base::StringPiece& context, unsigned char *out, @@ -40,14 +40,14 @@ class SSLServerSocketNSS : public SSLServerSocket { // Socket interface (via StreamSocket). virtual int Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual int Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); // StreamSocket interface. - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -98,8 +98,8 @@ class SSLServerSocketNSS : public SSLServerSocket { virtual int Init(); // Members used to send and receive buffer. - CompletionCallbackImpl<SSLServerSocketNSS> buffer_send_callback_; - CompletionCallbackImpl<SSLServerSocketNSS> buffer_recv_callback_; + OldCompletionCallbackImpl<SSLServerSocketNSS> buffer_send_callback_; + OldCompletionCallbackImpl<SSLServerSocketNSS> buffer_recv_callback_; bool transport_send_busy_; bool transport_recv_busy_; @@ -107,9 +107,9 @@ class SSLServerSocketNSS : public SSLServerSocket { BoundNetLog net_log_; - CompletionCallback* user_handshake_callback_; - CompletionCallback* user_read_callback_; - CompletionCallback* user_write_callback_; + OldCompletionCallback* user_handshake_callback_; + OldCompletionCallback* user_read_callback_; + OldCompletionCallback* user_write_callback_; // Used by Read function. scoped_refptr<IOBuffer> user_read_buf_; diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc index 6c5e3b8..2340967 100644 --- a/net/socket/ssl_server_socket_unittest.cc +++ b/net/socket/ssl_server_socket_unittest.cc @@ -57,7 +57,7 @@ class FakeDataChannel { } virtual int Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { if (data_.empty()) { read_callback_ = callback; read_buf_ = buf; @@ -68,7 +68,7 @@ class FakeDataChannel { } virtual int Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { data_.push(new net::DrainableIOBuffer(buf, buf_len)); MessageLoop::current()->PostTask( FROM_HERE, task_factory_.NewRunnableMethod( @@ -82,7 +82,7 @@ class FakeDataChannel { return; int copied = PropogateData(read_buf_, read_buf_len_); - net::CompletionCallback* callback = read_callback_; + net::OldCompletionCallback* callback = read_callback_; read_callback_ = NULL; read_buf_ = NULL; read_buf_len_ = 0; @@ -100,7 +100,7 @@ class FakeDataChannel { return copied; } - net::CompletionCallback* read_callback_; + net::OldCompletionCallback* read_callback_; scoped_refptr<net::IOBuffer> read_buf_; int read_buf_len_; @@ -123,14 +123,14 @@ class FakeSocket : public StreamSocket { } virtual int Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { // Read random number of bytes. buf_len = rand() % buf_len + 1; return incoming_->Read(buf, buf_len, callback); } virtual int Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { // Write random number of bytes. buf_len = rand() % buf_len + 1; return outgoing_->Write(buf, buf_len, callback); @@ -144,7 +144,7 @@ class FakeSocket : public StreamSocket { return true; } - virtual int Connect(CompletionCallback* callback) { + virtual int Connect(OldCompletionCallback* callback) { return net::OK; } @@ -228,7 +228,7 @@ TEST(FakeSocketTest, DataTransfer) { EXPECT_EQ(0, memcmp(kTestData, read_buf->data(), read)); // Read then write. - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(net::ERR_IO_PENDING, server.Read(read_buf, kReadBufSize, &callback)); @@ -326,8 +326,8 @@ TEST_F(SSLServerSocketTest, Initialize) { TEST_F(SSLServerSocketTest, Handshake) { Initialize(); - TestCompletionCallback connect_callback; - TestCompletionCallback handshake_callback; + TestOldCompletionCallback connect_callback; + TestOldCompletionCallback handshake_callback; int server_ret = server_socket_->Handshake(&handshake_callback); EXPECT_TRUE(server_ret == net::OK || server_ret == net::ERR_IO_PENDING); @@ -351,8 +351,8 @@ TEST_F(SSLServerSocketTest, Handshake) { TEST_F(SSLServerSocketTest, DataTransfer) { Initialize(); - TestCompletionCallback connect_callback; - TestCompletionCallback handshake_callback; + TestOldCompletionCallback connect_callback; + TestOldCompletionCallback handshake_callback; // Establish connection. int client_ret = client_socket_->Connect(&connect_callback); @@ -374,8 +374,8 @@ TEST_F(SSLServerSocketTest, DataTransfer) { kReadBufSize); // Write then read. - TestCompletionCallback write_callback; - TestCompletionCallback read_callback; + TestOldCompletionCallback write_callback; + TestOldCompletionCallback read_callback; server_ret = server_socket_->Write(write_buf, write_buf->size(), &write_callback); EXPECT_TRUE(server_ret > 0 || server_ret == net::ERR_IO_PENDING); @@ -435,8 +435,8 @@ TEST_F(SSLServerSocketTest, DataTransfer) { TEST_F(SSLServerSocketTest, ExportKeyingMaterial) { Initialize(); - TestCompletionCallback connect_callback; - TestCompletionCallback handshake_callback; + TestOldCompletionCallback connect_callback; + TestOldCompletionCallback handshake_callback; int client_ret = client_socket_->Connect(&connect_callback); ASSERT_TRUE(client_ret == net::OK || client_ret == net::ERR_IO_PENDING); diff --git a/net/socket/stream_socket.h b/net/socket/stream_socket.h index 85bb352..0a68442 100644 --- a/net/socket/stream_socket.h +++ b/net/socket/stream_socket.h @@ -33,7 +33,7 @@ class NET_EXPORT_PRIVATE StreamSocket : public Socket { // // Connect may also be called again after a call to the Disconnect method. // - virtual int Connect(CompletionCallback* callback) = 0; + virtual int Connect(OldCompletionCallback* callback) = 0; // Called to disconnect a socket. Does nothing if the socket is already // disconnected. After calling Disconnect it is possible to call Connect diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index bc6270d..2a490e1 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -202,7 +202,7 @@ int TCPClientSocketLibevent::Bind(const IPEndPoint& address) { return 0; } -int TCPClientSocketLibevent::Connect(CompletionCallback* callback) { +int TCPClientSocketLibevent::Connect(OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); // If already connected, then just return OK. @@ -429,7 +429,7 @@ bool TCPClientSocketLibevent::IsConnectedAndIdle() const { int TCPClientSocketLibevent::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK_NE(kInvalidSocket, socket_); DCHECK(!waiting_connect()); @@ -469,7 +469,7 @@ int TCPClientSocketLibevent::Read(IOBuffer* buf, int TCPClientSocketLibevent::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK_NE(kInvalidSocket, socket_); DCHECK(!waiting_connect()); @@ -589,7 +589,7 @@ void TCPClientSocketLibevent::DoReadCallback(int rv) { DCHECK(read_callback_); // since Run may result in Read being called, clear read_callback_ up front. - CompletionCallback* c = read_callback_; + OldCompletionCallback* c = read_callback_; read_callback_ = NULL; c->Run(rv); } @@ -599,7 +599,7 @@ void TCPClientSocketLibevent::DoWriteCallback(int rv) { DCHECK(write_callback_); // since Run may result in Write being called, clear write_callback_ up front. - CompletionCallback* c = write_callback_; + OldCompletionCallback* c = write_callback_; write_callback_ = NULL; c->Run(rv); } diff --git a/net/socket/tcp_client_socket_libevent.h b/net/socket/tcp_client_socket_libevent.h index b0cc7a6..3baf6c9 100644 --- a/net/socket/tcp_client_socket_libevent.h +++ b/net/socket/tcp_client_socket_libevent.h @@ -43,7 +43,7 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, int Bind(const IPEndPoint& address); // StreamSocket methods: - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -60,8 +60,8 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, // Socket methods: // Multiple outstanding requests are not supported. // Full duplex mode (reading and writing at the same time) is supported - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -172,10 +172,10 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, int write_buf_len_; // External callback; called when read is complete. - CompletionCallback* read_callback_; + OldCompletionCallback* read_callback_; // External callback; called when write is complete. - CompletionCallback* write_callback_; + OldCompletionCallback* write_callback_; // The next state for the Connect() state machine. ConnectState next_connect_state_; diff --git a/net/socket/tcp_client_socket_unittest.cc b/net/socket/tcp_client_socket_unittest.cc index edb3c20..4abce1f 100644 --- a/net/socket/tcp_client_socket_unittest.cc +++ b/net/socket/tcp_client_socket_unittest.cc @@ -38,10 +38,10 @@ TEST(TCPClientSocketTest, BindLoopbackToLoopback) { EXPECT_EQ(OK, socket.Bind(IPEndPoint(lo_address, 0))); - TestCompletionCallback connect_callback; + TestOldCompletionCallback connect_callback; EXPECT_EQ(ERR_IO_PENDING, socket.Connect(&connect_callback)); - TestCompletionCallback accept_callback; + TestOldCompletionCallback accept_callback; scoped_ptr<StreamSocket> accepted_socket; int result = server.Accept(&accepted_socket, &accept_callback); if (result == ERR_IO_PENDING) @@ -63,7 +63,7 @@ TEST(TCPClientSocketTest, BindLoopbackToExternal) { ASSERT_TRUE(ParseIPLiteralToNumber("127.0.0.1", &lo_address)); EXPECT_EQ(OK, socket.Bind(IPEndPoint(lo_address, 0))); - TestCompletionCallback connect_callback; + TestOldCompletionCallback connect_callback; int result = socket.Connect(&connect_callback); if (result == ERR_IO_PENDING) result = connect_callback.WaitForResult(); @@ -97,7 +97,7 @@ TEST(TCPClientSocketTest, BindLoopbackToIPv6) { ASSERT_TRUE(ParseIPLiteralToNumber("127.0.0.1", &ipv4_lo_ip)); EXPECT_EQ(OK, socket.Bind(IPEndPoint(ipv4_lo_ip, 0))); - TestCompletionCallback connect_callback; + TestOldCompletionCallback connect_callback; int result = socket.Connect(&connect_callback); if (result == ERR_IO_PENDING) result = connect_callback.WaitForResult(); diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc index 8b192f4..1e69dd9 100644 --- a/net/socket/tcp_client_socket_win.cc +++ b/net/socket/tcp_client_socket_win.cc @@ -382,7 +382,7 @@ int TCPClientSocketWin::Bind(const IPEndPoint& address) { } -int TCPClientSocketWin::Connect(CompletionCallback* callback) { +int TCPClientSocketWin::Connect(OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); // If already connected, then just return OK. @@ -670,7 +670,7 @@ base::TimeDelta TCPClientSocketWin::GetConnectTimeMicros() const { int TCPClientSocketWin::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK_NE(socket_, INVALID_SOCKET); DCHECK(!waiting_read_); @@ -712,7 +712,7 @@ int TCPClientSocketWin::Read(IOBuffer* buf, int TCPClientSocketWin::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK_NE(socket_, INVALID_SOCKET); DCHECK(!waiting_write_); @@ -808,7 +808,7 @@ void TCPClientSocketWin::DoReadCallback(int rv) { DCHECK(read_callback_); // since Run may result in Read being called, clear read_callback_ up front. - CompletionCallback* c = read_callback_; + OldCompletionCallback* c = read_callback_; read_callback_ = NULL; c->Run(rv); } @@ -818,7 +818,7 @@ void TCPClientSocketWin::DoWriteCallback(int rv) { DCHECK(write_callback_); // since Run may result in Write being called, clear write_callback_ up front. - CompletionCallback* c = write_callback_; + OldCompletionCallback* c = write_callback_; write_callback_ = NULL; c->Run(rv); } diff --git a/net/socket/tcp_client_socket_win.h b/net/socket/tcp_client_socket_win.h index ee08509..59ab3b4 100644 --- a/net/socket/tcp_client_socket_win.h +++ b/net/socket/tcp_client_socket_win.h @@ -42,7 +42,7 @@ class NET_EXPORT TCPClientSocketWin : public StreamSocket, int Bind(const IPEndPoint& address); // StreamSocket methods: - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -59,8 +59,8 @@ class NET_EXPORT TCPClientSocketWin : public StreamSocket, // Socket methods: // Multiple outstanding requests are not supported. // Full duplex mode (reading and writing at the same time) is supported - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -123,10 +123,10 @@ class NET_EXPORT TCPClientSocketWin : public StreamSocket, scoped_refptr<Core> core_; // External callback; called when connect or read is complete. - CompletionCallback* read_callback_; + OldCompletionCallback* read_callback_; // External callback; called when write is complete. - CompletionCallback* write_callback_; + OldCompletionCallback* write_callback_; // The next state for the Connect() state machine. ConnectState next_connect_state_; diff --git a/net/socket/tcp_server_socket_libevent.cc b/net/socket/tcp_server_socket_libevent.cc index 3e25fab..5ed52a9 100644 --- a/net/socket/tcp_server_socket_libevent.cc +++ b/net/socket/tcp_server_socket_libevent.cc @@ -106,7 +106,7 @@ int TCPServerSocketLibevent::GetLocalAddress(IPEndPoint* address) const { } int TCPServerSocketLibevent::Accept( - scoped_ptr<StreamSocket>* socket, CompletionCallback* callback) { + scoped_ptr<StreamSocket>* socket, OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK(socket); DCHECK(callback); @@ -185,7 +185,7 @@ void TCPServerSocketLibevent::OnFileCanReadWithoutBlocking(int fd) { int result = AcceptInternal(accept_socket_); if (result != ERR_IO_PENDING) { - CompletionCallback* c = accept_callback_; + OldCompletionCallback* c = accept_callback_; accept_callback_ = NULL; accept_socket_ = NULL; bool ok = accept_socket_watcher_.StopWatchingFileDescriptor(); diff --git a/net/socket/tcp_server_socket_libevent.h b/net/socket/tcp_server_socket_libevent.h index 90e90d8..df846b2 100644 --- a/net/socket/tcp_server_socket_libevent.h +++ b/net/socket/tcp_server_socket_libevent.h @@ -29,7 +29,7 @@ class NET_EXPORT_PRIVATE TCPServerSocketLibevent virtual int Listen(const net::IPEndPoint& address, int backlog); virtual int GetLocalAddress(IPEndPoint* address) const; virtual int Accept(scoped_ptr<StreamSocket>* socket, - CompletionCallback* callback); + OldCompletionCallback* callback); // MessageLoopForIO::Watcher implementation. virtual void OnFileCanReadWithoutBlocking(int fd); @@ -44,7 +44,7 @@ class NET_EXPORT_PRIVATE TCPServerSocketLibevent MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_; scoped_ptr<StreamSocket>* accept_socket_; - CompletionCallback* accept_callback_; + OldCompletionCallback* accept_callback_; BoundNetLog net_log_; }; diff --git a/net/socket/tcp_server_socket_unittest.cc b/net/socket/tcp_server_socket_unittest.cc index 5b5b9f5..8c36dca 100644 --- a/net/socket/tcp_server_socket_unittest.cc +++ b/net/socket/tcp_server_socket_unittest.cc @@ -77,12 +77,12 @@ class TCPServerSocketTest : public PlatformTest { TEST_F(TCPServerSocketTest, Accept) { ASSERT_NO_FATAL_FAILURE(SetUpIPv4()); - TestCompletionCallback connect_callback; + TestOldCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), NULL, NetLog::Source()); connecting_socket.Connect(&connect_callback); - TestCompletionCallback accept_callback; + TestOldCompletionCallback accept_callback; scoped_ptr<StreamSocket> accepted_socket; int result = socket_.Accept(&accepted_socket, &accept_callback); if (result == ERR_IO_PENDING) @@ -102,12 +102,12 @@ TEST_F(TCPServerSocketTest, Accept) { TEST_F(TCPServerSocketTest, AcceptAsync) { ASSERT_NO_FATAL_FAILURE(SetUpIPv4()); - TestCompletionCallback accept_callback; + TestOldCompletionCallback accept_callback; scoped_ptr<StreamSocket> accepted_socket; ASSERT_EQ(ERR_IO_PENDING, socket_.Accept(&accepted_socket, &accept_callback)); - TestCompletionCallback connect_callback; + TestOldCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), NULL, NetLog::Source()); connecting_socket.Connect(&connect_callback); @@ -126,25 +126,25 @@ TEST_F(TCPServerSocketTest, AcceptAsync) { TEST_F(TCPServerSocketTest, Accept2Connections) { ASSERT_NO_FATAL_FAILURE(SetUpIPv4()); - TestCompletionCallback accept_callback; + TestOldCompletionCallback accept_callback; scoped_ptr<StreamSocket> accepted_socket; ASSERT_EQ(ERR_IO_PENDING, socket_.Accept(&accepted_socket, &accept_callback)); - TestCompletionCallback connect_callback; + TestOldCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), NULL, NetLog::Source()); connecting_socket.Connect(&connect_callback); - TestCompletionCallback connect_callback2; + TestOldCompletionCallback connect_callback2; TCPClientSocket connecting_socket2(local_address_list(), NULL, NetLog::Source()); connecting_socket2.Connect(&connect_callback2); EXPECT_EQ(OK, accept_callback.WaitForResult()); - TestCompletionCallback accept_callback2; + TestOldCompletionCallback accept_callback2; scoped_ptr<StreamSocket> accepted_socket2; int result = socket_.Accept(&accepted_socket2, &accept_callback2); if (result == ERR_IO_PENDING) @@ -169,12 +169,12 @@ TEST_F(TCPServerSocketTest, AcceptIPv6) { if (!initialized) return; - TestCompletionCallback connect_callback; + TestOldCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), NULL, NetLog::Source()); connecting_socket.Connect(&connect_callback); - TestCompletionCallback accept_callback; + TestOldCompletionCallback accept_callback; scoped_ptr<StreamSocket> accepted_socket; int result = socket_.Accept(&accepted_socket, &accept_callback); if (result == ERR_IO_PENDING) diff --git a/net/socket/tcp_server_socket_win.cc b/net/socket/tcp_server_socket_win.cc index 55c2439..bde65ec 100644 --- a/net/socket/tcp_server_socket_win.cc +++ b/net/socket/tcp_server_socket_win.cc @@ -99,7 +99,7 @@ int TCPServerSocketWin::GetLocalAddress(IPEndPoint* address) const { } int TCPServerSocketWin::Accept( - scoped_ptr<StreamSocket>* socket, CompletionCallback* callback) { + scoped_ptr<StreamSocket>* socket, OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK(socket); DCHECK(callback); @@ -182,7 +182,7 @@ void TCPServerSocketWin::OnObjectSignaled(HANDLE object) { if (ev.lNetworkEvents & FD_ACCEPT) { int result = AcceptInternal(accept_socket_); if (result != ERR_IO_PENDING) { - CompletionCallback* c = accept_callback_; + OldCompletionCallback* c = accept_callback_; accept_callback_ = NULL; accept_socket_ = NULL; c->Run(result); diff --git a/net/socket/tcp_server_socket_win.h b/net/socket/tcp_server_socket_win.h index 8da5fa1..22eab44 100644 --- a/net/socket/tcp_server_socket_win.h +++ b/net/socket/tcp_server_socket_win.h @@ -31,7 +31,7 @@ class NET_EXPORT_PRIVATE TCPServerSocketWin virtual int Listen(const net::IPEndPoint& address, int backlog); virtual int GetLocalAddress(IPEndPoint* address) const; virtual int Accept(scoped_ptr<StreamSocket>* socket, - CompletionCallback* callback); + OldCompletionCallback* callback); // base::ObjectWatcher::Delegate implementation. virtual void OnObjectSignaled(HANDLE object); @@ -46,7 +46,7 @@ class NET_EXPORT_PRIVATE TCPServerSocketWin base::win::ObjectWatcher accept_watcher_; scoped_ptr<StreamSocket>* accept_socket_; - CompletionCallback* accept_callback_; + OldCompletionCallback* accept_callback_; BoundNetLog net_log_; }; diff --git a/net/socket/transport_client_socket_pool.cc b/net/socket/transport_client_socket_pool.cc index 8cb9570..cd666d3 100644 --- a/net/socket/transport_client_socket_pool.cc +++ b/net/socket/transport_client_socket_pool.cc @@ -400,7 +400,7 @@ int TransportClientSocketPool::RequestSocket( const void* params, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log) { const scoped_refptr<TransportSocketParams>* casted_params = static_cast<const scoped_refptr<TransportSocketParams>*>(params); diff --git a/net/socket/transport_client_socket_pool.h b/net/socket/transport_client_socket_pool.h index e0b6080..3addf33 100644 --- a/net/socket/transport_client_socket_pool.h +++ b/net/socket/transport_client_socket_pool.h @@ -110,7 +110,7 @@ class NET_EXPORT_PRIVATE TransportConnectJob : public ConnectJob { scoped_refptr<TransportSocketParams> params_; ClientSocketFactory* const client_socket_factory_; - CompletionCallbackImpl<TransportConnectJob> callback_; + OldCompletionCallbackImpl<TransportConnectJob> callback_; SingleRequestHostResolver resolver_; AddressList addresses_; State next_state_; @@ -125,7 +125,7 @@ class NET_EXPORT_PRIVATE TransportConnectJob : public ConnectJob { scoped_ptr<StreamSocket> fallback_transport_socket_; scoped_ptr<AddressList> fallback_addresses_; - CompletionCallbackImpl<TransportConnectJob> fallback_callback_; + OldCompletionCallbackImpl<TransportConnectJob> fallback_callback_; base::TimeTicks fallback_connect_start_time_; base::OneShotTimer<TransportConnectJob> fallback_timer_; @@ -150,7 +150,7 @@ class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { const void* resolve_info, RequestPriority priority, ClientSocketHandle* handle, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log); virtual void RequestSockets(const std::string& group_name, diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc index c262bfb..8ea292b 100644 --- a/net/socket/transport_client_socket_pool_unittest.cc +++ b/net/socket/transport_client_socket_pool_unittest.cc @@ -52,7 +52,7 @@ class MockClientSocket : public StreamSocket { addrlist_(addrlist) {} // StreamSocket methods: - virtual int Connect(CompletionCallback* callback) { + virtual int Connect(OldCompletionCallback* callback) { connected_ = true; return OK; } @@ -92,11 +92,11 @@ class MockClientSocket : public StreamSocket { // Socket methods: virtual int Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return ERR_FAILED; } virtual int Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return ERR_FAILED; } virtual bool SetReceiveBufferSize(int32 size) { return true; } @@ -113,7 +113,7 @@ class MockFailingClientSocket : public StreamSocket { MockFailingClientSocket(const AddressList& addrlist) : addrlist_(addrlist) {} // StreamSocket methods: - virtual int Connect(CompletionCallback* callback) { + virtual int Connect(OldCompletionCallback* callback) { return ERR_CONNECTION_FAILED; } @@ -146,12 +146,12 @@ class MockFailingClientSocket : public StreamSocket { // Socket methods: virtual int Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return ERR_FAILED; } virtual int Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return ERR_FAILED; } virtual bool SetReceiveBufferSize(int32 size) { return true; } @@ -181,7 +181,7 @@ class MockPendingClientSocket : public StreamSocket { addrlist_(addrlist) {} // StreamSocket methods: - virtual int Connect(CompletionCallback* callback) { + virtual int Connect(OldCompletionCallback* callback) { MessageLoop::current()->PostDelayedTask( FROM_HERE, method_factory_.NewRunnableMethod( @@ -224,19 +224,19 @@ class MockPendingClientSocket : public StreamSocket { // Socket methods: virtual int Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return ERR_FAILED; } virtual int Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return ERR_FAILED; } virtual bool SetReceiveBufferSize(int32 size) { return true; } virtual bool SetSendBufferSize(int32 size) { return true; } private: - void DoCallback(CompletionCallback* callback) { + void DoCallback(OldCompletionCallback* callback) { if (should_stall_) return; @@ -500,7 +500,7 @@ TEST(TransportConnectJobTest, MakeAddrListStartWithIPv4) { } TEST_F(TransportClientSocketPoolTest, Basic) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("a", low_params_, LOW, &callback, &pool_, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -516,7 +516,7 @@ TEST_F(TransportClientSocketPoolTest, Basic) { TEST_F(TransportClientSocketPoolTest, InitHostResolutionFailure) { host_resolver_->rules()->AddSimulatedFailure("unresolvable.host.name"); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; HostPortPair host_port_pair("unresolvable.host.name", 80); scoped_refptr<TransportSocketParams> dest(new TransportSocketParams( @@ -530,7 +530,7 @@ TEST_F(TransportClientSocketPoolTest, InitHostResolutionFailure) { TEST_F(TransportClientSocketPoolTest, InitConnectionFailure) { client_socket_factory_.set_client_socket_type( MockClientSocketFactory::MOCK_FAILING_CLIENT_SOCKET); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, kDefaultPriority, &callback, &pool_, BoundNetLog())); @@ -643,7 +643,7 @@ TEST_F(TransportClientSocketPoolTest, PendingRequests_NoKeepAlive) { // The pending host resolution will eventually complete, and destroy the // ClientSocketPool which will crash if the group was not cleared properly. TEST_F(TransportClientSocketPoolTest, CancelRequestClearGroup) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, kDefaultPriority, &callback, &pool_, BoundNetLog())); @@ -652,9 +652,9 @@ TEST_F(TransportClientSocketPoolTest, CancelRequestClearGroup) { TEST_F(TransportClientSocketPoolTest, TwoRequestsCancelOne) { ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, kDefaultPriority, &callback, &pool_, BoundNetLog())); @@ -671,13 +671,13 @@ TEST_F(TransportClientSocketPoolTest, ConnectCancelConnect) { client_socket_factory_.set_client_socket_type( MockClientSocketFactory::MOCK_PENDING_CLIENT_SOCKET); ClientSocketHandle handle; - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, kDefaultPriority, &callback, &pool_, BoundNetLog())); handle.Reset(); - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, kDefaultPriority, &callback2, &pool_, BoundNetLog())); @@ -794,7 +794,7 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { ClientSocketHandle* const handle_; TransportClientSocketPool* const pool_; bool within_callback_; - TestCompletionCallback callback_; + TestOldCompletionCallback callback_; }; // Disabled in release with dcheck : http://crbug.com/94501 @@ -869,7 +869,7 @@ TEST_F(TransportClientSocketPoolTest, FailingActiveRequestWithPendingRequests) { } TEST_F(TransportClientSocketPoolTest, ResetIdleSocketsOnIPAddressChange) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("a", low_params_, LOW, &callback, &pool_, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -924,7 +924,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketConnect) { EXPECT_EQ(0, pool_.IdleSocketCount()); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("b", low_params_, LOW, &callback, &pool_, BoundNetLog()); @@ -966,7 +966,7 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) { for (int index = CANCEL_BEFORE_WAIT; index < CANCEL_AFTER_WAIT; ++index) { EXPECT_EQ(0, pool_.IdleSocketCount()); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("c", low_params_, LOW, &callback, &pool_, BoundNetLog()); @@ -1022,7 +1022,7 @@ TEST_F(TransportClientSocketPoolTest, MAYBE_BackupSocketFailAfterStall) { EXPECT_EQ(0, pool_.IdleSocketCount()); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("b", low_params_, LOW, &callback, &pool_, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1074,7 +1074,7 @@ TEST_F(TransportClientSocketPoolTest, MAYBE_BackupSocketFailAfterDelay) { EXPECT_EQ(0, pool_.IdleSocketCount()); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("b", low_params_, LOW, &callback, &pool_, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1128,7 +1128,7 @@ TEST_F(TransportClientSocketPoolTest, IPv6FallbackSocketIPv4FinishesFirst) { host_resolver_->rules()->AddIPLiteralRule( "*", "2:abcd::3:4:ff,2.2.2.2", ""); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("a", low_params_, LOW, &callback, &pool, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1172,7 +1172,7 @@ TEST_F(TransportClientSocketPoolTest, IPv6FallbackSocketIPv6FinishesFirst) { host_resolver_->rules()->AddIPLiteralRule( "*", "2:abcd::3:4:ff,2.2.2.2", ""); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("a", low_params_, LOW, &callback, &pool, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1205,7 +1205,7 @@ TEST_F(TransportClientSocketPoolTest, IPv6NoIPv4AddressesToFallbackTo) { host_resolver_->rules()->AddIPLiteralRule( "*", "2:abcd::3:4:ff,3:abcd::3:4:ff", ""); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("a", low_params_, LOW, &callback, &pool, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1238,7 +1238,7 @@ TEST_F(TransportClientSocketPoolTest, IPv4HasNoFallback) { host_resolver_->rules()->AddIPLiteralRule( "*", "1.1.1.1", ""); - TestCompletionCallback callback; + TestOldCompletionCallback callback; ClientSocketHandle handle; int rv = handle.Init("a", low_params_, LOW, &callback, &pool, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc index 1379f4a..62473fe 100644 --- a/net/socket/transport_client_socket_unittest.cc +++ b/net/socket/transport_client_socket_unittest.cc @@ -75,7 +75,7 @@ class TransportClientSocketTest int DrainClientSocket(IOBuffer* buf, uint32 buf_len, uint32 bytes_to_read, - TestCompletionCallback* callback); + TestOldCompletionCallback* callback); void SendClientRequest(); @@ -122,7 +122,7 @@ void TransportClientSocketTest::SetUp() { HostResolver::kDefaultRetryAttempts, NULL)); HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = resolver->Resolve(info, &addr, &callback, NULL, BoundNetLog()); CHECK_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); @@ -135,7 +135,7 @@ void TransportClientSocketTest::SetUp() { int TransportClientSocketTest::DrainClientSocket( IOBuffer* buf, uint32 buf_len, - uint32 bytes_to_read, TestCompletionCallback* callback) { + uint32 bytes_to_read, TestOldCompletionCallback* callback) { int rv = OK; uint32 bytes_read = 0; @@ -157,7 +157,7 @@ void TransportClientSocketTest::SendClientRequest() { const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; scoped_refptr<IOBuffer> request_buffer( new IOBuffer(arraysize(request_text) - 1)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv; memcpy(request_buffer->data(), request_text, arraysize(request_text) - 1); @@ -175,7 +175,7 @@ INSTANTIATE_TEST_CASE_P(StreamSocket, ::testing::Values(TCP)); TEST_P(TransportClientSocketTest, Connect) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_FALSE(sock_->IsConnected()); int rv = sock_->Connect(&callback); @@ -203,7 +203,7 @@ TEST_P(TransportClientSocketTest, Connect) { TEST_P(TransportClientSocketTest, IsConnected) { scoped_refptr<IOBuffer> buf(new IOBuffer(4096)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; uint32 bytes_read; EXPECT_FALSE(sock_->IsConnected()); @@ -260,7 +260,7 @@ TEST_P(TransportClientSocketTest, IsConnected) { } TEST_P(TransportClientSocketTest, Read) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = sock_->Connect(&callback); if (rv != OK) { ASSERT_EQ(rv, ERR_IO_PENDING); @@ -287,7 +287,7 @@ TEST_P(TransportClientSocketTest, Read) { } TEST_P(TransportClientSocketTest, Read_SmallChunks) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = sock_->Connect(&callback); if (rv != OK) { ASSERT_EQ(rv, ERR_IO_PENDING); @@ -322,7 +322,7 @@ TEST_P(TransportClientSocketTest, Read_SmallChunks) { } TEST_P(TransportClientSocketTest, Read_Interrupted) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = sock_->Connect(&callback); if (rv != OK) { ASSERT_EQ(ERR_IO_PENDING, rv); @@ -347,7 +347,7 @@ TEST_P(TransportClientSocketTest, Read_Interrupted) { } TEST_P(TransportClientSocketTest, DISABLED_FullDuplex_ReadFirst) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = sock_->Connect(&callback); if (rv != OK) { ASSERT_EQ(rv, ERR_IO_PENDING); @@ -367,7 +367,7 @@ TEST_P(TransportClientSocketTest, DISABLED_FullDuplex_ReadFirst) { scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kWriteBufLen)); char* request_data = request_buffer->data(); memset(request_data, 'A', kWriteBufLen); - TestCompletionCallback write_callback; + TestOldCompletionCallback write_callback; while (true) { rv = sock_->Write(request_buffer, kWriteBufLen, &write_callback); @@ -389,7 +389,7 @@ TEST_P(TransportClientSocketTest, DISABLED_FullDuplex_ReadFirst) { } TEST_P(TransportClientSocketTest, DISABLED_FullDuplex_WriteFirst) { - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = sock_->Connect(&callback); if (rv != OK) { ASSERT_EQ(ERR_IO_PENDING, rv); @@ -403,7 +403,7 @@ TEST_P(TransportClientSocketTest, DISABLED_FullDuplex_WriteFirst) { scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kWriteBufLen)); char* request_data = request_buffer->data(); memset(request_data, 'A', kWriteBufLen); - TestCompletionCallback write_callback; + TestOldCompletionCallback write_callback; while (true) { rv = sock_->Write(request_buffer, kWriteBufLen, &write_callback); diff --git a/net/socket/web_socket_server_socket.cc b/net/socket/web_socket_server_socket.cc index 7b17ae7..4bb7b9f 100644 --- a/net/socket/web_socket_server_socket.cc +++ b/net/socket/web_socket_server_socket.cc @@ -172,7 +172,7 @@ class WebSocketServerSocketImpl : public net::WebSocketServerSocket { }; PendingReq(Type type, net::DrainableIOBuffer* io_buf, - net::CompletionCallback* callback) + net::OldCompletionCallback* callback) : type(type), io_buf(io_buf), callback(callback) { @@ -193,12 +193,12 @@ class WebSocketServerSocketImpl : public net::WebSocketServerSocket { Type type; scoped_refptr<net::DrainableIOBuffer> io_buf; - net::CompletionCallback* callback; + net::OldCompletionCallback* callback; }; // Socket implementation. virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) OVERRIDE { + net::OldCompletionCallback* callback) OVERRIDE { if (buf_len == 0) return 0; if (buf == NULL || buf_len < 0) { @@ -263,7 +263,7 @@ class WebSocketServerSocketImpl : public net::WebSocketServerSocket { } virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) OVERRIDE { + net::OldCompletionCallback* callback) OVERRIDE { if (buf_len == 0) return 0; if (buf == NULL || buf_len < 0) { @@ -319,7 +319,7 @@ class WebSocketServerSocketImpl : public net::WebSocketServerSocket { } // WebSocketServerSocket implementation. - virtual int Accept(net::CompletionCallback* callback) { + virtual int Accept(net::OldCompletionCallback* callback) { if (phase_ != PHASE_NYMPH) return net::ERR_UNEXPECTED; phase_ = PHASE_HANDSHAKE; @@ -447,7 +447,7 @@ class WebSocketServerSocketImpl : public net::WebSocketServerSocket { if (rv > 0) { process_handshake_buf_->DidConsume(rv); phase_ = PHASE_FRAME_OUTSIDE; - net::CompletionCallback* cb = pending_reqs_.front().callback; + net::OldCompletionCallback* cb = pending_reqs_.front().callback; pending_reqs_.pop_front(); ConsiderTransportWrite(); // Schedule answer handshake. if (cb) @@ -474,7 +474,7 @@ class WebSocketServerSocketImpl : public net::WebSocketServerSocket { return; } if (rv > 0 || phase_ == PHASE_SHUT) { - net::CompletionCallback* cb = it->callback; + net::OldCompletionCallback* cb = it->callback; pending_reqs_.erase(it); if (cb) cb->Run(rv); @@ -515,7 +515,7 @@ class WebSocketServerSocketImpl : public net::WebSocketServerSocket { DCHECK_LE(result, it->io_buf->BytesRemaining()); it->io_buf->DidConsume(result); if (it->io_buf->BytesRemaining() == 0) { - net::CompletionCallback* cb = it->callback; + net::OldCompletionCallback* cb = it->callback; int bytes_written = it->io_buf->BytesConsumed(); DCHECK_GT(bytes_written, 0); pending_reqs_.erase(it); @@ -878,8 +878,8 @@ class WebSocketServerSocketImpl : public net::WebSocketServerSocket { std::deque<PendingReq> pending_reqs_; // Callbacks from transport to us. - scoped_ptr<net::CompletionCallback> transport_read_callback_; - scoped_ptr<net::CompletionCallback> transport_write_callback_; + scoped_ptr<net::OldCompletionCallback> transport_read_callback_; + scoped_ptr<net::OldCompletionCallback> transport_write_callback_; // Whether transport requests are pending. bool is_transport_read_pending_; diff --git a/net/socket/web_socket_server_socket.h b/net/socket/web_socket_server_socket.h index 55c273e..2415575 100644 --- a/net/socket/web_socket_server_socket.h +++ b/net/socket/web_socket_server_socket.h @@ -50,7 +50,7 @@ class WebSocketServerSocket : public Socket { // Returns either ERR_IO_PENDING, in which case the given callback will be // called in the future with the real result, or it completes synchronously, // returning the result immediately. - virtual int Accept(CompletionCallback* callback) = 0; + virtual int Accept(OldCompletionCallback* callback) = 0; }; // Creates websocket server socket atop of already connected socket. This diff --git a/net/socket/web_socket_server_socket_unittest.cc b/net/socket/web_socket_server_socket_unittest.cc index 20e3dcf..476fc33 100644 --- a/net/socket/web_socket_server_socket_unittest.cc +++ b/net/socket/web_socket_server_socket_unittest.cc @@ -94,7 +94,7 @@ class TestingTransportSocket : public net::Socket { // Socket implementation. virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { CHECK_GT(buf_len, 0); int remaining = sample_->BytesRemaining(); if (remaining < 1) { @@ -116,7 +116,7 @@ class TestingTransportSocket : public net::Socket { } virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { CHECK_GT(buf_len, 0); int remaining = answer_->BytesRemaining(); CHECK_GE(remaining, buf_len); @@ -144,7 +144,7 @@ class TestingTransportSocket : public net::Socket { net::DrainableIOBuffer* answer() { return answer_.get(); } - void DoReadCallback(net::CompletionCallback* callback, int result) { + void DoReadCallback(net::OldCompletionCallback* callback, int result) { if (result == 0 && !is_closed_) { MessageLoop::current()->PostTask(FROM_HERE, method_factory_.NewRunnableMethod( @@ -155,7 +155,7 @@ class TestingTransportSocket : public net::Socket { } } - void DoWriteCallback(net::CompletionCallback* callback, int result) { + void DoWriteCallback(net::OldCompletionCallback* callback, int result) { if (callback) callback->Run(result); } @@ -169,7 +169,7 @@ class TestingTransportSocket : public net::Socket { scoped_refptr<net::DrainableIOBuffer> answer_; // Final read callback to report zero (zero stands for EOF). - net::CompletionCallback* final_read_callback_; + net::OldCompletionCallback* final_read_callback_; ScopedRunnableMethodFactory<TestingTransportSocket> method_factory_; }; @@ -302,9 +302,9 @@ class ReadWriteTracker { private: net::WebSocketServerSocket* const ws_; int const buf_size_; - scoped_ptr<net::CompletionCallback> accept_callback_; - scoped_ptr<net::CompletionCallback> read_callback_; - scoped_ptr<net::CompletionCallback> write_callback_; + scoped_ptr<net::OldCompletionCallback> accept_callback_; + scoped_ptr<net::OldCompletionCallback> read_callback_; + scoped_ptr<net::OldCompletionCallback> write_callback_; scoped_refptr<net::IOBuffer> read_buf_; scoped_refptr<net::IOBuffer> write_buf_; int bytes_remaining_to_read_; @@ -348,7 +348,7 @@ class WebSocketServerSocketTest : public testing::Test { } int count_; - scoped_ptr<net::CompletionCallback> accept_callback_[2]; + scoped_ptr<net::OldCompletionCallback> accept_callback_[2]; }; TEST_F(WebSocketServerSocketTest, Handshake) { |