gecko-dev/dom/base/ContentProcessMessageManager.h
Gabriele Svelto ace6d1063f Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442

--HG--
extra : moz-landing-system : lando
2019-12-06 09:24:56 +00:00

106 lines
3.3 KiB
C++

/* -*- 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/. */
#ifndef mozilla_dom_ContentProcessMessageManager_h
#define mozilla_dom_ContentProcessMessageManager_h
#include "mozilla/Attributes.h"
#include "mozilla/dom/MessageManagerGlobal.h"
#include "nsCOMPtr.h"
#include "nsFrameMessageManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptContext.h"
#include "nsServiceManagerUtils.h"
#include "nsWeakReference.h"
#include "nsWrapperCache.h"
#include "xpcpublic.h"
namespace mozilla {
namespace dom {
namespace ipc {
class SharedMap;
}
/**
* This class implements a singleton process message manager for content
* processes. Each child process has exactly one instance of this class, which
* hosts the process's process scripts, and may exchange messages with its
* corresponding ParentProcessMessageManager on the parent side.
*/
class ContentProcessMessageManager : public nsIMessageSender,
public nsMessageManagerScriptExecutor,
public nsSupportsWeakReference,
public ipc::MessageManagerCallback,
public MessageManagerGlobal,
public nsWrapperCache {
public:
explicit ContentProcessMessageManager(nsFrameMessageManager* aMessageManager);
using ipc::MessageManagerCallback::GetProcessMessageManager;
using MessageManagerGlobal::GetProcessMessageManager;
bool Init();
static ContentProcessMessageManager* Get();
static bool WasCreated();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(
ContentProcessMessageManager, nsIMessageSender)
void MarkForCC();
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
JSObject* GetOrCreateWrapper();
using MessageManagerGlobal::AddMessageListener;
using MessageManagerGlobal::AddWeakMessageListener;
using MessageManagerGlobal::RemoveMessageListener;
using MessageManagerGlobal::RemoveWeakMessageListener;
// ContentProcessMessageManager
void GetInitialProcessData(JSContext* aCx,
JS::MutableHandle<JS::Value> aInitialProcessData,
ErrorResult& aError) {
if (!mMessageManager) {
aError.Throw(NS_ERROR_NOT_INITIALIZED);
return;
}
mMessageManager->GetInitialProcessData(aCx, aInitialProcessData, aError);
}
already_AddRefed<ipc::SharedMap> SharedData();
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
nsIGlobalObject* GetParentObject() const {
return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
}
virtual void LoadScript(const nsAString& aURL);
bool IsProcessScoped() const override { return true; }
void SetInitialProcessData(JS::HandleValue aInitialData);
protected:
virtual ~ContentProcessMessageManager();
private:
bool mInitialized;
static bool sWasCreated;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ContentProcessMessageManager_h