| Index: net/url_request/url_request_file_dir_job.cc
|
| diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc
|
| index badb6b8776ac1e84a9a69390ad67a59eaa182d2c..1cc15be9fd7e5bcc168f0be64cd9631725fb42d1 100644
|
| --- a/net/url_request/url_request_file_dir_job.cc
|
| +++ b/net/url_request/url_request_file_dir_job.cc
|
| @@ -33,20 +33,6 @@ URLRequestFileDirJob::URLRequestFileDirJob(URLRequest* request,
|
| ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
|
| }
|
|
|
| -URLRequestFileDirJob::~URLRequestFileDirJob() {
|
| - DCHECK(read_pending_ == false);
|
| - DCHECK(lister_ == NULL);
|
| -}
|
| -
|
| -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,
|
| - method_factory_.NewRunnableMethod(
|
| - &URLRequestFileDirJob::StartAsync));
|
| -}
|
| -
|
| void URLRequestFileDirJob::StartAsync() {
|
| DCHECK(!lister_);
|
|
|
| @@ -63,6 +49,15 @@ void URLRequestFileDirJob::StartAsync() {
|
| NotifyHeadersComplete();
|
| }
|
|
|
| +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,
|
| + method_factory_.NewRunnableMethod(
|
| + &URLRequestFileDirJob::StartAsync));
|
| +}
|
| +
|
| void URLRequestFileDirJob::Kill() {
|
| if (canceled_)
|
| return;
|
| @@ -174,6 +169,11 @@ void URLRequestFileDirJob::OnListDone(int error) {
|
| Release(); // The Lister is finished; may delete *this*
|
| }
|
|
|
| +URLRequestFileDirJob::~URLRequestFileDirJob() {
|
| + DCHECK(read_pending_ == false);
|
| + DCHECK(lister_ == NULL);
|
| +}
|
| +
|
| void URLRequestFileDirJob::CloseLister() {
|
| if (lister_) {
|
| lister_->Cancel();
|
| @@ -182,25 +182,6 @@ void URLRequestFileDirJob::CloseLister() {
|
| }
|
| }
|
|
|
| -bool URLRequestFileDirJob::FillReadBuffer(char *buf, int buf_size,
|
| - int *bytes_read) {
|
| - DCHECK(bytes_read);
|
| -
|
| - *bytes_read = 0;
|
| -
|
| - int count = std::min(buf_size, static_cast<int>(data_.size()));
|
| - if (count) {
|
| - memcpy(buf, &data_[0], count);
|
| - data_.erase(0, count);
|
| - *bytes_read = count;
|
| - return true;
|
| - } else if (list_complete_) {
|
| - // EOF
|
| - return true;
|
| - }
|
| - return false;
|
| -}
|
| -
|
| void URLRequestFileDirJob::CompleteRead() {
|
| if (read_pending_) {
|
| int bytes_read;
|
| @@ -221,4 +202,23 @@ void URLRequestFileDirJob::CompleteRead() {
|
| }
|
| }
|
|
|
| +bool URLRequestFileDirJob::FillReadBuffer(char *buf, int buf_size,
|
| + int *bytes_read) {
|
| + DCHECK(bytes_read);
|
| +
|
| + *bytes_read = 0;
|
| +
|
| + int count = std::min(buf_size, static_cast<int>(data_.size()));
|
| + if (count) {
|
| + memcpy(buf, &data_[0], count);
|
| + data_.erase(0, count);
|
| + *bytes_read = count;
|
| + return true;
|
| + } else if (list_complete_) {
|
| + // EOF
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| } // namespace net
|
|
|