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

Side by Side Diff: content/browser/download/download_request_core.h

Issue 2874013002: Add GetWakeLockWithoutContext() in WakeLockContextProvider mojo interface. (Closed)
Patch Set: Add GetWakeLockWithoutContext in WakeLockContextProvider mojo interface. Created 3 years, 7 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
« no previous file with comments | « no previous file | content/browser/download/download_request_core.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "content/browser/loader/resource_handler.h" 17 #include "content/browser/loader/resource_handler.h"
18 #include "content/public/browser/download_interrupt_reasons.h" 18 #include "content/public/browser/download_interrupt_reasons.h"
19 #include "content/public/browser/download_save_info.h" 19 #include "content/public/browser/download_save_info.h"
20 #include "content/public/browser/download_url_parameters.h" 20 #include "content/public/browser/download_url_parameters.h"
21 21 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h"
22 namespace device {
23 class PowerSaveBlocker;
24 } // namespace device
25 22
26 namespace net { 23 namespace net {
27 class HttpResponseHeaders; 24 class HttpResponseHeaders;
28 class URLRequest; 25 class URLRequest;
29 class URLRequestStatus; 26 class URLRequestStatus;
30 } // namespace net 27 } // namespace net
31 28
32 namespace content { 29 namespace content {
33 class ByteStreamReader; 30 class ByteStreamReader;
34 class ByteStreamWriter; 31 class ByteStreamWriter;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // populate the DownloadCreateInfo when the time comes. 135 // populate the DownloadCreateInfo when the time comes.
139 std::unique_ptr<DownloadSaveInfo> save_info_; 136 std::unique_ptr<DownloadSaveInfo> save_info_;
140 uint32_t download_id_; 137 uint32_t download_id_;
141 bool transient_; 138 bool transient_;
142 DownloadUrlParameters::OnStartedCallback on_started_callback_; 139 DownloadUrlParameters::OnStartedCallback on_started_callback_;
143 140
144 // Data flow 141 // Data flow
145 scoped_refptr<net::IOBuffer> read_buffer_; // From URLRequest. 142 scoped_refptr<net::IOBuffer> read_buffer_; // From URLRequest.
146 std::unique_ptr<ByteStreamWriter> stream_writer_; // To rest of system. 143 std::unique_ptr<ByteStreamWriter> stream_writer_; // To rest of system.
147 144
148 // Keeps the system from sleeping while this is alive. If the 145 // Used to keep the system from sleeping while a download is ongoing. If the
149 // system enters power saving mode while a request is alive, it can cause the 146 // system enters power saving mode while a URLRequest is alive, it can cause
150 // request to fail and the associated download will be interrupted. 147 // URLRequest to fail and the associated download will be interrupted.
151 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_; 148 device::mojom::WakeLockServicePtr wake_lock_;
152 149
153 // The following are used to collect stats. 150 // The following are used to collect stats.
154 base::TimeTicks download_start_time_; 151 base::TimeTicks download_start_time_;
155 base::TimeTicks last_stream_pause_time_; 152 base::TimeTicks last_stream_pause_time_;
156 base::TimeDelta total_pause_time_; 153 base::TimeDelta total_pause_time_;
157 154
158 int64_t bytes_read_; 155 int64_t bytes_read_;
159 156
160 int pause_count_; 157 int pause_count_;
161 bool was_deferred_; 158 bool was_deferred_;
162 bool is_partial_request_; 159 bool is_partial_request_;
163 bool started_; 160 bool started_;
164 161
165 // When DownloadRequestCore initiates an abort (by blocking a redirect, for 162 // When DownloadRequestCore initiates an abort (by blocking a redirect, for
166 // example) it expects to eventually receive a OnResponseCompleted() with a 163 // example) it expects to eventually receive a OnResponseCompleted() with a
167 // status indicating that the request was aborted. When this happens, the 164 // status indicating that the request was aborted. When this happens, the
168 // interrupt reason in |abort_reason_| will be used instead of USER_CANCELED 165 // interrupt reason in |abort_reason_| will be used instead of USER_CANCELED
169 // which is vague. 166 // which is vague.
170 DownloadInterruptReason abort_reason_; 167 DownloadInterruptReason abort_reason_;
171 168
172 // Each successful OnWillRead will yield a buffer of this size. 169 // Each successful OnWillRead will yield a buffer of this size.
173 static const int kReadBufSize = 32768; // bytes 170 static const int kReadBufSize = 32768; // bytes
174 171
175 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore); 172 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore);
176 }; 173 };
177 174
178 } // namespace content 175 } // namespace content
179 176
180 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ 177 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_request_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698