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/base | |
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/base')
33 files changed, 157 insertions, 157 deletions
diff --git a/net/base/cert_verifier.cc b/net/base/cert_verifier.cc index db630dd..ea90ea9 100644 --- a/net/base/cert_verifier.cc +++ b/net/base/cert_verifier.cc @@ -87,7 +87,7 @@ bool CachedCertVerifyResult::HasExpired(const base::Time current_time) const { // Represents the output and result callback of a request. class CertVerifierRequest { public: - CertVerifierRequest(CompletionCallback* callback, + CertVerifierRequest(OldCompletionCallback* callback, CertVerifyResult* verify_result) : callback_(callback), verify_result_(verify_result) { @@ -112,7 +112,7 @@ class CertVerifierRequest { bool canceled() const { return !callback_; } private: - CompletionCallback* callback_; + OldCompletionCallback* callback_; CertVerifyResult* verify_result_; }; @@ -309,7 +309,7 @@ int CertVerifier::Verify(X509Certificate* cert, const std::string& hostname, int flags, CertVerifyResult* verify_result, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req) { DCHECK(CalledOnValidThread()); @@ -466,7 +466,7 @@ int SingleRequestCertVerifier::Verify(X509Certificate* cert, const std::string& hostname, int flags, CertVerifyResult* verify_result, - CompletionCallback* callback) { + OldCompletionCallback* callback) { // Should not be already in use. DCHECK(!cur_request_ && !cur_request_callback_); @@ -493,7 +493,7 @@ int SingleRequestCertVerifier::Verify(X509Certificate* cert, void SingleRequestCertVerifier::OnVerifyCompletion(int result) { DCHECK(cur_request_ && cur_request_callback_); - CompletionCallback* callback = cur_request_callback_; + OldCompletionCallback* callback = cur_request_callback_; // Clear the outstanding request information. cur_request_ = NULL; diff --git a/net/base/cert_verifier.h b/net/base/cert_verifier.h index feeb459..9f97573 100644 --- a/net/base/cert_verifier.h +++ b/net/base/cert_verifier.h @@ -102,7 +102,7 @@ class NET_EXPORT CertVerifier : NON_EXPORTED_BASE(public base::NonThreadSafe), const std::string& hostname, int flags, CertVerifyResult* verify_result, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req); // Cancels the specified request. |req| is the handle returned by Verify(). @@ -201,7 +201,7 @@ class SingleRequestCertVerifier { const std::string& hostname, int flags, CertVerifyResult* verify_result, - CompletionCallback* callback); + OldCompletionCallback* callback); private: // Callback for when the request to |cert_verifier_| completes, so we @@ -213,10 +213,10 @@ class SingleRequestCertVerifier { // The current request (if any). CertVerifier::RequestHandle cur_request_; - CompletionCallback* cur_request_callback_; + OldCompletionCallback* cur_request_callback_; // Completion callback for when request to |cert_verifier_| completes. - CompletionCallbackImpl<SingleRequestCertVerifier> callback_; + OldCompletionCallbackImpl<SingleRequestCertVerifier> callback_; DISALLOW_COPY_AND_ASSIGN(SingleRequestCertVerifier); }; diff --git a/net/base/cert_verifier_unittest.cc b/net/base/cert_verifier_unittest.cc index 1e15bd7..3787749 100644 --- a/net/base/cert_verifier_unittest.cc +++ b/net/base/cert_verifier_unittest.cc @@ -50,7 +50,7 @@ TEST_F(CertVerifierTest, CacheHit) { int error; CertVerifyResult verify_result; - TestCompletionCallback callback; + TestOldCompletionCallback callback; CertVerifier::RequestHandle request_handle; error = verifier.Verify(test_cert, "www.example.com", 0, &verify_result, @@ -88,10 +88,10 @@ TEST_F(CertVerifierTest, InflightJoin) { int error; CertVerifyResult verify_result; - TestCompletionCallback callback; + TestOldCompletionCallback callback; CertVerifier::RequestHandle request_handle; CertVerifyResult verify_result2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; CertVerifier::RequestHandle request_handle2; error = verifier.Verify(test_cert, "www.example.com", 0, &verify_result, @@ -125,7 +125,7 @@ TEST_F(CertVerifierTest, ExpiredCacheEntry) { int error; CertVerifyResult verify_result; - TestCompletionCallback callback; + TestOldCompletionCallback callback; CertVerifier::RequestHandle request_handle; error = verifier.Verify(test_cert, "www.example.com", 0, &verify_result, @@ -184,7 +184,7 @@ TEST_F(CertVerifierTest, FullCache) { int error; CertVerifyResult verify_result; - TestCompletionCallback callback; + TestOldCompletionCallback callback; CertVerifier::RequestHandle request_handle; error = verifier.Verify(test_cert, "www.example.com", 0, &verify_result, @@ -249,7 +249,7 @@ TEST_F(CertVerifierTest, CancelRequest) { // Issue a few more requests to the worker pool and wait for their // completion, so that the task of the canceled request (which runs on a // worker thread) is likely to complete by the end of this test. - TestCompletionCallback callback; + TestOldCompletionCallback callback; for (int i = 0; i < 5; ++i) { error = verifier.Verify(test_cert, "www2.example.com", 0, &verify_result, &callback, &request_handle); @@ -271,7 +271,7 @@ TEST_F(CertVerifierTest, CancelRequestThenQuit) { int error; CertVerifyResult verify_result; - TestCompletionCallback callback; + TestOldCompletionCallback callback; CertVerifier::RequestHandle request_handle; error = verifier.Verify(test_cert, "www.example.com", 0, &verify_result, diff --git a/net/base/completion_callback.h b/net/base/completion_callback.h index 23d0166..1d3e551 100644 --- a/net/base/completion_callback.h +++ b/net/base/completion_callback.h @@ -12,31 +12,31 @@ namespace net { // A callback specialization that takes a single int parameter. Usually this // is used to report a byte count or network error code. -typedef Callback1<int>::Type CompletionCallback; +typedef Callback1<int>::Type OldCompletionCallback; -// Used to implement a CompletionCallback. +// Used to implement a OldCompletionCallback. template <class T> -class CompletionCallbackImpl : +class OldCompletionCallbackImpl : public CallbackImpl< T, void (T::*)(int), Tuple1<int> > { public: - CompletionCallbackImpl(T* obj, void (T::* meth)(int)) + OldCompletionCallbackImpl(T* obj, void (T::* meth)(int)) : CallbackImpl< T, void (T::*)(int), Tuple1<int> >::CallbackImpl(obj, meth) { } }; -// CancelableCompletionCallback is used for completion callbacks +// CancelableOldCompletionCallback is used for completion callbacks // which may outlive the target for the method dispatch. In such a case, the // provider of the callback calls Cancel() to mark the callback as // "canceled". When the canceled callback is eventually run it does nothing // other than to decrement the refcount to 0 and free the memory. template <class T> -class CancelableCompletionCallback : - public CompletionCallbackImpl<T>, - public base::RefCounted<CancelableCompletionCallback<T> > { +class CancelableOldCompletionCallback : + public OldCompletionCallbackImpl<T>, + public base::RefCounted<CancelableOldCompletionCallback<T> > { public: - CancelableCompletionCallback(T* obj, void (T::* meth)(int)) - : CompletionCallbackImpl<T>(obj, meth), is_canceled_(false) { + CancelableOldCompletionCallback(T* obj, void (T::* meth)(int)) + : OldCompletionCallbackImpl<T>(obj, meth), is_canceled_(false) { } void Cancel() { @@ -45,9 +45,9 @@ class CancelableCompletionCallback : virtual void RunWithParams(const Tuple1<int>& params) { if (is_canceled_) { - base::RefCounted<CancelableCompletionCallback<T> >::Release(); + base::RefCounted<CancelableOldCompletionCallback<T> >::Release(); } else { - CompletionCallbackImpl<T>::RunWithParams(params); + OldCompletionCallbackImpl<T>::RunWithParams(params); } } diff --git a/net/base/dnsrr_resolver.cc b/net/base/dnsrr_resolver.cc index a38ce40..d74a92b 100644 --- a/net/base/dnsrr_resolver.cc +++ b/net/base/dnsrr_resolver.cc @@ -113,7 +113,7 @@ RRResponse::~RRResponse() {} class RRResolverHandle { public: - RRResolverHandle(CompletionCallback* callback, RRResponse* response) + RRResolverHandle(OldCompletionCallback* callback, RRResponse* response) : callback_(callback), response_(response) { } @@ -136,7 +136,7 @@ class RRResolverHandle { } private: - CompletionCallback* callback_; + OldCompletionCallback* callback_; RRResponse* response_; }; @@ -541,7 +541,7 @@ DnsRRResolver::~DnsRRResolver() { } intptr_t DnsRRResolver::Resolve(const std::string& name, uint16 rrtype, - uint16 flags, CompletionCallback* callback, + uint16 flags, OldCompletionCallback* callback, RRResponse* response, int priority /* ignored */, const BoundNetLog& netlog /* ignored */) { diff --git a/net/base/dnsrr_resolver.h b/net/base/dnsrr_resolver.h index 06d7c8c..781a047 100644 --- a/net/base/dnsrr_resolver.h +++ b/net/base/dnsrr_resolver.h @@ -99,7 +99,7 @@ class NET_EXPORT DnsRRResolver // this function returns kInvalidHandle then the resolution failed // immediately because it was improperly formed. Handle Resolve(const std::string& name, uint16 rrtype, - uint16 flags, CompletionCallback* callback, + uint16 flags, OldCompletionCallback* callback, RRResponse* response, int priority, const BoundNetLog& netlog); diff --git a/net/base/dnsrr_resolver_unittest.cc b/net/base/dnsrr_resolver_unittest.cc index 560052a..4cf7da7 100644 --- a/net/base/dnsrr_resolver_unittest.cc +++ b/net/base/dnsrr_resolver_unittest.cc @@ -28,7 +28,7 @@ class ExplodingCallback : public CallbackRunner<Tuple1<int> > { // pass. However, they may be useful when chaging the code. TEST_F(DnsRRResolverTest, DISABLED_ResolveReal) { RRResponse response; - TestCompletionCallback callback; + TestOldCompletionCallback callback; DnsRRResolver resolver; DnsRRResolver::Handle handle; @@ -43,7 +43,7 @@ TEST_F(DnsRRResolverTest, DISABLED_ResolveReal) { TEST_F(DnsRRResolverTest, DISABLED_ResolveReal2) { RRResponse response; - TestCompletionCallback callback; + TestOldCompletionCallback callback; DnsRRResolver resolver; DnsRRResolver::Handle handle; @@ -59,7 +59,7 @@ TEST_F(DnsRRResolverTest, DISABLED_ResolveReal2) { TEST_F(DnsRRResolverTest, Resolve) { RRResponse response; - TestCompletionCallback callback; + TestOldCompletionCallback callback; DnsRRResolver resolver; DnsRRResolver::Handle handle; @@ -108,7 +108,7 @@ TEST_F(DnsRRResolverTest, Resolve) { // Test an inflight join. (Note that this depends on the cache being flushed // by OnIPAddressChanged.) - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; DnsRRResolver::Handle handle2; handle = resolver.Resolve("nx.testing.notatld", kDNS_TESTING, 0, &callback, &response, 0, BoundNetLog()); diff --git a/net/base/file_stream.h b/net/base/file_stream.h index 0a800b4..4c92955 100644 --- a/net/base/file_stream.h +++ b/net/base/file_stream.h @@ -85,7 +85,7 @@ class NET_EXPORT FileStream { // This method should not be called if the stream was opened WRITE_ONLY. // // You can pass NULL as the callback for synchronous I/O. - virtual int Read(char* buf, int buf_len, CompletionCallback* callback); + virtual int Read(char* buf, int buf_len, OldCompletionCallback* callback); // Performs the same as Read, but ensures that exactly buf_len bytes // are copied into buf. A partial read may occur, but only as a result of @@ -113,7 +113,7 @@ class NET_EXPORT FileStream { // This method should not be called if the stream was opened READ_ONLY. // // You can pass NULL as the callback for synchronous I/O. - virtual int Write(const char* buf, int buf_len, CompletionCallback* callback); + virtual int Write(const char* buf, int buf_len, OldCompletionCallback* callback); // Truncates the file to be |bytes| length. This is only valid for writable // files. After truncation the file stream is positioned at |bytes|. The new diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc index 7a7cbf3..f1c118b 100644 --- a/net/base/file_stream_posix.cc +++ b/net/base/file_stream_posix.cc @@ -70,7 +70,7 @@ void ReadFileTask(base::PlatformFile file, char* buf, int buf_len, bool record_uma, - CompletionCallback* callback) { + OldCompletionCallback* callback) { callback->Run(ReadFile(file, buf, buf_len, record_uma)); } @@ -89,7 +89,7 @@ int WriteFile(base::PlatformFile file, const char* buf, int buf_len, void WriteFileTask(base::PlatformFile file, const char* buf, int buf_len, bool record_uma, - CompletionCallback* callback) { + OldCompletionCallback* callback) { callback->Run(WriteFile(file, buf, buf_len, record_uma)); } @@ -137,12 +137,12 @@ class FileStream::AsyncContext { // These methods post synchronous read() and write() calls to a WorkerThread. void InitiateAsyncRead( base::PlatformFile file, char* buf, int buf_len, - CompletionCallback* callback); + OldCompletionCallback* callback); void InitiateAsyncWrite( base::PlatformFile file, const char* buf, int buf_len, - CompletionCallback* callback); + OldCompletionCallback* callback); - CompletionCallback* callback() const { return callback_; } + OldCompletionCallback* callback() const { return callback_; } // Called by the WorkerPool thread executing the IO after the IO completes. // This method queues RunAsynchronousCallback() on the MessageLoop and signals @@ -163,11 +163,11 @@ class FileStream::AsyncContext { // The MessageLoopForIO that this AsyncContext is running on. MessageLoopForIO* const message_loop_; - CompletionCallback* callback_; // The user provided callback. + OldCompletionCallback* callback_; // The user provided callback. // A callback wrapper around OnBackgroundIOCompleted(). Run by the WorkerPool // thread doing the background IO on our behalf. - CompletionCallbackImpl<AsyncContext> background_io_completed_callback_; + OldCompletionCallbackImpl<AsyncContext> background_io_completed_callback_; // This is used to synchronize between the AsyncContext destructor (which runs // on the IO thread and OnBackgroundIOCompleted() which runs on the WorkerPool @@ -213,7 +213,7 @@ FileStream::AsyncContext::~AsyncContext() { void FileStream::AsyncContext::InitiateAsyncRead( base::PlatformFile file, char* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(!callback_); callback_ = callback; @@ -228,7 +228,7 @@ void FileStream::AsyncContext::InitiateAsyncRead( void FileStream::AsyncContext::InitiateAsyncWrite( base::PlatformFile file, const char* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(!callback_); callback_ = callback; @@ -266,7 +266,7 @@ void FileStream::AsyncContext::RunAsynchronousCallback() { } DCHECK(callback_); - CompletionCallback* temp = NULL; + OldCompletionCallback* temp = NULL; std::swap(temp, callback_); background_io_completed_.Reset(); temp->Run(result_); @@ -370,7 +370,7 @@ int64 FileStream::Available() { } int FileStream::Read( - char* buf, int buf_len, CompletionCallback* callback) { + char* buf, int buf_len, OldCompletionCallback* callback) { if (!IsOpen()) return ERR_UNEXPECTED; @@ -413,7 +413,7 @@ int FileStream::ReadUntilComplete(char *buf, int buf_len) { } int FileStream::Write( - const char* buf, int buf_len, CompletionCallback* callback) { + const char* buf, int buf_len, OldCompletionCallback* callback) { // write(..., 0) will return 0, which indicates end-of-file. DCHECK_GT(buf_len, 0); diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index a8cdfcc..895bb65 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -145,7 +145,7 @@ TEST_F(FileStreamTest, AsyncRead) { int64 total_bytes_avail = stream.Available(); EXPECT_EQ(file_size, total_bytes_avail); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int total_bytes_read = 0; @@ -180,7 +180,7 @@ TEST_F(FileStreamTest, AsyncRead_EarlyClose) { int64 total_bytes_avail = stream.Available(); EXPECT_EQ(file_size, total_bytes_avail); - TestCompletionCallback callback; + TestOldCompletionCallback callback; char buf[4]; rv = stream.Read(buf, arraysize(buf), &callback); @@ -249,7 +249,7 @@ TEST_F(FileStreamTest, AsyncRead_FromOffset) { int64 total_bytes_avail = stream.Available(); EXPECT_EQ(file_size - kOffset, total_bytes_avail); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int total_bytes_read = 0; @@ -326,7 +326,7 @@ TEST_F(FileStreamTest, AsyncWrite) { EXPECT_TRUE(ok); EXPECT_EQ(0, file_size); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int total_bytes_written = 0; while (total_bytes_written != kTestDataSize) { @@ -358,7 +358,7 @@ TEST_F(FileStreamTest, AsyncWrite_EarlyClose) { EXPECT_TRUE(ok); EXPECT_EQ(0, file_size); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int total_bytes_written = 0; rv = stream.Write(kTestData + total_bytes_written, @@ -418,7 +418,7 @@ TEST_F(FileStreamTest, AsyncWrite_FromOffset) { int64 new_offset = stream.Seek(FROM_END, kOffset); EXPECT_EQ(kTestDataSize, new_offset); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int total_bytes_written = 0; while (total_bytes_written != kTestDataSize) { @@ -540,7 +540,7 @@ TEST_F(FileStreamTest, BasicAsyncReadWrite) { int64 total_bytes_avail = stream.Available(); EXPECT_EQ(file_size, total_bytes_avail); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int64 total_bytes_read = 0; std::string data_read; @@ -598,7 +598,7 @@ TEST_F(FileStreamTest, BasicAsyncWriteRead) { int64 offset = stream.Seek(FROM_END, 0); EXPECT_EQ(offset, file_size); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int total_bytes_written = 0; while (total_bytes_written != kTestDataSize) { @@ -644,9 +644,9 @@ TEST_F(FileStreamTest, BasicAsyncWriteRead) { EXPECT_EQ(kExpectedFileData, data_read); } -class TestWriteReadCompletionCallback : public Callback1<int>::Type { +class TestWriteReadOldCompletionCallback : public Callback1<int>::Type { public: - TestWriteReadCompletionCallback( + TestWriteReadOldCompletionCallback( FileStream* stream, int* total_bytes_written, int* total_bytes_read, @@ -681,7 +681,7 @@ class TestWriteReadCompletionCallback : public Callback1<int>::Type { // Recurse to finish writing all data. int total_bytes_written = 0, total_bytes_read = 0; std::string data_read; - TestWriteReadCompletionCallback callback( + TestWriteReadOldCompletionCallback callback( stream_, &total_bytes_written, &total_bytes_read, &data_read); rv = stream_->Write(kTestData + *total_bytes_written_, kTestDataSize - *total_bytes_written_, @@ -694,7 +694,7 @@ class TestWriteReadCompletionCallback : public Callback1<int>::Type { } else { // We're done writing all data. Start reading the data. stream_->Seek(FROM_BEGIN, 0); - TestCompletionCallback callback; + TestOldCompletionCallback callback; for (;;) { char buf[4]; rv = stream_->Read(buf, arraysize(buf), &callback); @@ -726,7 +726,7 @@ class TestWriteReadCompletionCallback : public Callback1<int>::Type { int* total_bytes_read_; std::string* data_read_; - DISALLOW_COPY_AND_ASSIGN(TestWriteReadCompletionCallback); + DISALLOW_COPY_AND_ASSIGN(TestWriteReadOldCompletionCallback); }; TEST_F(FileStreamTest, AsyncWriteRead) { @@ -751,7 +751,7 @@ TEST_F(FileStreamTest, AsyncWriteRead) { int total_bytes_written = 0; int total_bytes_read = 0; std::string data_read; - TestWriteReadCompletionCallback callback(&stream, &total_bytes_written, + TestWriteReadOldCompletionCallback callback(&stream, &total_bytes_written, &total_bytes_read, &data_read); rv = stream.Write(kTestData + total_bytes_written, @@ -774,9 +774,9 @@ TEST_F(FileStreamTest, AsyncWriteRead) { EXPECT_EQ(kExpectedFileData, data_read); } -class TestWriteCloseCompletionCallback : public Callback1<int>::Type { +class TestWriteCloseOldCompletionCallback : public Callback1<int>::Type { public: - TestWriteCloseCompletionCallback(FileStream* stream, int* total_bytes_written) + TestWriteCloseOldCompletionCallback(FileStream* stream, int* total_bytes_written) : result_(0), have_result_(false), waiting_for_result_(false), @@ -804,7 +804,7 @@ class TestWriteCloseCompletionCallback : public Callback1<int>::Type { if (*total_bytes_written_ != kTestDataSize) { // Recurse to finish writing all data. int total_bytes_written = 0; - TestWriteCloseCompletionCallback callback(stream_, &total_bytes_written); + TestWriteCloseOldCompletionCallback callback(stream_, &total_bytes_written); rv = stream_->Write(kTestData + *total_bytes_written_, kTestDataSize - *total_bytes_written_, &callback); @@ -827,7 +827,7 @@ class TestWriteCloseCompletionCallback : public Callback1<int>::Type { FileStream* stream_; int* total_bytes_written_; - DISALLOW_COPY_AND_ASSIGN(TestWriteCloseCompletionCallback); + DISALLOW_COPY_AND_ASSIGN(TestWriteCloseOldCompletionCallback); }; TEST_F(FileStreamTest, AsyncWriteClose) { @@ -850,7 +850,7 @@ TEST_F(FileStreamTest, AsyncWriteClose) { EXPECT_EQ(offset, file_size); int total_bytes_written = 0; - TestWriteCloseCompletionCallback callback(&stream, &total_bytes_written); + TestWriteCloseOldCompletionCallback callback(&stream, &total_bytes_written); rv = stream.Write(kTestData, kTestDataSize, &callback); if (rv == ERR_IO_PENDING) diff --git a/net/base/file_stream_win.cc b/net/base/file_stream_win.cc index 4e3e66c..86ee202 100644 --- a/net/base/file_stream_win.cc +++ b/net/base/file_stream_win.cc @@ -54,10 +54,10 @@ class FileStream::AsyncContext : public MessageLoopForIO::IOHandler { } ~AsyncContext(); - void IOCompletionIsPending(CompletionCallback* callback); + void IOCompletionIsPending(OldCompletionCallback* callback); OVERLAPPED* overlapped() { return &context_.overlapped; } - CompletionCallback* callback() const { return callback_; } + OldCompletionCallback* callback() const { return callback_; } void set_error_source(FileErrorSource source) { error_source_ = source; } @@ -71,7 +71,7 @@ class FileStream::AsyncContext : public MessageLoopForIO::IOHandler { FileStream* owner_; MessageLoopForIO::IOContext context_; - CompletionCallback* callback_; + OldCompletionCallback* callback_; bool is_closing_; bool record_uma_; FileErrorSource error_source_; @@ -93,7 +93,7 @@ FileStream::AsyncContext::~AsyncContext() { } void FileStream::AsyncContext::IOCompletionIsPending( - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(!callback_); callback_ = callback; } @@ -115,7 +115,7 @@ void FileStream::AsyncContext::OnIOCompleted( if (bytes_read) IncrementOffset(&context->overlapped, bytes_read); - CompletionCallback* temp = NULL; + OldCompletionCallback* temp = NULL; std::swap(temp, callback_); temp->Run(result); } @@ -230,7 +230,7 @@ int64 FileStream::Available() { } int FileStream::Read( - char* buf, int buf_len, CompletionCallback* callback) { + char* buf, int buf_len, OldCompletionCallback* callback) { if (!IsOpen()) return ERR_UNEXPECTED; @@ -292,7 +292,7 @@ int FileStream::ReadUntilComplete(char *buf, int buf_len) { } int FileStream::Write( - const char* buf, int buf_len, CompletionCallback* callback) { + const char* buf, int buf_len, OldCompletionCallback* callback) { if (!IsOpen()) return ERR_UNEXPECTED; diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h index 6831c8d..ea0f891 100644 --- a/net/base/host_resolver.h +++ b/net/base/host_resolver.h @@ -157,7 +157,7 @@ class NET_EXPORT HostResolver { // Profiling information for the request is saved to |net_log| if non-NULL. virtual int Resolve(const RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req, const BoundNetLog& net_log) = 0; diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 7d6e3e2..6cfd788 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -263,7 +263,7 @@ class HostResolverImpl::Request { const BoundNetLog& request_net_log, int id, const RequestInfo& info, - CompletionCallback* callback, + OldCompletionCallback* callback, AddressList* addresses) : source_net_log_(source_net_log), request_net_log_(request_net_log), @@ -294,7 +294,7 @@ class HostResolverImpl::Request { void OnComplete(int error, const AddressList& addrlist) { if (error == OK) *addresses_ = CreateAddressListUsingPort(addrlist, port()); - CompletionCallback* callback = callback_; + OldCompletionCallback* callback = callback_; MarkAsCancelled(); callback->Run(error); } @@ -337,7 +337,7 @@ class HostResolverImpl::Request { Job* job_; // The user's callback to invoke when the request completes. - CompletionCallback* callback_; + OldCompletionCallback* callback_; // The address list to save result into. AddressList* addresses_; @@ -1138,7 +1138,7 @@ void HostResolverImpl::SetPoolConstraints(JobPoolIndex pool_index, int HostResolverImpl::Resolve(const RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req, const BoundNetLog& source_net_log) { DCHECK(addresses); diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h index 4c4581e..36f6fc54 100644 --- a/net/base/host_resolver_impl.h +++ b/net/base/host_resolver_impl.h @@ -136,7 +136,7 @@ class NET_EXPORT HostResolverImpl // HostResolver methods: virtual int Resolve(const RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req, const BoundNetLog& source_net_log) OVERRIDE; virtual int ResolveFromCache(const RequestInfo& info, diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc index 0123adb..df38919 100644 --- a/net/base/host_resolver_impl_unittest.cc +++ b/net/base/host_resolver_impl_unittest.cc @@ -330,7 +330,7 @@ class ResolveRequest { HostResolver* resolver_; Delegate* delegate_; - CompletionCallbackImpl<ResolveRequest> callback_; + OldCompletionCallbackImpl<ResolveRequest> callback_; DISALLOW_COPY_AND_ASSIGN(ResolveRequest); }; @@ -346,7 +346,7 @@ class HostResolverImplTest : public testing::Test { protected: bool callback_called_; int callback_result_; - CompletionCallbackImpl<HostResolverImplTest> callback_; + OldCompletionCallbackImpl<HostResolverImplTest> callback_; private: void OnLookupFinished(int result) { @@ -479,7 +479,7 @@ TEST_F(HostResolverImplTest, NumericIPv4Address) { CreateHostResolverImpl(resolver_proc)); AddressList addrlist; const int kPortnum = 5555; - TestCompletionCallback callback; + TestOldCompletionCallback callback; HostResolver::RequestInfo info(HostPortPair("127.1.2.3", kPortnum)); int err = host_resolver->Resolve(info, &addrlist, &callback, NULL, BoundNetLog()); @@ -506,7 +506,7 @@ TEST_F(HostResolverImplTest, NumericIPv6Address) { CreateHostResolverImpl(resolver_proc)); AddressList addrlist; const int kPortnum = 5555; - TestCompletionCallback callback; + TestOldCompletionCallback callback; HostResolver::RequestInfo info(HostPortPair("2001:db8::1", kPortnum)); int err = host_resolver->Resolve(info, &addrlist, &callback, NULL, BoundNetLog()); @@ -538,7 +538,7 @@ TEST_F(HostResolverImplTest, EmptyHost) { CreateHostResolverImpl(resolver_proc)); AddressList addrlist; const int kPortnum = 5555; - TestCompletionCallback callback; + TestOldCompletionCallback callback; HostResolver::RequestInfo info(HostPortPair("", kPortnum)); int err = host_resolver->Resolve(info, &addrlist, &callback, NULL, BoundNetLog()); @@ -555,7 +555,7 @@ TEST_F(HostResolverImplTest, LongHost) { AddressList addrlist; const int kPortnum = 5555; std::string hostname(4097, 'a'); - TestCompletionCallback callback; + TestOldCompletionCallback callback; HostResolver::RequestInfo info(HostPortPair(hostname, kPortnum)); int err = host_resolver->Resolve(info, &addrlist, &callback, NULL, BoundNetLog()); @@ -905,8 +905,8 @@ class BypassCacheVerifier : public ResolveRequest::Delegate { // Note that |junk_callback| shouldn't be used since we are going to // complete synchronously. We can't specify NULL though since that would // mean synchronous mode so we give it a value of 1. - CompletionCallback* junk_callback = - reinterpret_cast<CompletionCallback*> (1); + OldCompletionCallback* junk_callback = + reinterpret_cast<OldCompletionCallback*> (1); AddressList addrlist; HostResolver::RequestInfo info(HostPortPair("a", 70)); @@ -963,7 +963,7 @@ TEST_F(HostResolverImplTest, Observers) { // Resolve "host1". HostResolver::RequestInfo info1(HostPortPair("host1", 70)); CapturingBoundNetLog log(CapturingNetLog::kUnbounded); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = host_resolver->Resolve(info1, &addrlist, &callback, NULL, log.bound()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1041,7 +1041,7 @@ TEST_F(HostResolverImplTest, CancellationObserver) { CreateHostResolverImpl(NULL)); host_resolver->AddObserver(&observer); - TestCompletionCallback callback; + TestOldCompletionCallback callback; EXPECT_EQ(0U, observer.start_log.size()); EXPECT_EQ(0U, observer.finish_log.size()); @@ -1113,7 +1113,7 @@ TEST_F(HostResolverImplTest, FlushCacheOnIPAddressChange) { // Resolve "host1". HostResolver::RequestInfo info1(HostPortPair("host1", 70)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int rv = host_resolver->Resolve(info1, &addrlist, &callback, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1146,7 +1146,7 @@ TEST_F(HostResolverImplTest, AbortOnIPAddressChanged) { // Resolve "host1". HostResolver::RequestInfo info(HostPortPair("host1", 70)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; AddressList addrlist; int rv = host_resolver->Resolve(info, &addrlist, &callback, NULL, BoundNetLog()); @@ -1176,7 +1176,7 @@ TEST_F(HostResolverImplTest, ObeyPoolConstraintsAfterIPAddressChange) { // Resolve "host1". HostResolver::RequestInfo info(HostPortPair("host1", 70)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; AddressList addrlist; int rv = host_resolver->Resolve(info, &addrlist, &callback, NULL, BoundNetLog()); @@ -1230,8 +1230,8 @@ class ResolveWithinCallback : public CallbackRunner< Tuple1<int> > { MockHostResolver* const host_resolver_; const HostResolver::RequestInfo info_; AddressList addrlist_; - TestCompletionCallback callback_; - TestCompletionCallback nested_callback_; + TestOldCompletionCallback callback_; + TestOldCompletionCallback nested_callback_; }; TEST_F(HostResolverImplTest, OnlyAbortExistingRequestsOnIPAddressChange) { @@ -1287,7 +1287,7 @@ TEST_F(HostResolverImplTest, HigherPriorityRequestsStartedFirst) { CreateResolverRequest("req5", HIGHEST), }; - TestCompletionCallback callback[arraysize(req)]; + TestOldCompletionCallback callback[arraysize(req)]; AddressList addrlist[arraysize(req)]; // Start all of the requests. @@ -1369,7 +1369,7 @@ TEST_F(HostResolverImplTest, CancelPendingRequest) { CreateResolverRequest("req6", MEDIUM), }; - TestCompletionCallback callback[arraysize(req)]; + TestOldCompletionCallback callback[arraysize(req)]; AddressList addrlist[arraysize(req)]; HostResolver::RequestHandle handle[arraysize(req)]; @@ -1445,7 +1445,7 @@ TEST_F(HostResolverImplTest, QueueOverflow) { CreateResolverRequest("req7", MEDIUM), // Evicts req2. }; - TestCompletionCallback callback[arraysize(req)]; + TestOldCompletionCallback callback[arraysize(req)]; AddressList addrlist[arraysize(req)]; HostResolver::RequestHandle handle[arraysize(req)]; @@ -1512,7 +1512,7 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv4) { CreateResolverRequestForAddressFamily("h1", MEDIUM, ADDRESS_FAMILY_IPV6), }; - TestCompletionCallback callback[arraysize(req)]; + TestOldCompletionCallback callback[arraysize(req)]; AddressList addrlist[arraysize(req)]; HostResolver::RequestHandle handle[arraysize(req)]; @@ -1582,7 +1582,7 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv6) { CreateResolverRequestForAddressFamily("h1", MEDIUM, ADDRESS_FAMILY_IPV4), }; - TestCompletionCallback callback[arraysize(req)]; + TestOldCompletionCallback callback[arraysize(req)]; AddressList addrlist[arraysize(req)]; HostResolver::RequestHandle handle[arraysize(req)]; @@ -1644,7 +1644,7 @@ TEST_F(HostResolverImplTest, DisallowNonCachedResponses) { EXPECT_EQ(ERR_DNS_CACHE_MISS, err); // This time, we fetch normally. - TestCompletionCallback callback; + TestOldCompletionCallback callback; err = host_resolver->Resolve(info, &addrlist, &callback, NULL, log.bound()); EXPECT_EQ(ERR_IO_PENDING, err); err = callback.WaitForResult(); @@ -1689,7 +1689,7 @@ TEST_F(HostResolverImplTest, MultipleAttempts) { // Resolve "host1". HostResolver::RequestInfo info(HostPortPair("host1", 70)); - TestCompletionCallback callback; + TestOldCompletionCallback callback; AddressList addrlist; int rv = host_resolver->Resolve(info, &addrlist, &callback, NULL, BoundNetLog()); diff --git a/net/base/mapped_host_resolver.cc b/net/base/mapped_host_resolver.cc index 86912ff..7364f9e 100644 --- a/net/base/mapped_host_resolver.cc +++ b/net/base/mapped_host_resolver.cc @@ -21,7 +21,7 @@ MappedHostResolver::~MappedHostResolver() { int MappedHostResolver::Resolve(const RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req, const BoundNetLog& net_log) { DCHECK(addresses); diff --git a/net/base/mapped_host_resolver.h b/net/base/mapped_host_resolver.h index d49e45f..26459e9 100644 --- a/net/base/mapped_host_resolver.h +++ b/net/base/mapped_host_resolver.h @@ -46,7 +46,7 @@ class NET_EXPORT MappedHostResolver : public HostResolver { // HostResolver methods: virtual int Resolve(const RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req, const BoundNetLog& net_log) OVERRIDE; virtual int ResolveFromCache(const RequestInfo& info, diff --git a/net/base/mapped_host_resolver_unittest.cc b/net/base/mapped_host_resolver_unittest.cc index 2a03287..8144b5c 100644 --- a/net/base/mapped_host_resolver_unittest.cc +++ b/net/base/mapped_host_resolver_unittest.cc @@ -32,7 +32,7 @@ TEST(MappedHostResolverTest, Inclusion) { // Try resolving "www.google.com:80". There are no mappings yet, so this // hits |resolver_impl| and fails. - TestCompletionCallback callback; + TestOldCompletionCallback callback; rv = resolver->Resolve(HostResolver::RequestInfo( HostPortPair("www.google.com", 80)), &address_list, &callback, NULL, BoundNetLog()); @@ -90,7 +90,7 @@ TEST(MappedHostResolverTest, Exclusion) { int rv; AddressList address_list; - TestCompletionCallback callback; + TestOldCompletionCallback callback; // Remap "*.com" to "baz". EXPECT_TRUE(resolver->AddRuleFromString("map *.com baz")); @@ -131,7 +131,7 @@ TEST(MappedHostResolverTest, SetRulesFromString) { int rv; AddressList address_list; - TestCompletionCallback callback; + TestOldCompletionCallback callback; // Remap "*.com" to "baz", and *.net to "bar:60". resolver->SetRulesFromString("map *.com baz , map *.net bar:60"); diff --git a/net/base/mock_file_stream.cc b/net/base/mock_file_stream.cc index 1a8f1b8..19a027f 100644 --- a/net/base/mock_file_stream.cc +++ b/net/base/mock_file_stream.cc @@ -23,7 +23,7 @@ int64 MockFileStream::Available() { int MockFileStream::Read(char* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { return ReturnError(net::FileStream::Read(buf, buf_len, callback)); } @@ -33,7 +33,7 @@ int MockFileStream::ReadUntilComplete(char *buf, int buf_len) { int MockFileStream::Write(const char* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { return ReturnError(net::FileStream::Write(buf, buf_len, callback)); } diff --git a/net/base/mock_file_stream.h b/net/base/mock_file_stream.h index 67f417e..569937e 100644 --- a/net/base/mock_file_stream.h +++ b/net/base/mock_file_stream.h @@ -31,11 +31,11 @@ class MockFileStream : public net::FileStream { virtual int64 Available() OVERRIDE; virtual int Read(char* buf, int buf_len, - net::CompletionCallback* callback) OVERRIDE; + net::OldCompletionCallback* callback) OVERRIDE; virtual int ReadUntilComplete(char *buf, int buf_len) OVERRIDE; virtual int Write(const char* buf, int buf_len, - net::CompletionCallback* callback) OVERRIDE; + net::OldCompletionCallback* callback) OVERRIDE; virtual int64 Truncate(int64 bytes) OVERRIDE; virtual int Flush() OVERRIDE; diff --git a/net/base/mock_host_resolver.cc b/net/base/mock_host_resolver.cc index 6b2aa4c5..2e38dd9 100644 --- a/net/base/mock_host_resolver.cc +++ b/net/base/mock_host_resolver.cc @@ -97,11 +97,11 @@ void MockHostResolverBase::Reset(HostResolverProc* interceptor) { int MockHostResolverBase::Resolve(const RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req, const BoundNetLog& net_log) { if (synchronous_mode_) { - TestCompletionCallback sync_callback; + TestOldCompletionCallback sync_callback; int rv = impl_->Resolve(info, addresses, &sync_callback, out_req, net_log); if (rv == ERR_IO_PENDING) { MessageLoop::ScopedNestableTaskAllower nestable(MessageLoop::current()); diff --git a/net/base/mock_host_resolver.h b/net/base/mock_host_resolver.h index 2fcf892..27360b0 100644 --- a/net/base/mock_host_resolver.h +++ b/net/base/mock_host_resolver.h @@ -61,7 +61,7 @@ class MockHostResolverBase : public HostResolver { // HostResolver methods: virtual int Resolve(const RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req, const BoundNetLog& net_log) OVERRIDE; virtual int ResolveFromCache(const RequestInfo& info, diff --git a/net/base/network_delegate.cc b/net/base/network_delegate.cc index 28d0b31..cb9c06d 100644 --- a/net/base/network_delegate.cc +++ b/net/base/network_delegate.cc @@ -9,7 +9,7 @@ namespace net { int NetworkDelegate::NotifyBeforeURLRequest(URLRequest* request, - CompletionCallback* callback, + OldCompletionCallback* callback, GURL* new_url) { DCHECK(CalledOnValidThread()); DCHECK(request); @@ -18,7 +18,7 @@ int NetworkDelegate::NotifyBeforeURLRequest(URLRequest* request, } int NetworkDelegate::NotifyBeforeSendHeaders(URLRequest* request, - CompletionCallback* callback, + OldCompletionCallback* callback, HttpRequestHeaders* headers) { DCHECK(CalledOnValidThread()); DCHECK(headers); diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h index 2506788..3478cb1 100644 --- a/net/base/network_delegate.h +++ b/net/base/network_delegate.h @@ -39,10 +39,10 @@ class NetworkDelegate : public base::NonThreadSafe { // checking on parameters. See the corresponding virtuals for explanations of // the methods and their arguments. int NotifyBeforeURLRequest(URLRequest* request, - CompletionCallback* callback, + OldCompletionCallback* callback, GURL* new_url); int NotifyBeforeSendHeaders(URLRequest* request, - CompletionCallback* callback, + OldCompletionCallback* callback, HttpRequestHeaders* headers); void NotifySendHeaders(URLRequest* request, const HttpRequestHeaders& headers); @@ -67,7 +67,7 @@ class NetworkDelegate : public base::NonThreadSafe { // status code, generally either OK to continue with the request or // ERR_IO_PENDING if the result is not ready yet. virtual int OnBeforeURLRequest(URLRequest* request, - CompletionCallback* callback, + OldCompletionCallback* callback, GURL* new_url) = 0; // Called right before the HTTP headers are sent. Allows the delegate to @@ -75,7 +75,7 @@ class NetworkDelegate : public base::NonThreadSafe { // valid only until OnHttpTransactionDestroyed is called for this request. // Returns a net status code. virtual int OnBeforeSendHeaders(URLRequest* request, - CompletionCallback* callback, + OldCompletionCallback* callback, HttpRequestHeaders* headers) = 0; // Called right before the HTTP request(s) are being sent to the network. diff --git a/net/base/origin_bound_cert_service.cc b/net/base/origin_bound_cert_service.cc index 8f7c4cb..cd89519 100644 --- a/net/base/origin_bound_cert_service.cc +++ b/net/base/origin_bound_cert_service.cc @@ -36,7 +36,7 @@ const int kValidityPeriodInDays = 365; // Represents the output and result callback of a request. class OriginBoundCertServiceRequest { public: - OriginBoundCertServiceRequest(CompletionCallback* callback, + OriginBoundCertServiceRequest(OldCompletionCallback* callback, std::string* private_key, std::string* cert) : callback_(callback), @@ -67,7 +67,7 @@ class OriginBoundCertServiceRequest { bool canceled() const { return !callback_; } private: - CompletionCallback* callback_; + OldCompletionCallback* callback_; std::string* private_key_; std::string* cert_; }; @@ -259,7 +259,7 @@ OriginBoundCertService::~OriginBoundCertService() { int OriginBoundCertService::GetOriginBoundCert(const std::string& origin, std::string* private_key, std::string* cert, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req) { DCHECK(CalledOnValidThread()); diff --git a/net/base/origin_bound_cert_service.h b/net/base/origin_bound_cert_service.h index a194633..0b5e54c 100644 --- a/net/base/origin_bound_cert_service.h +++ b/net/base/origin_bound_cert_service.h @@ -55,7 +55,7 @@ class NET_EXPORT OriginBoundCertService int GetOriginBoundCert(const std::string& origin, std::string* private_key, std::string* cert, - CompletionCallback* callback, + OldCompletionCallback* callback, RequestHandle* out_req); // Cancels the specified request. |req| is the handle returned by diff --git a/net/base/origin_bound_cert_service_unittest.cc b/net/base/origin_bound_cert_service_unittest.cc index 171e1b9..edc347f 100644 --- a/net/base/origin_bound_cert_service_unittest.cc +++ b/net/base/origin_bound_cert_service_unittest.cc @@ -36,7 +36,7 @@ TEST_F(OriginBoundCertServiceTest, CacheHit) { std::string origin("https://encrypted.google.com:443"); int error; - TestCompletionCallback callback; + TestOldCompletionCallback callback; OriginBoundCertService::RequestHandle request_handle; // Asynchronous completion. @@ -72,7 +72,7 @@ TEST_F(OriginBoundCertServiceTest, StoreCerts) { scoped_ptr<OriginBoundCertService> service( new OriginBoundCertService(new DefaultOriginBoundCertStore(NULL))); int error; - TestCompletionCallback callback; + TestOldCompletionCallback callback; OriginBoundCertService::RequestHandle request_handle; std::string origin1("https://encrypted.google.com:443"); @@ -122,11 +122,11 @@ TEST_F(OriginBoundCertServiceTest, InflightJoin) { int error; std::string private_key_info1, der_cert1; - TestCompletionCallback callback1; + TestOldCompletionCallback callback1; OriginBoundCertService::RequestHandle request_handle1; std::string private_key_info2, der_cert2; - TestCompletionCallback callback2; + TestOldCompletionCallback callback2; OriginBoundCertService::RequestHandle request_handle2; error = service->GetOriginBoundCert( @@ -154,7 +154,7 @@ TEST_F(OriginBoundCertServiceTest, ExtractValuesFromBytes) { std::string origin("https://encrypted.google.com:443"); std::string private_key_info, der_cert; int error; - TestCompletionCallback callback; + TestOldCompletionCallback callback; OriginBoundCertService::RequestHandle request_handle; error = service->GetOriginBoundCert( @@ -198,7 +198,7 @@ TEST_F(OriginBoundCertServiceTest, CancelRequest) { // Issue a few more requests to the worker pool and wait for their // completion, so that the task of the canceled request (which runs on a // worker thread) is likely to complete by the end of this test. - TestCompletionCallback callback; + TestOldCompletionCallback callback; for (int i = 0; i < 5; ++i) { error = service->GetOriginBoundCert( "https://encrypted.google.com:" + std::string(1, (char) ('1' + i)), diff --git a/net/base/single_request_host_resolver.cc b/net/base/single_request_host_resolver.cc index ced4801..5af3dd5 100644 --- a/net/base/single_request_host_resolver.cc +++ b/net/base/single_request_host_resolver.cc @@ -25,7 +25,7 @@ SingleRequestHostResolver::~SingleRequestHostResolver() { int SingleRequestHostResolver::Resolve(const HostResolver::RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log) { DCHECK(addresses); DCHECK(callback); @@ -35,7 +35,7 @@ int SingleRequestHostResolver::Resolve(const HostResolver::RequestInfo& info, // We need to be notified of completion before |callback| is called, so that // we can clear out |cur_request_*|. - CompletionCallback* transient_callback = callback ? &callback_ : NULL; + OldCompletionCallback* transient_callback = callback ? &callback_ : NULL; int rv = resolver_->Resolve( info, addresses, transient_callback, &request, net_log); @@ -61,7 +61,7 @@ void SingleRequestHostResolver::Cancel() { void SingleRequestHostResolver::OnResolveCompletion(int result) { DCHECK(cur_request_ && cur_request_callback_); - CompletionCallback* callback = cur_request_callback_; + OldCompletionCallback* callback = cur_request_callback_; // Clear the outstanding request information. cur_request_ = NULL; diff --git a/net/base/single_request_host_resolver.h b/net/base/single_request_host_resolver.h index 63f1a33..fb5c91e 100644 --- a/net/base/single_request_host_resolver.h +++ b/net/base/single_request_host_resolver.h @@ -27,7 +27,7 @@ class NET_EXPORT SingleRequestHostResolver { // |addresses| object upon success. See HostResolver::Resolve() for details. int Resolve(const HostResolver::RequestInfo& info, AddressList* addresses, - CompletionCallback* callback, + OldCompletionCallback* callback, const BoundNetLog& net_log); // Cancels the in-progress request, if any. This prevents the callback @@ -44,10 +44,10 @@ class NET_EXPORT SingleRequestHostResolver { // The current request (if any). HostResolver::RequestHandle cur_request_; - CompletionCallback* cur_request_callback_; + OldCompletionCallback* cur_request_callback_; // Completion callback for when request to |resolver_| completes. - CompletionCallbackImpl<SingleRequestHostResolver> callback_; + OldCompletionCallbackImpl<SingleRequestHostResolver> callback_; DISALLOW_COPY_AND_ASSIGN(SingleRequestHostResolver); }; diff --git a/net/base/single_request_host_resolver_unittest.cc b/net/base/single_request_host_resolver_unittest.cc index abf8348..2fb781f 100644 --- a/net/base/single_request_host_resolver_unittest.cc +++ b/net/base/single_request_host_resolver_unittest.cc @@ -30,7 +30,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 { EXPECT_FALSE(has_outstanding_request()); @@ -80,7 +80,7 @@ TEST(SingleRequestHostResolverTest, NormalResolve) { // Resolve "watsup:90" using our SingleRequestHostResolver. AddressList addrlist; - TestCompletionCallback callback; + TestOldCompletionCallback callback; HostResolver::RequestInfo request(HostPortPair("watsup", 90)); int rv = single_request_resolver.Resolve( request, &addrlist, &callback, BoundNetLog()); @@ -100,7 +100,7 @@ TEST(SingleRequestHostResolverTest, Cancel) { // Resolve "watsup:90" using our SingleRequestHostResolver. AddressList addrlist; - TestCompletionCallback callback; + TestOldCompletionCallback callback; HostResolver::RequestInfo request(HostPortPair("watsup", 90)); int rv = single_request_resolver.Resolve( request, &addrlist, &callback, BoundNetLog()); diff --git a/net/base/test_completion_callback.cc b/net/base/test_completion_callback.cc index 999a71e..b994bc3 100644 --- a/net/base/test_completion_callback.cc +++ b/net/base/test_completion_callback.cc @@ -7,15 +7,15 @@ #include "base/message_loop.h" #include "net/base/net_errors.h" -TestCompletionCallback::TestCompletionCallback() +TestOldCompletionCallback::TestOldCompletionCallback() : result_(0), have_result_(false), waiting_for_result_(false) { } -TestCompletionCallback::~TestCompletionCallback() {} +TestOldCompletionCallback::~TestOldCompletionCallback() {} -int TestCompletionCallback::WaitForResult() { +int TestOldCompletionCallback::WaitForResult() { DCHECK(!waiting_for_result_); while (!have_result_) { waiting_for_result_ = true; @@ -26,13 +26,13 @@ int TestCompletionCallback::WaitForResult() { return result_; } -int TestCompletionCallback::GetResult(int result) { +int TestOldCompletionCallback::GetResult(int result) { if (net::ERR_IO_PENDING != result) return result; return WaitForResult(); } -void TestCompletionCallback::RunWithParams(const Tuple1<int>& params) { +void TestOldCompletionCallback::RunWithParams(const Tuple1<int>& params) { result_ = params.a; have_result_ = true; if (waiting_for_result_) diff --git a/net/base/test_completion_callback.h b/net/base/test_completion_callback.h index fe38e92..520c5b6 100644 --- a/net/base/test_completion_callback.h +++ b/net/base/test_completion_callback.h @@ -20,10 +20,10 @@ // there could be other side-effects resulting from WaitForResult. For this // reason, this class is probably not ideal for a general application. // -class TestCompletionCallback : public CallbackRunner< Tuple1<int> > { +class TestOldCompletionCallback : public CallbackRunner< Tuple1<int> > { public: - TestCompletionCallback(); - virtual ~TestCompletionCallback(); + TestOldCompletionCallback(); + virtual ~TestOldCompletionCallback(); int WaitForResult(); diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc index 1b9d71d..20ca596 100644 --- a/net/base/test_completion_callback_unittest.cc +++ b/net/base/test_completion_callback_unittest.cc @@ -13,9 +13,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" -typedef PlatformTest TestCompletionCallbackTest; +typedef PlatformTest TestOldCompletionCallbackTest; -using net::CompletionCallback; +using net::OldCompletionCallback; const int kMagicResult = 8888; @@ -30,7 +30,7 @@ class ExampleEmployer { // Do some imaginary work on a worker thread; // when done, worker posts callback on the original thread. // Returns true on success - bool DoSomething(CompletionCallback* callback); + bool DoSomething(OldCompletionCallback* callback); private: class ExampleWorker; @@ -43,7 +43,7 @@ class ExampleEmployer { class ExampleEmployer::ExampleWorker : public base::RefCountedThreadSafe<ExampleWorker> { public: - ExampleWorker(ExampleEmployer* employer, CompletionCallback* callback) + ExampleWorker(ExampleEmployer* employer, OldCompletionCallback* callback) : employer_(employer), callback_(callback), origin_loop_(MessageLoop::current()) { } @@ -56,7 +56,7 @@ class ExampleEmployer::ExampleWorker // Only used on the origin thread (where DoSomething was called). ExampleEmployer* employer_; - CompletionCallback* callback_; + OldCompletionCallback* callback_; // Used to post ourselves onto the origin thread. base::Lock origin_loop_lock_; MessageLoop* origin_loop_; @@ -99,7 +99,7 @@ ExampleEmployer::ExampleEmployer() { ExampleEmployer::~ExampleEmployer() { } -bool ExampleEmployer::DoSomething(CompletionCallback* callback) { +bool ExampleEmployer::DoSomething(OldCompletionCallback* callback) { DCHECK(!request_) << "already in use"; request_ = new ExampleWorker(this, callback); @@ -115,9 +115,9 @@ bool ExampleEmployer::DoSomething(CompletionCallback* callback) { return true; } -TEST_F(TestCompletionCallbackTest, Simple) { +TEST_F(TestOldCompletionCallbackTest, Simple) { ExampleEmployer boss; - TestCompletionCallback callback; + TestOldCompletionCallback callback; bool queued = boss.DoSomething(&callback); EXPECT_EQ(queued, true); int result = callback.WaitForResult(); |