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

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

Issue 2874073004: network service: Add job wrapper to SWControlleeRequestHandler (Closed)
Patch Set: fix dchecks 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
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_CONTROLLEE_REQUEST_HANDLER _H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER _H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER _H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER _H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 11 matching lines...) Expand all
22 #include "url/gurl.h" 22 #include "url/gurl.h"
23 23
24 namespace net { 24 namespace net {
25 class NetworkDelegate; 25 class NetworkDelegate;
26 class URLRequest; 26 class URLRequest;
27 } 27 }
28 28
29 namespace content { 29 namespace content {
30 30
31 class ResourceRequestBodyImpl; 31 class ResourceRequestBodyImpl;
32 class ServiceWorkerURLJobWrapper;
32 class ServiceWorkerRegistration; 33 class ServiceWorkerRegistration;
33 class ServiceWorkerVersion; 34 class ServiceWorkerVersion;
34 35
35 // A request handler derivative used to handle requests from 36 // A request handler derivative used to handle requests from
36 // controlled documents. 37 // controlled documents.
37 class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler 38 class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler
38 : public ServiceWorkerRequestHandler, 39 : public ServiceWorkerRequestHandler,
39 public ServiceWorkerURLRequestJob::Delegate { 40 public ServiceWorkerURLRequestJob::Delegate {
40 public: 41 public:
41 ServiceWorkerControlleeRequestHandler( 42 ServiceWorkerControlleeRequestHandler(
(...skipping 14 matching lines...) Expand all
56 net::URLRequest* request, 57 net::URLRequest* request,
57 net::NetworkDelegate* network_delegate, 58 net::NetworkDelegate* network_delegate,
58 ResourceContext* resource_context) override; 59 ResourceContext* resource_context) override;
59 60
60 private: 61 private:
61 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, 62 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest,
62 ActivateWaitingVersion); 63 ActivateWaitingVersion);
63 typedef ServiceWorkerControlleeRequestHandler self; 64 typedef ServiceWorkerControlleeRequestHandler self;
64 65
65 // For main resource case. 66 // For main resource case.
66 void PrepareForMainResource(const net::URLRequest* request); 67 void PrepareForMainResource(const GURL& url,
68 const GURL& first_party_for_cookies);
67 void DidLookupRegistrationForMainResource( 69 void DidLookupRegistrationForMainResource(
68 ServiceWorkerStatusCode status, 70 ServiceWorkerStatusCode status,
69 scoped_refptr<ServiceWorkerRegistration> registration); 71 scoped_refptr<ServiceWorkerRegistration> registration);
70 void OnVersionStatusChanged( 72 void OnVersionStatusChanged(
71 ServiceWorkerRegistration* registration, 73 ServiceWorkerRegistration* registration,
72 ServiceWorkerVersion* version); 74 ServiceWorkerVersion* version);
73 75
74 void DidUpdateRegistration( 76 void DidUpdateRegistration(
75 const scoped_refptr<ServiceWorkerRegistration>& original_registration, 77 const scoped_refptr<ServiceWorkerRegistration>& original_registration,
76 ServiceWorkerStatusCode status, 78 ServiceWorkerStatusCode status,
(...skipping 15 matching lines...) Expand all
92 ServiceWorkerVersion* GetServiceWorkerVersion( 94 ServiceWorkerVersion* GetServiceWorkerVersion(
93 ServiceWorkerMetrics::URLRequestJobResult* result) override; 95 ServiceWorkerMetrics::URLRequestJobResult* result) override;
94 bool RequestStillValid( 96 bool RequestStillValid(
95 ServiceWorkerMetrics::URLRequestJobResult* result) override; 97 ServiceWorkerMetrics::URLRequestJobResult* result) override;
96 void MainResourceLoadFailed() override; 98 void MainResourceLoadFailed() override;
97 99
98 // Sets |job_| to nullptr, and clears all extra response info associated with 100 // Sets |job_| to nullptr, and clears all extra response info associated with
99 // that job, except for timing information. 101 // that job, except for timing information.
100 void ClearJob(); 102 void ClearJob();
101 103
104 bool JobWasCanceled() const;
105
102 const bool is_main_resource_load_; 106 const bool is_main_resource_load_;
103 const bool is_main_frame_load_; 107 const bool is_main_frame_load_;
104 base::WeakPtr<ServiceWorkerURLRequestJob> job_; 108 std::unique_ptr<ServiceWorkerURLJobWrapper> url_job_;
105 FetchRequestMode request_mode_; 109 FetchRequestMode request_mode_;
106 FetchCredentialsMode credentials_mode_; 110 FetchCredentialsMode credentials_mode_;
107 FetchRedirectMode redirect_mode_; 111 FetchRedirectMode redirect_mode_;
108 RequestContextType request_context_type_; 112 RequestContextType request_context_type_;
109 RequestContextFrameType frame_type_; 113 RequestContextFrameType frame_type_;
110 scoped_refptr<ResourceRequestBodyImpl> body_; 114 scoped_refptr<ResourceRequestBodyImpl> body_;
111 ResourceContext* resource_context_; 115 ResourceContext* resource_context_;
112 GURL stripped_url_; 116 GURL stripped_url_;
113 bool force_update_started_; 117 bool force_update_started_;
114 118
115 // True if the next time this request is started, the response should be 119 // True if the next time this request is started, the response should be
116 // delivered from the network, bypassing the ServiceWorker. Cleared after the 120 // delivered from the network, bypassing the ServiceWorker. Cleared after the
117 // next intercept opportunity, for main frame requests. 121 // next intercept opportunity, for main frame requests.
118 bool use_network_; 122 bool use_network_;
119 123
120 base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_; 124 base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_;
121 125
122 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler); 126 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler);
123 }; 127 };
124 128
125 } // namespace content 129 } // namespace content
126 130
127 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HAND LER_H_ 131 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HAND LER_H_
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/service_worker/service_worker_controllee_request_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698