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

Side by Side Diff: storage/browser/blob/blob_url_request_job.h

Issue 1108083002: Create blobs from Disk Cache entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NULL --> nullptr Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_
6 #define STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ 6 #define STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector>
9 10
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "net/http/http_byte_range.h" 13 #include "net/http/http_byte_range.h"
13 #include "net/http/http_status_code.h" 14 #include "net/http/http_status_code.h"
14 #include "net/url_request/url_request_job.h" 15 #include "net/url_request/url_request_job.h"
15 #include "storage/browser/blob/blob_data_snapshot.h" 16 #include "storage/browser/blob/blob_data_snapshot.h"
16 #include "storage/browser/storage_browser_export.h" 17 #include "storage/browser/storage_browser_export.h"
17 18
18 namespace base { 19 namespace base {
19 class SingleThreadTaskRunner; 20 class SingleThreadTaskRunner;
20 } 21 }
21 22
22 namespace storage {
23 class FileSystemContext;
24 }
25
26 namespace net { 23 namespace net {
27 class DrainableIOBuffer; 24 class DrainableIOBuffer;
28 class IOBuffer; 25 class IOBuffer;
29 } 26 }
30 27
31 namespace storage { 28 namespace storage {
32 29
33 class FileStreamReader; 30 class FileStreamReader;
31 class FileSystemContext;
34 32
35 // A request job that handles reading blob URLs. 33 // A request job that handles reading blob URLs.
36 class STORAGE_EXPORT BlobURLRequestJob 34 class STORAGE_EXPORT BlobURLRequestJob
37 : public net::URLRequestJob { 35 : public net::URLRequestJob {
38 public: 36 public:
39 BlobURLRequestJob(net::URLRequest* request, 37 BlobURLRequestJob(net::URLRequest* request,
40 net::NetworkDelegate* network_delegate, 38 net::NetworkDelegate* network_delegate,
41 scoped_ptr<BlobDataSnapshot> blob_data, 39 scoped_ptr<BlobDataSnapshot> blob_data,
42 storage::FileSystemContext* file_system_context, 40 storage::FileSystemContext* file_system_context,
43 base::SingleThreadTaskRunner* resolving_thread_task_runner); 41 base::SingleThreadTaskRunner* resolving_thread_task_runner);
(...skipping 20 matching lines...) Expand all
64 void DidCountSize(int error); 62 void DidCountSize(int error);
65 void DidGetFileItemLength(size_t index, int64 result); 63 void DidGetFileItemLength(size_t index, int64 result);
66 void Seek(int64 offset); 64 void Seek(int64 offset);
67 65
68 // For reading the blob. 66 // For reading the blob.
69 bool ReadLoop(int* bytes_read); 67 bool ReadLoop(int* bytes_read);
70 bool ReadItem(); 68 bool ReadItem();
71 void AdvanceItem(); 69 void AdvanceItem();
72 void AdvanceBytesRead(int result); 70 void AdvanceBytesRead(int result);
73 bool ReadBytesItem(const BlobDataItem& item, int bytes_to_read); 71 bool ReadBytesItem(const BlobDataItem& item, int bytes_to_read);
72
74 bool ReadFileItem(FileStreamReader* reader, int bytes_to_read); 73 bool ReadFileItem(FileStreamReader* reader, int bytes_to_read);
75
76 void DidReadFile(int chunk_number, int result); 74 void DidReadFile(int chunk_number, int result);
77 void DeleteCurrentFileReader(); 75 void DeleteCurrentFileReader();
78 76
77 bool ReadDiskCacheEntryItem(const BlobDataItem& item, int bytes_to_read);
78 void DidReadDiskCacheEntry(int result);
79
79 int ComputeBytesToRead() const; 80 int ComputeBytesToRead() const;
80 int BytesReadCompleted(); 81 int BytesReadCompleted();
81 82
82 // These methods convert the result of blob data reading into response headers 83 // These methods convert the result of blob data reading into response headers
83 // and pass it to URLRequestJob's NotifyDone() or NotifyHeadersComplete(). 84 // and pass it to URLRequestJob's NotifyDone() or NotifyHeadersComplete().
84 void NotifySuccess(); 85 void NotifySuccess();
85 void NotifyFailure(int); 86 void NotifyFailure(int);
86 void HeadersCompleted(net::HttpStatusCode status_code); 87 void HeadersCompleted(net::HttpStatusCode status_code);
87 88
88 // Returns a FileStreamReader for a blob item at |index|. 89 // Returns a FileStreamReader for a blob item at |index|.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 scoped_ptr<net::HttpResponseInfo> response_info_; 122 scoped_ptr<net::HttpResponseInfo> response_info_;
122 123
123 base::WeakPtrFactory<BlobURLRequestJob> weak_factory_; 124 base::WeakPtrFactory<BlobURLRequestJob> weak_factory_;
124 125
125 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); 126 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob);
126 }; 127 };
127 128
128 } // namespace storage 129 } // namespace storage
129 130
130 #endif // STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ 131 #endif // STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698