OLD | NEW |
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 //---------------------------------------------------------------------------- | 137 //---------------------------------------------------------------------------- |
138 // The following are intended for use by ServiceWorker(Blob|Stream)Reader. | 138 // The following are intended for use by ServiceWorker(Blob|Stream)Reader. |
139 void OnResponseStarted(); | 139 void OnResponseStarted(); |
140 void OnReadRawDataComplete(int bytes_read); | 140 void OnReadRawDataComplete(int bytes_read); |
141 void RecordResult(ServiceWorkerMetrics::URLRequestJobResult result); | 141 void RecordResult(ServiceWorkerMetrics::URLRequestJobResult result); |
142 //---------------------------------------------------------------------------- | 142 //---------------------------------------------------------------------------- |
143 | 143 |
144 base::WeakPtr<ServiceWorkerURLRequestJob> GetWeakPtr(); | 144 base::WeakPtr<ServiceWorkerURLRequestJob> GetWeakPtr(); |
145 | 145 |
146 private: | 146 private: |
147 class BlobConstructionWaiter; | 147 class FileSizeResolver; |
148 | 148 |
149 enum ResponseType { | 149 enum ResponseType { |
150 NOT_DETERMINED, | 150 NOT_DETERMINED, |
151 FALLBACK_TO_NETWORK, | 151 FALLBACK_TO_NETWORK, |
152 FALLBACK_TO_RENDERER, // Use this when falling back with CORS check | 152 FALLBACK_TO_RENDERER, // Use this when falling back with CORS check |
153 FORWARD_TO_SERVICE_WORKER, | 153 FORWARD_TO_SERVICE_WORKER, |
154 }; | 154 }; |
155 | 155 |
156 enum ResponseBodyType { | 156 enum ResponseBodyType { |
157 UNKNOWN, | 157 UNKNOWN, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 ServiceWorkerFetchType fetch_type_; | 273 ServiceWorkerFetchType fetch_type_; |
274 | 274 |
275 ResponseBodyType response_body_type_ = UNKNOWN; | 275 ResponseBodyType response_body_type_ = UNKNOWN; |
276 bool did_record_result_ = false; | 276 bool did_record_result_ = false; |
277 | 277 |
278 bool response_is_in_cache_storage_ = false; | 278 bool response_is_in_cache_storage_ = false; |
279 std::string response_cache_storage_cache_name_; | 279 std::string response_cache_storage_cache_name_; |
280 | 280 |
281 ServiceWorkerHeaderList cors_exposed_header_names_; | 281 ServiceWorkerHeaderList cors_exposed_header_names_; |
282 | 282 |
283 std::unique_ptr<BlobConstructionWaiter> blob_construction_waiter_; | 283 std::unique_ptr<FileSizeResolver> file_size_resolver_; |
284 | 284 |
285 bool worker_already_activated_ = false; | 285 bool worker_already_activated_ = false; |
286 EmbeddedWorkerStatus initial_worker_status_ = EmbeddedWorkerStatus::STOPPED; | 286 EmbeddedWorkerStatus initial_worker_status_ = EmbeddedWorkerStatus::STOPPED; |
287 | 287 |
288 // This is used for Navigation Preload. It may be a null callback in some | 288 // This is used for Navigation Preload. It may be a null callback in some |
289 // unittests or for Foreign Fetch. | 289 // unittests or for Foreign Fetch. |
290 const MojoURLLoaderFactoryGetter url_loader_factory_getter_; | 290 const MojoURLLoaderFactoryGetter url_loader_factory_getter_; |
291 | 291 |
292 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; | 292 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; |
293 | 293 |
294 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); | 294 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); |
295 }; | 295 }; |
296 | 296 |
297 } // namespace content | 297 } // namespace content |
298 | 298 |
299 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 299 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
OLD | NEW |