/* -*- 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/. */
class ChildProcessMessageManager; class ChromeMessageBroadcaster; class ClonedMessageData; class MessageBroadcaster; class MessageListener; class MessageListenerManager; class MessageManagerReporter; class ParentProcessMessageManager; class ProcessMessageManager;
namespace ipc {
class MessageManagerCallback; class WritableSharedMap;
// If mWeakListener is null then mStrongListener holds a MessageListener. // If mWeakListener is non-null then mStrongListener contains null.
RefPtr<mozilla::dom::MessageListener> mStrongListener;
nsWeakPtr mWeakListener; bool mListenWhenClosed;
};
class nsFrameMessageManager : public nsIMessageSender { friendclass mozilla::dom::MessageManagerReporter; using StructuredCloneData = mozilla::dom::ipc::StructuredCloneData;
protected: using MessageManagerFlags = mozilla::dom::ipc::MessageManagerFlags;
// We keep the message listeners as arrays in a hastable indexed by the // message name. That gives us fast lookups in ReceiveMessage().
nsClassHashtable<nsStringHashKey,
nsAutoTObserverArray<nsMessageListenerInfo, 1>>
mListeners;
nsTArray<RefPtr<mozilla::dom::MessageListenerManager>> mChildManagers; bool mChrome; // true if we're in the chrome process bool mGlobal; // true if we're the global frame message manager bool mIsProcessManager; // true if the message manager belongs to the process // realm bool mIsBroadcaster; // true if the message manager is a broadcaster bool mOwnsCallback; bool mHandlingMessage; bool mClosed; // true if we can no longer send messages bool mDisconnected;
mozilla::dom::ipc::MessageManagerCallback* mCallback;
mozilla::UniquePtr<mozilla::dom::ipc::MessageManagerCallback> mOwnedCallback;
nsTArray<nsString> mPendingScripts;
nsTArray<bool> mPendingScriptsGlobalStates;
JS::Heap<JS::Value> mInitialProcessData;
RefPtr<mozilla::dom::ipc::WritableSharedMap> mSharedData;
/* A helper class for taking care of many details for async message sending within a single process. Intended to be used like so:
class MyAsyncMessage : public nsSameProcessAsyncMessageBase, public Runnable { NS_IMETHOD Run() { ReceiveMessage(..., ...); return NS_OK; } };
RefPtr<nsSameProcessAsyncMessageBase> ev = new MyAsyncMessage(); nsresult rv = ev->Init(...); if (NS_SUCCEEDED(rv)) { NS_DispatchToMainThread(ev); }
*/ class nsSameProcessAsyncMessageBase { public: using StructuredCloneData = mozilla::dom::ipc::StructuredCloneData;
// Returns true if this is a process message manager. There should only be a // single process message manager per session, so instances of this type will // optimize their script loading to avoid unnecessary duplication. virtualbool IsProcessScoped() const { returnfalse; }
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.