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

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

Issue 2506263005: Prevent a service worker from keeping itself alive by self postMessage. (Closed)
Patch Set: rebase 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/id_map.h" 13 #include "base/id_map.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/optional.h"
16 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
17 #include "content/browser/service_worker/service_worker_registration_status.h" 18 #include "content/browser/service_worker/service_worker_registration_status.h"
18 #include "content/common/service_worker/service_worker.mojom.h" 19 #include "content/common/service_worker/service_worker.mojom.h"
19 #include "content/common/service_worker/service_worker_types.h" 20 #include "content/common/service_worker/service_worker_types.h"
20 #include "content/public/browser/browser_message_filter.h" 21 #include "content/public/browser/browser_message_filter.h"
21 #include "mojo/public/cpp/bindings/associated_binding_set.h" 22 #include "mojo/public/cpp/bindings/associated_binding_set.h"
22 23
23 class GURL; 24 class GURL;
24 struct EmbeddedWorkerHostMsg_ReportConsoleMessage_Params; 25 struct EmbeddedWorkerHostMsg_ReportConsoleMessage_Params;
25 26
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 const url::Origin& source_origin, 182 const url::Origin& source_origin,
182 const std::vector<int>& sent_message_ports, 183 const std::vector<int>& sent_message_ports,
183 ServiceWorkerProviderHost* sender_provider_host, 184 ServiceWorkerProviderHost* sender_provider_host,
184 const StatusCallback& callback); 185 const StatusCallback& callback);
185 template <typename SourceInfo> 186 template <typename SourceInfo>
186 void DispatchExtendableMessageEventInternal( 187 void DispatchExtendableMessageEventInternal(
187 scoped_refptr<ServiceWorkerVersion> worker, 188 scoped_refptr<ServiceWorkerVersion> worker,
188 const base::string16& message, 189 const base::string16& message,
189 const url::Origin& source_origin, 190 const url::Origin& source_origin,
190 const std::vector<int>& sent_message_ports, 191 const std::vector<int>& sent_message_ports,
192 const base::Optional<base::TimeDelta>& timeout,
191 const StatusCallback& callback, 193 const StatusCallback& callback,
192 const SourceInfo& source_info); 194 const SourceInfo& source_info);
193 void DispatchExtendableMessageEventAfterStartWorker( 195 void DispatchExtendableMessageEventAfterStartWorker(
194 scoped_refptr<ServiceWorkerVersion> worker, 196 scoped_refptr<ServiceWorkerVersion> worker,
195 const base::string16& message, 197 const base::string16& message,
196 const url::Origin& source_origin, 198 const url::Origin& source_origin,
197 const std::vector<int>& sent_message_ports, 199 const std::vector<int>& sent_message_ports,
198 const ExtendableMessageEventSource& source, 200 const ExtendableMessageEventSource& source,
201 const base::Optional<base::TimeDelta>& timeout,
199 const StatusCallback& callback); 202 const StatusCallback& callback);
200 template <typename SourceInfo> 203 template <typename SourceInfo>
201 void DidFailToDispatchExtendableMessageEvent( 204 void DidFailToDispatchExtendableMessageEvent(
202 const std::vector<int>& sent_message_ports, 205 const std::vector<int>& sent_message_ports,
203 const SourceInfo& source_info, 206 const SourceInfo& source_info,
204 const StatusCallback& callback, 207 const StatusCallback& callback,
205 ServiceWorkerStatusCode status); 208 ServiceWorkerStatusCode status);
206 void ReleaseSourceInfo(const ServiceWorkerClientInfo& source_info); 209 void ReleaseSourceInfo(const ServiceWorkerClientInfo& source_info);
207 void ReleaseSourceInfo(const ServiceWorkerObjectInfo& source_info); 210 void ReleaseSourceInfo(const ServiceWorkerObjectInfo& source_info);
208 211
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 mojo::AssociatedBindingSet<mojom::ServiceWorkerDispatcherHost> bindings_; 290 mojo::AssociatedBindingSet<mojom::ServiceWorkerDispatcherHost> bindings_;
288 291
289 base::WeakPtrFactory<ServiceWorkerDispatcherHost> weak_factory_; 292 base::WeakPtrFactory<ServiceWorkerDispatcherHost> weak_factory_;
290 293
291 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); 294 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost);
292 }; 295 };
293 296
294 } // namespace content 297 } // namespace content
295 298
296 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ 299 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698