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

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

Issue 1632113004: ServiceWorker: Add initial implementation of ExtendableMessageEvent behind a flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 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_VERSION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <functional> 10 #include <functional>
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // For simple events where the full functionality of DispatchEvent is not 229 // For simple events where the full functionality of DispatchEvent is not
230 // needed, this method can be used instead. The ResponseMessage must consist 230 // needed, this method can be used instead. The ResponseMessage must consist
231 // of just a request_id and a blink::WebServiceWorkerEventResult field. The 231 // of just a request_id and a blink::WebServiceWorkerEventResult field. The
232 // result is converted to a ServiceWorkerStatusCode and passed to the error 232 // result is converted to a ServiceWorkerStatusCode and passed to the error
233 // handler associated with the request. Additionally this methods calls 233 // handler associated with the request. Additionally this methods calls
234 // FinishRequest before passing the reply to the callback. 234 // FinishRequest before passing the reply to the callback.
235 template <typename ResponseMessage> 235 template <typename ResponseMessage>
236 void DispatchSimpleEvent(int request_id, const IPC::Message& message); 236 void DispatchSimpleEvent(int request_id, const IPC::Message& message);
237 237
238 // Sends a message event to the associated embedded worker. 238 // Sends a message event to the associated embedded worker.
239 // TODO(nhiroki): Remove this after ExtendableMessageEvent is enabled by
240 // default (crbug.com/543198).
239 void DispatchMessageEvent( 241 void DispatchMessageEvent(
240 const base::string16& message, 242 const base::string16& message,
241 const std::vector<TransferredMessagePort>& sent_message_ports, 243 const std::vector<TransferredMessagePort>& sent_message_ports,
242 const StatusCallback& callback); 244 const StatusCallback& callback);
243 245
246 // Sends an extendable message event to the associated embedded worker.
247 // TODO(nhiroki): This should be moved to ServiceWorkerDispatcherHost in favor
248 // of crbug.com/570820 after ExtendableMessageEvent is implemented
249 // (crbug.com/543198).
250 void DispatchExtendableMessageEvent(
251 const base::string16& message,
252 const std::vector<TransferredMessagePort>& sent_message_ports,
253 const StatusCallback& callback);
254
244 // Sends install event to the associated embedded worker and asynchronously 255 // Sends install event to the associated embedded worker and asynchronously
245 // calls |callback| when it errors out or it gets a response from the worker 256 // calls |callback| when it errors out or it gets a response from the worker
246 // to notify install completion. 257 // to notify install completion.
247 // 258 //
248 // This must be called when the status() is NEW. Calling this changes 259 // This must be called when the status() is NEW. Calling this changes
249 // the version's status to INSTALLING. 260 // the version's status to INSTALLING.
250 // Upon completion, the version's status will be changed to INSTALLED 261 // Upon completion, the version's status will be changed to INSTALLED
251 // on success, or back to NEW on failure. 262 // on success, or back to NEW on failure.
252 void DispatchInstallEvent(const StatusCallback& callback); 263 void DispatchInstallEvent(const StatusCallback& callback);
253 264
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 int message_level, 542 int message_level,
532 const base::string16& message, 543 const base::string16& message,
533 int line_number, 544 int line_number,
534 const GURL& source_url) override; 545 const GURL& source_url) override;
535 bool OnMessageReceived(const IPC::Message& message) override; 546 bool OnMessageReceived(const IPC::Message& message) override;
536 547
537 void OnStartSentAndScriptEvaluated(ServiceWorkerStatusCode status); 548 void OnStartSentAndScriptEvaluated(ServiceWorkerStatusCode status);
538 549
539 void DispatchInstallEventAfterStartWorker(const StatusCallback& callback); 550 void DispatchInstallEventAfterStartWorker(const StatusCallback& callback);
540 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback); 551 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback);
552 void DispatchExtendableMessageEventAfterStartWorker(
553 const base::string16& message,
554 const std::vector<TransferredMessagePort>& sent_message_ports,
555 const StatusCallback& callback);
541 556
542 void DispatchMessageEventInternal( 557 void DispatchMessageEventInternal(
543 const base::string16& message, 558 const base::string16& message,
544 const std::vector<TransferredMessagePort>& sent_message_ports, 559 const std::vector<TransferredMessagePort>& sent_message_ports,
545 const StatusCallback& callback); 560 const StatusCallback& callback);
546 561
547 // Message handlers. 562 // Message handlers.
548 563
549 // This corresponds to the spec's matchAll(options) steps. 564 // This corresponds to the spec's matchAll(options) steps.
550 void OnGetClients(int request_id, 565 void OnGetClients(int request_id,
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 838
824 // At this point |this| can have been deleted, so don't do anything other 839 // At this point |this| can have been deleted, so don't do anything other
825 // than returning. 840 // than returning.
826 841
827 return true; 842 return true;
828 } 843 }
829 844
830 } // namespace content 845 } // namespace content
831 846
832 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 847 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698