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

Unified Diff: net/base/completion_callback.h

Issue 21236: Revert cl 9528 to fix mac test_shell_tests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 months 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 | « no previous file | net/base/io_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/completion_callback.h
===================================================================
--- net/base/completion_callback.h (revision 9528)
+++ net/base/completion_callback.h (working copy)
@@ -6,6 +6,7 @@
#define NET_BASE_COMPLETION_CALLBACK_H__
#include "base/task.h"
+#include "net/base/io_buffer.h"
namespace net {
@@ -41,8 +42,23 @@
is_canceled_ = true;
}
+ // Attaches the given buffer to this callback so it is valid until the
+ // operation completes. TODO(rvargas): This is a temporal fix for bug 5325
+ // while I send IOBuffer to the lower layers of code.
+ void UseBuffer(net::IOBuffer* buffer) {
+ DCHECK(!buffer_.get());
+ buffer_ = buffer;
+ }
+
+ // The callback is not expected anymore so release the buffer.
+ void ReleaseBuffer() {
+ DCHECK(buffer_.get());
+ buffer_ = NULL;
+ }
+
virtual void RunWithParams(const Tuple1<int>& params) {
if (is_canceled_) {
+ CancelableCompletionCallback<T>::ReleaseBuffer();
base::RefCounted<CancelableCompletionCallback<T> >::Release();
} else {
CompletionCallbackImpl<T>::RunWithParams(params);
@@ -50,6 +66,7 @@
}
private:
+ scoped_refptr<net::IOBuffer> buffer_;
bool is_canceled_;
};
« no previous file with comments | « no previous file | net/base/io_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698