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

Unified Diff: storage/browser/blob/blob_url_request_job.h

Issue 1337153002: [Blob] BlobReader class & tests, and removal of all redundant reading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed prod/debug flakiness Created 5 years, 3 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 | « storage/browser/blob/blob_storage_context.cc ('k') | storage/browser/blob/blob_url_request_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/blob/blob_url_request_job.h
diff --git a/storage/browser/blob/blob_url_request_job.h b/storage/browser/blob/blob_url_request_job.h
index 74d07ada58df6fbd4194f6ffcba8ead490865e80..21baa2cea9d214ecd737adff10a3035fe5e04062 100644
--- a/storage/browser/blob/blob_url_request_job.h
+++ b/storage/browser/blob/blob_url_request_job.h
@@ -13,7 +13,6 @@
#include "net/http/http_byte_range.h"
#include "net/http/http_status_code.h"
#include "net/url_request/url_request_job.h"
-#include "storage/browser/blob/blob_data_snapshot.h"
#include "storage/browser/storage_browser_export.h"
namespace base {
@@ -27,6 +26,8 @@ class IOBuffer;
namespace storage {
+class BlobDataHandle;
+class BlobReader;
class FileStreamReader;
class FileSystemContext;
@@ -36,7 +37,7 @@ class STORAGE_EXPORT BlobURLRequestJob
public:
BlobURLRequestJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
- scoped_ptr<BlobDataSnapshot> blob_data,
+ BlobDataHandle* blob_handle,
storage::FileSystemContext* file_system_context,
base::SingleThreadTaskRunner* resolving_thread_task_runner);
@@ -57,68 +58,20 @@ class STORAGE_EXPORT BlobURLRequestJob
// For preparing for read: get the size, apply the range and perform seek.
void DidStart();
- bool AddItemLength(size_t index, int64 item_length);
- bool CountSize();
- void DidCountSize(int error);
- void DidGetFileItemLength(size_t index, int64 result);
- void Seek(int64 offset);
-
- // For reading the blob.
- bool ReadLoop(int* bytes_read);
- bool ReadItem();
- void AdvanceItem();
- void AdvanceBytesRead(int result);
- bool ReadBytesItem(const BlobDataItem& item, int bytes_to_read);
-
- bool ReadFileItem(FileStreamReader* reader, int bytes_to_read);
- void DidReadFile(int chunk_number, int result);
- void DeleteCurrentFileReader();
-
- bool ReadDiskCacheEntryItem(const BlobDataItem& item, int bytes_to_read);
- void DidReadDiskCacheEntry(int result);
-
- 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 DidCalculateSize(int result);
+ void DidReadRawData(int result);
+
void NotifyFailure(int);
void HeadersCompleted(net::HttpStatusCode status_code);
- // Returns a FileStreamReader for a blob item at |index|.
- // If the item at |index| is not of file this returns NULL.
- FileStreamReader* GetFileStreamReader(size_t index);
-
- // Creates a FileStreamReader for the item at |index| with additional_offset.
- // If failed, then returns false.
- bool CreateFileStreamReader(size_t index, int64 additional_offset);
-
- scoped_ptr<BlobDataSnapshot> blob_data_;
-
- // Variables for controlling read from |blob_data_|.
- scoped_refptr<storage::FileSystemContext> file_system_context_;
- scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
- std::vector<int64> item_length_list_;
- int64 total_size_;
- int64 remaining_bytes_;
- int pending_get_file_info_count_;
- 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 byte_range_set_;
net::HttpByteRange byte_range_;
- // Used to create unique id's for tracing.
- int current_file_chunk_number_;
-
+ scoped_ptr<BlobDataHandle> blob_handle_;
+ scoped_ptr<BlobReader> blob_reader_;
scoped_ptr<net::HttpResponseInfo> response_info_;
base::WeakPtrFactory<BlobURLRequestJob> weak_factory_;
« no previous file with comments | « storage/browser/blob/blob_storage_context.cc ('k') | storage/browser/blob/blob_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698