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

Unified Diff: net/base/test_completion_callback.cc

Issue 8832006: Reverts a commit that caused ASAN failures, and 2 dependent commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/test_completion_callback.h ('k') | net/disk_cache/backend_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/test_completion_callback.cc
diff --git a/net/base/test_completion_callback.cc b/net/base/test_completion_callback.cc
index 9d1de1a932ec2abe5bbb01921879e7e486e0ed50..6851a7c2873eefa4a69aa4e78a002dd7ba7bb9d5 100644
--- a/net/base/test_completion_callback.cc
+++ b/net/base/test_completion_callback.cc
@@ -9,53 +9,50 @@
#include "base/message_loop.h"
#include "net/base/net_errors.h"
-void TestCompletionCallbackBase::SetResult(int result) {
- result_ = result;
- have_result_ = true;
- if (waiting_for_result_)
- MessageLoop::current()->Quit();
+TestOldCompletionCallback::TestOldCompletionCallback()
+ : result_(0),
+ have_result_(false),
+ waiting_for_result_(false) {
}
-int TestCompletionCallbackBase::WaitForResult() {
- DCHECK(!waiting_for_result_);
+TestOldCompletionCallback::~TestOldCompletionCallback() {}
+int TestOldCompletionCallback::WaitForResult() {
+ DCHECK(!waiting_for_result_);
while (!have_result_) {
- printf("waiting\n");
waiting_for_result_ = true;
MessageLoop::current()->Run();
waiting_for_result_ = false;
}
-
- have_result_ = false; // Auto-reset for next callback.
+ have_result_ = false; // auto-reset for next callback
return result_;
}
-int TestCompletionCallbackBase::GetResult(int result) {
+int TestOldCompletionCallback::GetResult(int result) {
if (net::ERR_IO_PENDING != result)
return result;
-
return WaitForResult();
}
-TestCompletionCallbackBase::TestCompletionCallbackBase()
- : result_(0),
- have_result_(false),
- waiting_for_result_(false) {
-}
-
void TestOldCompletionCallback::RunWithParams(const Tuple1<int>& params) {
- SetResult(params.a);
+ result_ = params.a;
+ have_result_ = true;
+ if (waiting_for_result_)
+ MessageLoop::current()->Quit();
}
namespace net {
TestCompletionCallback::TestCompletionCallback()
: ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
- base::Bind(&TestCompletionCallback::SetResult,
+ base::Bind(&TestCompletionCallback::OnComplete,
base::Unretained(this)))) {
}
TestCompletionCallback::~TestCompletionCallback() {}
+void TestCompletionCallback::OnComplete(int result) {
+ old_callback_impl_.RunWithParams(Tuple1<int>(result));
+}
} // namespace net
« no previous file with comments | « net/base/test_completion_callback.h ('k') | net/disk_cache/backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698