/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** * `PushDispatcher` is a base class used to forward observer notifications and * service worker events to the correct process.
*/ class MOZ_STACK_CLASS PushDispatcher { public: // Fires an XPCOM observer notification. This method may be called from both // processes. virtual nsresult NotifyObservers() = 0;
// Fires a service worker event. This method is called from the content // process if e10s is enabled, or the parent otherwise. virtual nsresult NotifyWorkers() = 0;
// A convenience method that calls `NotifyObservers` and `NotifyWorkers`.
nsresult NotifyObserversAndWorkers();
// Sends an IPDL message to fire an observer notification in the parent // process. This method is only called from the content process, and only // if e10s is enabled. virtualbool SendToParent(ContentChild* aParentActor) = 0;
// Sends an IPDL message to fire an observer notification and a service worker // event in the content process. This method is only called from the parent, // and only if e10s is enabled. virtualbool SendToChild(ContentParent* aContentActor) = 0;
// An optional method, called from the parent if e10s is enabled and there // are no active content processes. The default behavior is a no-op. virtual nsresult HandleNoChildProcesses();
/** * `PushNotifier` implements the `nsIPushNotifier` interface. This service * broadcasts XPCOM observer notifications for incoming push messages, then * forwards incoming push messages to service workers. * * All scriptable methods on this interface may be called from the parent or * content process. Observer notifications are broadcasted to both processes.
*/ class PushNotifier final : public nsIPushNotifier { public:
PushNotifier();
/** * `PushData` provides methods for retrieving push message data in different * formats. This class is similar to the `PushMessageData` WebIDL interface.
*/ class PushData final : public nsIPushData { public: explicit PushData(const nsTArray<uint8_t>& aData);
/** * `PushMessage` exposes the subscription principal and data for a push * message. Each `push-message` observer receives an instance of this class * as the subject.
*/ class PushMessage final : public nsIPushMessage { public:
PushMessage(nsIPrincipal* aPrincipal, nsIPushData* aData);
class PushSubscriptionChangeDispatcher final : public PushDispatcher { public:
PushSubscriptionChangeDispatcher(const nsACString& aScope,
nsIPrincipal* aPrincipal);
~PushSubscriptionChangeDispatcher();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.