summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authortyoshino@chromium.org <tyoshino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-06 22:44:31 +0000
committertyoshino@chromium.org <tyoshino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-06 22:44:31 +0000
commitfc540f87b926d523418b197f8504f001d9316b2d (patch)
tree67e3db8cae3c26def36afa836c55b1f0142501af /webkit
parent4cf4f597760cd706fc6826f13d4c1ca28fe557f2 (diff)
downloadchromium_src-fc540f87b926d523418b197f8504f001d9316b2d.zip
chromium_src-fc540f87b926d523418b197f8504f001d9316b2d.tar.gz
chromium_src-fc540f87b926d523418b197f8504f001d9316b2d.tar.bz2
BlobURLRequestJob clean up for readability
- More comments on members - clear error_ in DidStart - eliminate headers_set_ TEST= out/Debug/content_unittests --gtest_filter='BlobURLRequestJob*' webkit/tools/layout_tests/run_webkit_tests.sh --debug 'fast/files/*' Review URL: https://chromiumcodereview.appspot.com/16457003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204635 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/browser/blob/blob_url_request_job.cc7
-rw-r--r--webkit/browser/blob/blob_url_request_job.h12
2 files changed, 14 insertions, 5 deletions
diff --git a/webkit/browser/blob/blob_url_request_job.cc b/webkit/browser/blob/blob_url_request_job.cc
index 66d9c42..e41b976 100644
--- a/webkit/browser/blob/blob_url_request_job.cc
+++ b/webkit/browser/blob/blob_url_request_job.cc
@@ -78,7 +78,6 @@ BlobURLRequestJob::BlobURLRequestJob(
current_item_index_(0),
current_item_offset_(0),
error_(false),
- headers_set_(false),
byte_range_set_(false) {
DCHECK(file_thread_proxy_.get());
}
@@ -171,6 +170,8 @@ BlobURLRequestJob::~BlobURLRequestJob() {
}
void BlobURLRequestJob::DidStart() {
+ error_ = false;
+
// We only support GET request per the spec.
if (request()->method() != "GET") {
NotifyFailure(net::ERR_METHOD_NOT_SUPPORTED);
@@ -200,7 +201,6 @@ bool BlobURLRequestJob::AddItemLength(size_t index, int64 item_length) {
}
void BlobURLRequestJob::CountSize() {
- error_ = false;
pending_get_file_info_count_ = 0;
total_size_ = 0;
item_length_list_.resize(blob_data_->items().size());
@@ -490,7 +490,7 @@ void BlobURLRequestJob::NotifyFailure(int error_code) {
// If we already return the headers on success, we can't change the headers
// now. Instead, we just error out.
- if (headers_set_) {
+ if (response_info_) {
NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
error_code));
return;
@@ -559,7 +559,6 @@ void BlobURLRequestJob::HeadersCompleted(int status_code,
response_info_->headers = headers;
set_expected_content_size(remaining_bytes_);
- headers_set_ = true;
NotifyHeadersComplete();
}
diff --git a/webkit/browser/blob/blob_url_request_job.h b/webkit/browser/blob/blob_url_request_job.h
index 699a449..e59a067 100644
--- a/webkit/browser/blob/blob_url_request_job.h
+++ b/webkit/browser/blob/blob_url_request_job.h
@@ -82,6 +82,8 @@ class WEBKIT_STORAGE_EXPORT BlobURLRequestJob : public net::URLRequestJob {
int ComputeBytesToRead() const;
int BytesReadCompleted();
+ // These methods convert the result of blob data reading into response headers
+ // and pass it to URLRequestJob's NotifyDone() or NotifyHeadersComplete().
void NotifySuccess();
void NotifyFailure(int);
void HeadersCompleted(int status_code, const std::string& status_txt);
@@ -94,7 +96,10 @@ class WEBKIT_STORAGE_EXPORT BlobURLRequestJob : public net::URLRequestJob {
void CreateFileStreamReader(size_t index, int64 additional_offset);
base::WeakPtrFactory<BlobURLRequestJob> weak_factory_;
+
scoped_refptr<BlobData> blob_data_;
+
+ // Variables for controlling read from |blob_data_|.
scoped_refptr<fileapi::FileSystemContext> file_system_context_;
scoped_refptr<base::MessageLoopProxy> file_thread_proxy_;
std::vector<int64> item_length_list_;
@@ -104,11 +109,16 @@ class WEBKIT_STORAGE_EXPORT BlobURLRequestJob : public net::URLRequestJob {
IndexToReaderMap index_to_reader_;
size_t current_item_index_;
int64 current_item_offset_;
+
+ // Holds the buffer for read data with the IOBuffer interface.
scoped_refptr<net::DrainableIOBuffer> read_buf_;
+
+ // Is set when NotifyFailure() is called and reset when DidStart is called.
bool error_;
- bool headers_set_;
+
bool byte_range_set_;
net::HttpByteRange byte_range_;
+
scoped_ptr<net::HttpResponseInfo> response_info_;
DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob);