summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-07 14:15:36 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-07 14:15:36 +0000
commit2c5c9d596ad422529c88b47db2b60eff9410cde0 (patch)
tree0625f8f8cb92d6c5ec93efb6892beb13bc6a43bb /net/base
parent4ba14e1044e2e837a8c81894df156e4fd4be86bd (diff)
downloadchromium_src-2c5c9d596ad422529c88b47db2b60eff9410cde0.zip
chromium_src-2c5c9d596ad422529c88b47db2b60eff9410cde0.tar.gz
chromium_src-2c5c9d596ad422529c88b47db2b60eff9410cde0.tar.bz2
Reverts a commit that caused ASAN failures, and 2 dependent commits.
The primary commit was 113249, the dependents were 113261, 113263. This is a speculative revert, r113249 is by far the likeliest culprit in the blamelist of build http://build.chromium.org/p/chromium.memory/builders/ASAN%20Tests%20%282%29/builds/2325 which is where we started seeing the ASAN failures in question, will un-revert if it does not fix the problem. TBR=jhawkins@chromium.org BUG=none Review URL: http://codereview.chromium.org/8832006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/test_completion_callback.cc37
-rw-r--r--net/base/test_completion_callback.h42
2 files changed, 35 insertions, 44 deletions
diff --git a/net/base/test_completion_callback.cc b/net/base/test_completion_callback.cc
index 9d1de1a..6851a7c 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
diff --git a/net/base/test_completion_callback.h b/net/base/test_completion_callback.h
index 888c610..a192194 100644
--- a/net/base/test_completion_callback.h
+++ b/net/base/test_completion_callback.h
@@ -22,51 +22,45 @@
// there could be other side-effects resulting from WaitForResult. For this
// reason, this class is probably not ideal for a general application.
//
-
-// Base class overridden by custom implementations of TestCompletionCallback.
-class TestCompletionCallbackBase {
+class TestOldCompletionCallback : public CallbackRunner< Tuple1<int> > {
public:
- void SetResult(int result);
+ TestOldCompletionCallback();
+ virtual ~TestOldCompletionCallback();
+
int WaitForResult();
+
int GetResult(int result);
+
bool have_result() const { return have_result_; }
- protected:
- TestCompletionCallbackBase();
+ virtual void RunWithParams(const Tuple1<int>& params) OVERRIDE;
+ private:
int result_;
bool have_result_;
bool waiting_for_result_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestCompletionCallbackBase);
-};
-
-class TestOldCompletionCallback : public TestCompletionCallbackBase,
- public CallbackRunner< Tuple1<int> > {
- public:
- TestOldCompletionCallback() {};
- virtual ~TestOldCompletionCallback() {}
-
- virtual void RunWithParams(const Tuple1<int>& params) OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestOldCompletionCallback);
};
namespace net {
-class TestCompletionCallback : public TestCompletionCallbackBase {
+class TestCompletionCallback {
public:
TestCompletionCallback();
~TestCompletionCallback();
+ int WaitForResult() { return old_callback_impl_.WaitForResult(); }
+
+ int GetResult(int result) { return old_callback_impl_.GetResult(result); }
+
+ bool have_result() const { return old_callback_impl_.have_result(); }
+
const CompletionCallback& callback() const { return callback_; }
private:
- const CompletionCallback callback_;
+ void OnComplete(int result);
- DISALLOW_COPY_AND_ASSIGN(TestCompletionCallback);
+ const CompletionCallback callback_;
+ TestOldCompletionCallback old_callback_impl_;
};
} // namespace net