summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_file_dir_job.cc
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-05-11 20:53:37 +0100
committerKristian Monsen <kristianm@google.com>2011-05-16 13:54:48 +0100
commit21d179b334e59e9a3bfcaed4c4430bef1bc5759d (patch)
tree64e2bb6da27af6a5c93ca34f6051584aafbfcb9e /net/url_request/url_request_file_dir_job.cc
parent0c63f00edd6ed0482fd5cbcea937ca088baf7858 (diff)
downloadexternal_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.zip
external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.gz
external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.bz2
Merge Chromium at 10.0.621.0: Initial merge by git.
Change-Id: I070cc91c608dfa4a968a5a54c173260765ac8097
Diffstat (limited to 'net/url_request/url_request_file_dir_job.cc')
-rw-r--r--net/url_request/url_request_file_dir_job.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc
index 23ff6ff..553add8 100644
--- a/net/url_request/url_request_file_dir_job.cc
+++ b/net/url_request/url_request_file_dir_job.cc
@@ -4,6 +4,7 @@
#include "net/url_request/url_request_file_dir_job.h"
+#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/sys_string_conversions.h"
@@ -20,15 +21,16 @@
using std::string;
-URLRequestFileDirJob::URLRequestFileDirJob(URLRequest* request,
+URLRequestFileDirJob::URLRequestFileDirJob(net::URLRequest* request,
const FilePath& dir_path)
- : URLRequestJob(request),
+ : net::URLRequestJob(request),
dir_path_(dir_path),
canceled_(false),
list_complete_(false),
wrote_header_(false),
read_pending_(false),
- read_buffer_length_(0) {
+ read_buffer_length_(0),
+ ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
}
URLRequestFileDirJob::~URLRequestFileDirJob() {
@@ -39,13 +41,18 @@ URLRequestFileDirJob::~URLRequestFileDirJob() {
void URLRequestFileDirJob::Start() {
// Start reading asynchronously so that all error reporting and data
// callbacks happen as they would for network requests.
- MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
- this, &URLRequestFileDirJob::StartAsync));
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ method_factory_.NewRunnableMethod(
+ &URLRequestFileDirJob::StartAsync));
}
void URLRequestFileDirJob::StartAsync() {
DCHECK(!lister_);
+ // TODO(willchan): This is stupid. We should tell |lister_| not to call us
+ // back. Fix this stupidity.
+
// AddRef so that *this* cannot be destroyed while the lister_
// is trying to feed us data.
@@ -62,13 +69,15 @@ void URLRequestFileDirJob::Kill() {
canceled_ = true;
- // Don't call CloseLister or dispatch an error to the URLRequest because we
- // want OnListDone to be called to also write the error to the output stream.
- // OnListDone will notify the URLRequest at this time.
+ // Don't call CloseLister or dispatch an error to the net::URLRequest because
+ // we want OnListDone to be called to also write the error to the output
+ // stream. OnListDone will notify the net::URLRequest at this time.
if (lister_)
lister_->Cancel();
- URLRequestJob::Kill();
+ net::URLRequestJob::Kill();
+
+ method_factory_.RevokeAll();
}
bool URLRequestFileDirJob::ReadRawData(net::IOBuffer* buf, int buf_size,