| 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 CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 scoped_refptr<net::IOBuffer> read_buffer_; // From URLRequest. | 139 scoped_refptr<net::IOBuffer> read_buffer_; // From URLRequest. |
| 140 std::unique_ptr<ByteStreamWriter> stream_writer_; // To rest of system. | 140 std::unique_ptr<ByteStreamWriter> stream_writer_; // To rest of system. |
| 141 | 141 |
| 142 // Keeps the system from sleeping while this is alive. If the | 142 // Keeps the system from sleeping while this is alive. If the |
| 143 // system enters power saving mode while a request is alive, it can cause the | 143 // system enters power saving mode while a request is alive, it can cause the |
| 144 // request to fail and the associated download will be interrupted. | 144 // request to fail and the associated download will be interrupted. |
| 145 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_; | 145 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_; |
| 146 | 146 |
| 147 // The following are used to collect stats. | 147 // The following are used to collect stats. |
| 148 base::TimeTicks download_start_time_; | 148 base::TimeTicks download_start_time_; |
| 149 base::TimeTicks last_read_time_; | |
| 150 base::TimeTicks last_stream_pause_time_; | 149 base::TimeTicks last_stream_pause_time_; |
| 151 base::TimeDelta total_pause_time_; | 150 base::TimeDelta total_pause_time_; |
| 152 size_t last_buffer_size_; | 151 |
| 153 int64_t bytes_read_; | 152 int64_t bytes_read_; |
| 154 | 153 |
| 155 int pause_count_; | 154 int pause_count_; |
| 156 bool was_deferred_; | 155 bool was_deferred_; |
| 157 bool is_partial_request_; | 156 bool is_partial_request_; |
| 158 bool started_; | 157 bool started_; |
| 159 | 158 |
| 160 // When DownloadRequestCore initiates an abort (by blocking a redirect, for | 159 // When DownloadRequestCore initiates an abort (by blocking a redirect, for |
| 161 // example) it expects to eventually receive a OnResponseCompleted() with a | 160 // example) it expects to eventually receive a OnResponseCompleted() with a |
| 162 // status indicating that the request was aborted. When this happens, the | 161 // status indicating that the request was aborted. When this happens, the |
| 163 // interrupt reason in |abort_reason_| will be used instead of USER_CANCELED | 162 // interrupt reason in |abort_reason_| will be used instead of USER_CANCELED |
| 164 // which is vague. | 163 // which is vague. |
| 165 DownloadInterruptReason abort_reason_; | 164 DownloadInterruptReason abort_reason_; |
| 166 | 165 |
| 167 // Each successful OnWillRead will yield a buffer of this size. | 166 // Each successful OnWillRead will yield a buffer of this size. |
| 168 static const int kReadBufSize = 32768; // bytes | 167 static const int kReadBufSize = 32768; // bytes |
| 169 | 168 |
| 170 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore); | 169 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore); |
| 171 }; | 170 }; |
| 172 | 171 |
| 173 } // namespace content | 172 } // namespace content |
| 174 | 173 |
| 175 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ | 174 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ |
| OLD | NEW |