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

Side by Side Diff: content/browser/service_worker/service_worker_url_request_job.h

Issue 2448353002: [BlobAsync] Moving async handling into BlobStorageContext & quota out. (Closed)
Patch Set: comments Created 4 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 //---------------------------------------------------------------------------- 134 //----------------------------------------------------------------------------
135 // The following are intended for use by ServiceWorker(Blob|Stream)Reader. 135 // The following are intended for use by ServiceWorker(Blob|Stream)Reader.
136 void OnResponseStarted(); 136 void OnResponseStarted();
137 void OnReadRawDataComplete(int bytes_read); 137 void OnReadRawDataComplete(int bytes_read);
138 void RecordResult(ServiceWorkerMetrics::URLRequestJobResult result); 138 void RecordResult(ServiceWorkerMetrics::URLRequestJobResult result);
139 //---------------------------------------------------------------------------- 139 //----------------------------------------------------------------------------
140 140
141 base::WeakPtr<ServiceWorkerURLRequestJob> GetWeakPtr(); 141 base::WeakPtr<ServiceWorkerURLRequestJob> GetWeakPtr();
142 142
143 private: 143 private:
144 class BlobConstructionWaiter; 144 class FileSizeResolver;
145 145
146 enum ResponseType { 146 enum ResponseType {
147 NOT_DETERMINED, 147 NOT_DETERMINED,
148 FALLBACK_TO_NETWORK, 148 FALLBACK_TO_NETWORK,
149 FALLBACK_TO_RENDERER, // Use this when falling back with CORS check 149 FALLBACK_TO_RENDERER, // Use this when falling back with CORS check
150 FORWARD_TO_SERVICE_WORKER, 150 FORWARD_TO_SERVICE_WORKER,
151 }; 151 };
152 152
153 enum ResponseBodyType { 153 enum ResponseBodyType {
154 UNKNOWN, 154 UNKNOWN,
155 BLOB, 155 BLOB,
156 STREAM, 156 STREAM,
157 }; 157 };
158 158
159 // We start processing the request if Start() is called AND response_type_ 159 // We start processing the request if Start() is called AND response_type_
160 // is determined. 160 // is determined.
161 void MaybeStartRequest(); 161 void MaybeStartRequest();
162 void StartRequest(); 162 void StartRequest();
163 163
164 // Creates ServiceWorkerFetchRequest from |request_| and |body_|. 164 // Creates ServiceWorkerFetchRequest from |request_| and |body_|.
165 std::unique_ptr<ServiceWorkerFetchRequest> CreateFetchRequest(); 165 std::unique_ptr<ServiceWorkerFetchRequest> CreateFetchRequest();
166 166
167 // Creates BlobDataHandle of the request body from |body_|. This handle 167 // Creates BlobDataHandle of the request body from |body_|. This handle
168 // |request_body_blob_data_handle_| will be deleted when 168 // |request_body_blob_data_handle_| will be deleted when
169 // ServiceWorkerURLRequestJob is deleted. 169 // ServiceWorkerURLRequestJob is deleted.
170 // This must not be called until all blobs in |body_| finished construction. 170 // This must not be called until all blobs in |body_| finished construction.
falken 2016/11/09 02:06:19 Now instead of "finished construction" it's someth
dmurph 2016/11/09 19:13:27 Done.
171 void CreateRequestBodyBlob(std::string* blob_uuid, uint64_t* blob_size); 171 void CreateRequestBodyBlob(std::string* blob_uuid, uint64_t* blob_size);
172 172
173 // For FORWARD_TO_SERVICE_WORKER case. 173 // For FORWARD_TO_SERVICE_WORKER case.
174 void DidPrepareFetchEvent(scoped_refptr<ServiceWorkerVersion> version); 174 void DidPrepareFetchEvent(scoped_refptr<ServiceWorkerVersion> version);
175 void DidDispatchFetchEvent( 175 void DidDispatchFetchEvent(
176 ServiceWorkerStatusCode status, 176 ServiceWorkerStatusCode status,
177 ServiceWorkerFetchEventResult fetch_result, 177 ServiceWorkerFetchEventResult fetch_result,
178 const ServiceWorkerResponse& response, 178 const ServiceWorkerResponse& response,
179 const scoped_refptr<ServiceWorkerVersion>& version); 179 const scoped_refptr<ServiceWorkerVersion>& version);
180 void SetResponse(const ServiceWorkerResponse& response); 180 void SetResponse(const ServiceWorkerResponse& response);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void NotifyHeadersComplete(); 216 void NotifyHeadersComplete();
217 void NotifyStartError(net::URLRequestStatus status); 217 void NotifyStartError(net::URLRequestStatus status);
218 void NotifyRestartRequired(); 218 void NotifyRestartRequired();
219 219
220 // Wrapper that gathers parameters to |on_start_completed_callback_| and then 220 // Wrapper that gathers parameters to |on_start_completed_callback_| and then
221 // calls it. 221 // calls it.
222 void OnStartCompleted() const; 222 void OnStartCompleted() const;
223 223
224 bool IsMainResourceLoad() const; 224 bool IsMainResourceLoad() const;
225 225
226 // For waiting for request body blobs to finish construction. 226 // For waiting for request body blobs to finish construction.
falken 2016/11/09 02:06:19 "resolve file sizes"?
dmurph 2016/11/09 19:13:27 Done.
227 bool HasRequestBody(); 227 bool HasRequestBody();
228 void RequestBodyBlobsCompleted(bool success); 228 void RequestBodyBlobsCompleted(bool success);
falken 2016/11/09 02:06:19 Function name here also is no longer accurate?
dmurph 2016/11/09 19:13:27 Done.
229 229
230 // Not owned. 230 // Not owned.
231 Delegate* delegate_; 231 Delegate* delegate_;
232 232
233 // Timing info to show on the popup in Devtools' Network tab. 233 // Timing info to show on the popup in Devtools' Network tab.
234 net::LoadTimingInfo load_timing_info_; 234 net::LoadTimingInfo load_timing_info_;
235 base::TimeTicks worker_start_time_; 235 base::TimeTicks worker_start_time_;
236 base::TimeTicks worker_ready_time_; 236 base::TimeTicks worker_ready_time_;
237 base::Time response_time_; 237 base::Time response_time_;
238 238
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 ServiceWorkerFetchType fetch_type_; 270 ServiceWorkerFetchType fetch_type_;
271 271
272 ResponseBodyType response_body_type_ = UNKNOWN; 272 ResponseBodyType response_body_type_ = UNKNOWN;
273 bool did_record_result_ = false; 273 bool did_record_result_ = false;
274 274
275 bool response_is_in_cache_storage_ = false; 275 bool response_is_in_cache_storage_ = false;
276 std::string response_cache_storage_cache_name_; 276 std::string response_cache_storage_cache_name_;
277 277
278 ServiceWorkerHeaderList cors_exposed_header_names_; 278 ServiceWorkerHeaderList cors_exposed_header_names_;
279 279
280 std::unique_ptr<BlobConstructionWaiter> blob_construction_waiter_; 280 std::unique_ptr<FileSizeResolver> file_size_resolver_;
281 281
282 bool worker_already_activated_ = false; 282 bool worker_already_activated_ = false;
283 EmbeddedWorkerStatus initial_worker_status_ = EmbeddedWorkerStatus::STOPPED; 283 EmbeddedWorkerStatus initial_worker_status_ = EmbeddedWorkerStatus::STOPPED;
284 284
285 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; 285 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_;
286 286
287 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); 287 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob);
288 }; 288 };
289 289
290 } // namespace content 290 } // namespace content
291 291
292 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ 292 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698