OLD | NEW |
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 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void Seek(int64 offset); | 66 void Seek(int64 offset); |
67 | 67 |
68 // For reading the blob. | 68 // For reading the blob. |
69 bool ReadLoop(int* bytes_read); | 69 bool ReadLoop(int* bytes_read); |
70 bool ReadItem(); | 70 bool ReadItem(); |
71 void AdvanceItem(); | 71 void AdvanceItem(); |
72 void AdvanceBytesRead(int result); | 72 void AdvanceBytesRead(int result); |
73 bool ReadBytesItem(const BlobDataItem& item, int bytes_to_read); | 73 bool ReadBytesItem(const BlobDataItem& item, int bytes_to_read); |
74 bool ReadFileItem(FileStreamReader* reader, int bytes_to_read); | 74 bool ReadFileItem(FileStreamReader* reader, int bytes_to_read); |
75 | 75 |
76 void DidReadFile(int result); | 76 void DidReadFile(int chunk_number, int result); |
77 void DeleteCurrentFileReader(); | 77 void DeleteCurrentFileReader(); |
78 | 78 |
79 int ComputeBytesToRead() const; | 79 int ComputeBytesToRead() const; |
80 int BytesReadCompleted(); | 80 int BytesReadCompleted(); |
81 | 81 |
82 // These methods convert the result of blob data reading into response headers | 82 // These methods convert the result of blob data reading into response headers |
83 // and pass it to URLRequestJob's NotifyDone() or NotifyHeadersComplete(). | 83 // and pass it to URLRequestJob's NotifyDone() or NotifyHeadersComplete(). |
84 void NotifySuccess(); | 84 void NotifySuccess(); |
85 void NotifyFailure(int); | 85 void NotifyFailure(int); |
86 void HeadersCompleted(net::HttpStatusCode status_code); | 86 void HeadersCompleted(net::HttpStatusCode status_code); |
(...skipping 20 matching lines...) Expand all Loading... |
107 | 107 |
108 // Holds the buffer for read data with the IOBuffer interface. | 108 // Holds the buffer for read data with the IOBuffer interface. |
109 scoped_refptr<net::DrainableIOBuffer> read_buf_; | 109 scoped_refptr<net::DrainableIOBuffer> read_buf_; |
110 | 110 |
111 // Is set when NotifyFailure() is called and reset when DidStart is called. | 111 // Is set when NotifyFailure() is called and reset when DidStart is called. |
112 bool error_; | 112 bool error_; |
113 | 113 |
114 bool byte_range_set_; | 114 bool byte_range_set_; |
115 net::HttpByteRange byte_range_; | 115 net::HttpByteRange byte_range_; |
116 | 116 |
| 117 // Used to create unique id's for tracing. |
| 118 int current_file_chunk_number_; |
| 119 |
117 scoped_ptr<net::HttpResponseInfo> response_info_; | 120 scoped_ptr<net::HttpResponseInfo> response_info_; |
118 | 121 |
119 base::WeakPtrFactory<BlobURLRequestJob> weak_factory_; | 122 base::WeakPtrFactory<BlobURLRequestJob> weak_factory_; |
120 | 123 |
121 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); | 124 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); |
122 }; | 125 }; |
123 | 126 |
124 } // namespace storage | 127 } // namespace storage |
125 | 128 |
126 #endif // STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ | 129 #endif // STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ |
OLD | NEW |