forked from mirrors/gecko-dev
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/D55444
--HG--
extra : moz-landing-system : lando
113 lines
3.4 KiB
C++
113 lines
3.4 KiB
C++
/* 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/. */
|
|
|
|
#include "nsHtml5Module.h"
|
|
#include "mozilla/Attributes.h"
|
|
#include "mozilla/Preferences.h"
|
|
#include "mozilla/Services.h"
|
|
#include "mozilla/StaticPrefs_html5.h"
|
|
#include "nsHtml5AttributeName.h"
|
|
#include "nsHtml5ElementName.h"
|
|
#include "nsHtml5HtmlAttributes.h"
|
|
#include "nsHtml5NamedCharacters.h"
|
|
#include "nsHtml5Portability.h"
|
|
#include "nsHtml5StackNode.h"
|
|
#include "nsHtml5Tokenizer.h"
|
|
#include "nsHtml5TreeBuilder.h"
|
|
#include "nsHtml5UTF16Buffer.h"
|
|
#include "nsIObserverService.h"
|
|
|
|
using namespace mozilla;
|
|
|
|
// static
|
|
nsIThread* nsHtml5Module::sStreamParserThread = nullptr;
|
|
nsIThread* nsHtml5Module::sMainThread = nullptr;
|
|
|
|
// static
|
|
void nsHtml5Module::InitializeStatics() {
|
|
nsHtml5AttributeName::initializeStatics();
|
|
nsHtml5ElementName::initializeStatics();
|
|
nsHtml5HtmlAttributes::initializeStatics();
|
|
nsHtml5NamedCharacters::initializeStatics();
|
|
nsHtml5Portability::initializeStatics();
|
|
nsHtml5StackNode::initializeStatics();
|
|
nsHtml5Tokenizer::initializeStatics();
|
|
nsHtml5TreeBuilder::initializeStatics();
|
|
nsHtml5UTF16Buffer::initializeStatics();
|
|
#ifdef DEBUG
|
|
sNsHtml5ModuleInitialized = true;
|
|
#endif
|
|
}
|
|
|
|
// static
|
|
void nsHtml5Module::ReleaseStatics() {
|
|
#ifdef DEBUG
|
|
sNsHtml5ModuleInitialized = false;
|
|
#endif
|
|
nsHtml5AttributeName::releaseStatics();
|
|
nsHtml5ElementName::releaseStatics();
|
|
nsHtml5HtmlAttributes::releaseStatics();
|
|
nsHtml5NamedCharacters::releaseStatics();
|
|
nsHtml5Portability::releaseStatics();
|
|
nsHtml5StackNode::releaseStatics();
|
|
nsHtml5Tokenizer::releaseStatics();
|
|
nsHtml5TreeBuilder::releaseStatics();
|
|
nsHtml5UTF16Buffer::releaseStatics();
|
|
NS_IF_RELEASE(sStreamParserThread);
|
|
NS_IF_RELEASE(sMainThread);
|
|
}
|
|
|
|
// static
|
|
already_AddRefed<nsHtml5Parser> nsHtml5Module::NewHtml5Parser() {
|
|
MOZ_ASSERT(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized.");
|
|
RefPtr<nsHtml5Parser> rv = new nsHtml5Parser();
|
|
return rv.forget();
|
|
}
|
|
|
|
class nsHtml5ParserThreadTerminator final : public nsIObserver {
|
|
public:
|
|
NS_DECL_ISUPPORTS
|
|
explicit nsHtml5ParserThreadTerminator(nsIThread* aThread)
|
|
: mThread(aThread) {}
|
|
NS_IMETHOD Observe(nsISupports*, const char* topic,
|
|
const char16_t*) override {
|
|
NS_ASSERTION(!strcmp(topic, "xpcom-shutdown-threads"), "Unexpected topic");
|
|
if (mThread) {
|
|
mThread->Shutdown();
|
|
mThread = nullptr;
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
private:
|
|
~nsHtml5ParserThreadTerminator() {}
|
|
|
|
nsCOMPtr<nsIThread> mThread;
|
|
};
|
|
|
|
NS_IMPL_ISUPPORTS(nsHtml5ParserThreadTerminator, nsIObserver)
|
|
|
|
// static
|
|
nsIThread* nsHtml5Module::GetStreamParserThread() {
|
|
if (StaticPrefs::html5_offmainthread()) {
|
|
if (!sStreamParserThread) {
|
|
NS_NewNamedThread("HTML5 Parser", &sStreamParserThread);
|
|
NS_ASSERTION(sStreamParserThread, "Thread creation failed!");
|
|
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
|
NS_ASSERTION(os, "do_GetService failed");
|
|
os->AddObserver(new nsHtml5ParserThreadTerminator(sStreamParserThread),
|
|
"xpcom-shutdown-threads", false);
|
|
}
|
|
return sStreamParserThread;
|
|
}
|
|
if (!sMainThread) {
|
|
NS_GetMainThread(&sMainThread);
|
|
NS_ASSERTION(sMainThread, "Main thread getter failed");
|
|
}
|
|
return sMainThread;
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
bool nsHtml5Module::sNsHtml5ModuleInitialized = false;
|
|
#endif
|