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

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

Issue 659573006: [ServiceWorker] pipe ServiceWorkerResponseType [2/2 chromium] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix error Created 6 years, 2 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
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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/common/service_worker/service_worker_status_code.h" 14 #include "content/common/service_worker/service_worker_status_code.h"
15 #include "content/common/service_worker/service_worker_types.h" 15 #include "content/common/service_worker/service_worker_types.h"
16 #include "content/public/common/request_context_frame_type.h" 16 #include "content/public/common/request_context_frame_type.h"
17 #include "content/public/common/request_context_type.h" 17 #include "content/public/common/request_context_type.h"
18 #include "content/public/common/resource_type.h" 18 #include "content/public/common/resource_type.h"
19 #include "net/http/http_byte_range.h" 19 #include "net/http/http_byte_range.h"
20 #include "net/url_request/url_request.h" 20 #include "net/url_request/url_request.h"
21 #include "net/url_request/url_request_job.h" 21 #include "net/url_request/url_request_job.h"
22 #include "third_party/WebKit/public/platform/WebServiceWorkerResponseType.h"
22 23
23 namespace storage { 24 namespace storage {
24 class BlobDataHandle; 25 class BlobDataHandle;
25 class BlobStorageContext; 26 class BlobStorageContext;
26 } 27 }
27 28
28 namespace content { 29 namespace content {
29 30
30 class ResourceRequestBody; 31 class ResourceRequestBody;
31 class ServiceWorkerContextCore; 32 class ServiceWorkerContextCore;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const net::SSLInfo& ssl_info, 89 const net::SSLInfo& ssl_info,
89 bool fatal) override; 90 bool fatal) override;
90 virtual void OnBeforeNetworkStart(net::URLRequest* request, 91 virtual void OnBeforeNetworkStart(net::URLRequest* request,
91 bool* defer) override; 92 bool* defer) override;
92 virtual void OnResponseStarted(net::URLRequest* request) override; 93 virtual void OnResponseStarted(net::URLRequest* request) override;
93 virtual void OnReadCompleted(net::URLRequest* request, 94 virtual void OnReadCompleted(net::URLRequest* request,
94 int bytes_read) override; 95 int bytes_read) override;
95 96
96 const net::HttpResponseInfo* http_info() const; 97 const net::HttpResponseInfo* http_info() const;
97 98
98 void GetExtraResponseInfo(bool* was_fetched_via_service_worker, 99 void GetExtraResponseInfo(
99 bool* was_fallback_required_by_service_worker, 100 bool* was_fetched_via_service_worker,
100 GURL* original_url_via_service_worker, 101 bool* was_fallback_required_by_service_worker,
101 base::TimeTicks* fetch_start_time, 102 GURL* original_url_via_service_worker,
102 base::TimeTicks* fetch_ready_time, 103 blink::WebServiceWorkerResponseType* response_type_via_service_worker,
103 base::TimeTicks* fetch_end_time) const; 104 base::TimeTicks* fetch_start_time,
105 base::TimeTicks* fetch_ready_time,
106 base::TimeTicks* fetch_end_time) const;
104 107
105 protected: 108 protected:
106 virtual ~ServiceWorkerURLRequestJob(); 109 virtual ~ServiceWorkerURLRequestJob();
107 110
108 private: 111 private:
109 enum ResponseType { 112 enum ResponseType {
110 NOT_DETERMINED, 113 NOT_DETERMINED,
111 FALLBACK_TO_NETWORK, 114 FALLBACK_TO_NETWORK,
112 FORWARD_TO_SERVICE_WORKER, 115 FORWARD_TO_SERVICE_WORKER,
113 }; 116 };
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 157
155 ResponseType response_type_; 158 ResponseType response_type_;
156 bool is_started_; 159 bool is_started_;
157 160
158 net::HttpByteRange byte_range_; 161 net::HttpByteRange byte_range_;
159 scoped_ptr<net::HttpResponseInfo> range_response_info_; 162 scoped_ptr<net::HttpResponseInfo> range_response_info_;
160 scoped_ptr<net::HttpResponseInfo> http_response_info_; 163 scoped_ptr<net::HttpResponseInfo> http_response_info_;
161 // Headers that have not yet been committed to |http_response_info_|. 164 // Headers that have not yet been committed to |http_response_info_|.
162 scoped_refptr<net::HttpResponseHeaders> http_response_headers_; 165 scoped_refptr<net::HttpResponseHeaders> http_response_headers_;
163 GURL response_url_; 166 GURL response_url_;
167 blink::WebServiceWorkerResponseType service_worker_response_type_;
164 168
165 // Used when response type is FORWARD_TO_SERVICE_WORKER. 169 // Used when response type is FORWARD_TO_SERVICE_WORKER.
166 scoped_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_; 170 scoped_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_;
167 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; 171 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
168 scoped_ptr<net::URLRequest> blob_request_; 172 scoped_ptr<net::URLRequest> blob_request_;
169 FetchRequestMode request_mode_; 173 FetchRequestMode request_mode_;
170 FetchCredentialsMode credentials_mode_; 174 FetchCredentialsMode credentials_mode_;
171 RequestContextType request_context_type_; 175 RequestContextType request_context_type_;
172 RequestContextFrameType frame_type_; 176 RequestContextFrameType frame_type_;
173 bool fall_back_required_; 177 bool fall_back_required_;
174 // ResourceRequestBody has a collection of BlobDataHandles attached to it 178 // ResourceRequestBody has a collection of BlobDataHandles attached to it
175 // using the userdata mechanism. So we have to keep it not to free the blobs. 179 // using the userdata mechanism. So we have to keep it not to free the blobs.
176 scoped_refptr<ResourceRequestBody> body_; 180 scoped_refptr<ResourceRequestBody> body_;
177 scoped_ptr<storage::BlobDataHandle> request_body_blob_data_handle_; 181 scoped_ptr<storage::BlobDataHandle> request_body_blob_data_handle_;
178 182
179 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; 183 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_;
180 184
181 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); 185 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob);
182 }; 186 };
183 187
184 } // namespace content 188 } // namespace content
185 189
186 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ 190 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698