diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 21:48:54 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 21:48:54 +0000 |
commit | 115288648041898b6d50f7d2e17391e2d1972a76 (patch) | |
tree | eee67d927a7ebb40e87848924a8f26c5c5cb99ca /net | |
parent | e91ac22d99252095839ca7c82c092972bd56445e (diff) | |
download | chromium_src-115288648041898b6d50f7d2e17391e2d1972a76.zip chromium_src-115288648041898b6d50f7d2e17391e2d1972a76.tar.gz chromium_src-115288648041898b6d50f7d2e17391e2d1972a76.tar.bz2 |
Revert 114494 - Remove BindStateHolder and have Bind() return a Callback<> object directly.
This removes some complexity and also fixes a bug where if you call Bind() with the result of Bind(), the resulting Callback would only be valid during the first call. Ouch.
BUG=none
TEST=new unittests
Review URL: http://codereview.chromium.org/8738001
TBR=ajwong@chromium.org
Review URL: http://codereview.chromium.org/8914022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/completion_callback.cc | 14 | ||||
-rw-r--r-- | net/base/completion_callback.h | 7 | ||||
-rw-r--r-- | net/base/cookie_monster_unittest.cc | 2 | ||||
-rw-r--r-- | net/base/cookie_store_test_helpers.cc | 2 | ||||
-rw-r--r-- | net/base/cookie_store_test_helpers.h | 2 | ||||
-rw-r--r-- | net/http/http_proxy_client_socket.cc | 3 | ||||
-rw-r--r-- | net/net.gyp | 1 | ||||
-rw-r--r-- | net/socket/socket_test_util.cc | 5 | ||||
-rw-r--r-- | net/socket/web_socket_server_socket.cc | 3 | ||||
-rw-r--r-- | net/spdy/spdy_proxy_client_socket_unittest.cc | 4 |
10 files changed, 12 insertions, 31 deletions
diff --git a/net/base/completion_callback.cc b/net/base/completion_callback.cc deleted file mode 100644 index e19e327..0000000 --- a/net/base/completion_callback.cc +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/base/completion_callback.h" - -namespace net { - -void OldCompletionCallbackAdapter(OldCompletionCallback* old_callback, - int rv) { - old_callback->Run(rv); -} - -} // namespace net diff --git a/net/base/completion_callback.h b/net/base/completion_callback.h index 2042994..cea6be3 100644 --- a/net/base/completion_callback.h +++ b/net/base/completion_callback.h @@ -60,13 +60,6 @@ class CancelableOldCompletionCallback : bool is_canceled_; }; -// Helper function for using OldCompletionCallback objects with -// the newer CompletionCallback APIs. -// -// This is a transitional function and should be removed when -// OldCompletionCallbackAdapter is deleted. -void OldCompletionCallbackAdapter(OldCompletionCallback* old_callback, int rv); - } // namespace net #endif // NET_BASE_COMPLETION_CALLBACK_H__ diff --git a/net/base/cookie_monster_unittest.cc b/net/base/cookie_monster_unittest.cc index 59580e6..87df99c 100644 --- a/net/base/cookie_monster_unittest.cc +++ b/net/base/cookie_monster_unittest.cc @@ -145,7 +145,7 @@ class GetCookieStringCallback : public CookieCallback { explicit GetCookieStringCallback(Thread* run_in_thread) : CookieCallback(run_in_thread) {} - void Run(const std::string& cookie) { + void Run(std::string cookie) { cookie_ = cookie; CallbackEpilogue(); } diff --git a/net/base/cookie_store_test_helpers.cc b/net/base/cookie_store_test_helpers.cc index 7a69117..0d50de3 100644 --- a/net/base/cookie_store_test_helpers.cc +++ b/net/base/cookie_store_test_helpers.cc @@ -33,7 +33,7 @@ void DelayedCookieMonster::SetCookiesInternalCallback(bool result) { } void DelayedCookieMonster::GetCookiesWithOptionsInternalCallback( - const std::string& cookie) { + std::string cookie) { cookie_ = cookie; did_run_ = true; } diff --git a/net/base/cookie_store_test_helpers.h b/net/base/cookie_store_test_helpers.h index 14b353b..ba8c6c8 100644 --- a/net/base/cookie_store_test_helpers.h +++ b/net/base/cookie_store_test_helpers.h @@ -70,7 +70,7 @@ class DelayedCookieMonster : public CookieStore { void SetCookiesInternalCallback(bool result); - void GetCookiesWithOptionsInternalCallback(const std::string& cookie); + void GetCookiesWithOptionsInternalCallback(std::string cookie); // Invoke the original callbacks. diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc index b0ddc32..4b03ba8 100644 --- a/net/http/http_proxy_client_socket.cc +++ b/net/http/http_proxy_client_socket.cc @@ -73,7 +73,8 @@ int HttpProxyClientSocket::RestartWithAuth(OldCompletionCallback* callback) { rv = DoLoop(OK); if (rv == ERR_IO_PENDING) if (callback) { - user_callback_ = base::Bind(&OldCompletionCallbackAdapter, callback); + user_callback_ = base::Bind(&OldCompletionCallback::Run<int>, + base::Unretained(callback)); } return rv; } diff --git a/net/net.gyp b/net/net.gyp index a62ec23..040c1e0 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -72,7 +72,6 @@ 'base/cert_verifier.h', 'base/cert_verify_result.cc', 'base/cert_verify_result.h', - 'base/completion_callback.cc', 'base/completion_callback.h', 'base/connection_type_histograms.cc', 'base/connection_type_histograms.h', diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 37c0316..ff8bc50 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -1481,7 +1481,8 @@ int MockTransportClientSocketPool::RequestSocket( AddressList(), net_log.net_log(), net::NetLog::Source()); CompletionCallback cb; if (callback) { - cb = base::Bind(&OldCompletionCallbackAdapter, callback); + cb = base::Bind(&OldCompletionCallback::Run<int>, + base::Unretained(callback)); } MockConnectJob* job = new MockConnectJob(socket, handle, cb); job_list_.push_back(job); @@ -1490,7 +1491,7 @@ int MockTransportClientSocketPool::RequestSocket( } void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, - ClientSocketHandle* handle) { + ClientSocketHandle* handle) { std::vector<MockConnectJob*>::iterator i; for (i = job_list_.begin(); i != job_list_.end(); ++i) { if ((*i)->CancelHandle(handle)) { diff --git a/net/socket/web_socket_server_socket.cc b/net/socket/web_socket_server_socket.cc index 899bb3e..08b7788 100644 --- a/net/socket/web_socket_server_socket.cc +++ b/net/socket/web_socket_server_socket.cc @@ -321,7 +321,8 @@ class WebSocketServerSocketImpl : public net::WebSocketServerSocket { phase_ = PHASE_HANDSHAKE; net::CompletionCallback cb; if (callback) { - cb = base::Bind(&net::OldCompletionCallbackAdapter, callback); + cb = base::Bind(&net::OldCompletionCallback::Run<int>, + base::Unretained(callback)); } pending_reqs_.push_front(PendingReq( PendingReq::TYPE_READ_METADATA, fill_handshake_buf_.get(), diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc index c21080f..d7d2626 100644 --- a/net/spdy/spdy_proxy_client_socket_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_unittest.cc @@ -1276,8 +1276,8 @@ TEST_F(SpdyProxyClientSocketTest, RstWithReadAndWritePendingDelete) { scoped_refptr<IOBuffer> read_buf(new IOBuffer(kLen1)); ASSERT_EQ(ERR_IO_PENDING, sock_->Read(read_buf, kLen1, - base::Bind(&OldCompletionCallbackAdapter, - &read_callback))); + base::Bind(&DeleteSockCallback::Run<int>, + base::Unretained(&read_callback)))); scoped_refptr<IOBufferWithSize> write_buf(CreateBuffer(kMsg1, kLen1)); EXPECT_EQ(ERR_IO_PENDING, sock_->Write(write_buf, write_buf->size(), |