diff options
author | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 18:20:56 +0000 |
---|---|---|
committer | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 18:20:56 +0000 |
commit | d7db4f62b576074b5b5f62d156e335855dc51bdb (patch) | |
tree | ab1dbcbdf199ac0a8eaec3e2ad49753d216d42b3 /net/url_request | |
parent | f7bc735b65da49b5df9fb82a69dcbab08ebb1061 (diff) | |
download | chromium_src-d7db4f62b576074b5b5f62d156e335855dc51bdb.zip chromium_src-d7db4f62b576074b5b5f62d156e335855dc51bdb.tar.gz chromium_src-d7db4f62b576074b5b5f62d156e335855dc51bdb.tar.bz2 |
Use ByteStream in downloads system to decouple source and sink.
BUG=123192
BUG=93006
BUG=111588
Review URL: https://chromiumcodereview.appspot.com/10392111
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request_test_job.cc | 9 | ||||
-rw-r--r-- | net/url_request/url_request_test_job.h | 8 |
2 files changed, 16 insertions, 1 deletions
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc index 4a0ba6e..94a6bf5 100644 --- a/net/url_request/url_request_test_job.cc +++ b/net/url_request/url_request_test_job.cc @@ -247,6 +247,11 @@ void URLRequestTestJob::ProcessNextOperation() { if (!ReadRawData(async_buf_, async_buf_size_, &bytes_read)) NOTREACHED() << "This should not return false in DATA_AVAILABLE."; SetStatus(URLRequestStatus()); // clear the io pending flag + if (NextReadAsync()) { + // Make all future reads return io pending until the next + // ProcessNextOperation(). + stage_ = WAITING; + } NotifyReadComplete(bytes_read); } break; @@ -265,6 +270,10 @@ void URLRequestTestJob::ProcessNextOperation() { } } +bool URLRequestTestJob::NextReadAsync() { + return false; +} + void URLRequestTestJob::AdvanceJob() { if (auto_advance_) { MessageLoop::current()->PostTask( diff --git a/net/url_request/url_request_test_job.h b/net/url_request/url_request_test_job.h index 81e41be..1b4dec8 100644 --- a/net/url_request/url_request_test_job.h +++ b/net/url_request/url_request_test_job.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -104,6 +104,12 @@ class NET_EXPORT_PRIVATE URLRequestTestJob : public URLRequestJob { int* http_status_code) OVERRIDE; protected: + // Override to specify whether the next read done from this job will + // return IO pending. This controls whether or not the WAITING state will + // transition back to WAITING or to DATA_AVAILABLE after an asynchronous + // read is processed. + virtual bool NextReadAsync(); + // This is what operation we are going to do next when this job is handled. // When the stage is DONE, this job will not be put on the queue. enum Stage { WAITING, DATA_AVAILABLE, ALL_DATA, DONE }; |