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

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

Issue 2518523003: Limit timeout for foreign fetch events when triggered by another service worker. (Closed)
Patch Set: don't intercept worker main resource fetches Created 4 years 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/service_worker/foreign_fetch_request_handler.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_FOREIGN_FETCH_REQUEST_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/optional.h"
10 #include "base/supports_user_data.h" 11 #include "base/supports_user_data.h"
11 #include "base/time/time.h" 12 #include "base/time/time.h"
12 #include "content/browser/service_worker/service_worker_url_request_job.h" 13 #include "content/browser/service_worker/service_worker_url_request_job.h"
13 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
14 #include "content/common/service_worker/service_worker_status_code.h" 15 #include "content/common/service_worker/service_worker_status_code.h"
15 #include "content/common/service_worker/service_worker_types.h" 16 #include "content/common/service_worker/service_worker_types.h"
16 #include "content/public/common/request_context_frame_type.h" 17 #include "content/public/common/request_context_frame_type.h"
17 #include "content/public/common/request_context_type.h" 18 #include "content/public/common/request_context_type.h"
18 #include "content/public/common/resource_type.h" 19 #include "content/public/common/resource_type.h"
19 #include "net/url_request/url_request_job_factory.h" 20 #include "net/url_request/url_request_job_factory.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 88
88 ForeignFetchRequestHandler( 89 ForeignFetchRequestHandler(
89 ServiceWorkerContextWrapper* context, 90 ServiceWorkerContextWrapper* context,
90 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, 91 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
91 FetchRequestMode request_mode, 92 FetchRequestMode request_mode,
92 FetchCredentialsMode credentials_mode, 93 FetchCredentialsMode credentials_mode,
93 FetchRedirectMode redirect_mode, 94 FetchRedirectMode redirect_mode,
94 ResourceType resource_type, 95 ResourceType resource_type,
95 RequestContextType request_context_type, 96 RequestContextType request_context_type,
96 RequestContextFrameType frame_type, 97 RequestContextFrameType frame_type,
97 scoped_refptr<ResourceRequestBodyImpl> body); 98 scoped_refptr<ResourceRequestBodyImpl> body,
99 const base::Optional<base::TimeDelta>& timeout);
98 100
99 // Called when a ServiceWorkerRegistration has (or hasn't) been found for the 101 // Called when a ServiceWorkerRegistration has (or hasn't) been found for the
100 // request being handled. 102 // request being handled.
101 void DidFindRegistration( 103 void DidFindRegistration(
102 const base::WeakPtr<ServiceWorkerURLRequestJob>& job, 104 const base::WeakPtr<ServiceWorkerURLRequestJob>& job,
103 ServiceWorkerStatusCode status, 105 ServiceWorkerStatusCode status,
104 scoped_refptr<ServiceWorkerRegistration> registration); 106 scoped_refptr<ServiceWorkerRegistration> registration);
105 107
106 // ServiceWorkerURLRequestJob::Delegate implementation: 108 // ServiceWorkerURLRequestJob::Delegate implementation:
107 void OnPrepareToRestart() override; 109 void OnPrepareToRestart() override;
(...skipping 13 matching lines...) Expand all
121 scoped_refptr<ServiceWorkerContextWrapper> context_; 123 scoped_refptr<ServiceWorkerContextWrapper> context_;
122 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; 124 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
123 ResourceType resource_type_; 125 ResourceType resource_type_;
124 FetchRequestMode request_mode_; 126 FetchRequestMode request_mode_;
125 FetchCredentialsMode credentials_mode_; 127 FetchCredentialsMode credentials_mode_;
126 FetchRedirectMode redirect_mode_; 128 FetchRedirectMode redirect_mode_;
127 RequestContextType request_context_type_; 129 RequestContextType request_context_type_;
128 RequestContextFrameType frame_type_; 130 RequestContextFrameType frame_type_;
129 scoped_refptr<ResourceRequestBodyImpl> body_; 131 scoped_refptr<ResourceRequestBodyImpl> body_;
130 ResourceContext* resource_context_; 132 ResourceContext* resource_context_;
133 base::Optional<base::TimeDelta> timeout_;
131 134
132 base::WeakPtr<ServiceWorkerURLRequestJob> job_; 135 base::WeakPtr<ServiceWorkerURLRequestJob> job_;
133 scoped_refptr<ServiceWorkerVersion> target_worker_; 136 scoped_refptr<ServiceWorkerVersion> target_worker_;
134 137
135 // True if the next time this request is started, the response should be 138 // True if the next time this request is started, the response should be
136 // delivered from the network, bypassing the ServiceWorker. 139 // delivered from the network, bypassing the ServiceWorker.
137 bool use_network_ = false; 140 bool use_network_ = false;
138 141
139 base::WeakPtrFactory<ForeignFetchRequestHandler> weak_factory_; 142 base::WeakPtrFactory<ForeignFetchRequestHandler> weak_factory_;
140 143
141 DISALLOW_COPY_AND_ASSIGN(ForeignFetchRequestHandler); 144 DISALLOW_COPY_AND_ASSIGN(ForeignFetchRequestHandler);
142 }; 145 };
143 146
144 } // namespace content 147 } // namespace content
145 148
146 #endif // CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_ 149 #endif // CONTENT_BROWSER_SERVICE_WORKER_FOREIGN_FETCH_REQUEST_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/foreign_fetch_request_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698