mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset bd71f9da9d7d (bug 990230) for build failures
This commit is contained in:
parent
6bd1d4370a
commit
54eb66fa0c
@ -118,60 +118,26 @@ SignalPipeWatcher::GetSingleton()
|
||||
return sSingleton;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
SignalPipeWatcher::RegisterCallbackRunnable(const uint8_t& aSignal,
|
||||
const PipeCallback& aCallback)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetIOMessageLoop() == MessageLoopForIO::current());
|
||||
if (sSingleton) {
|
||||
sSingleton->RegisterCallback(aSignal, aCallback);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SignalPipeWatcher::RegisterCallback(uint8_t aSignal,
|
||||
/* static */ void
|
||||
SignalPipeWatcher::RegisterCallback(const uint8_t aSignal,
|
||||
PipeCallback aCallback)
|
||||
{
|
||||
if (XRE_GetIOMessageLoop() != MessageLoopForIO::current()) {
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(RegisterCallbackRunnable, aSignal, aCallback));
|
||||
return;
|
||||
}
|
||||
|
||||
for (SignalInfoArray::index_type i = 0; i < mSignalInfo.Length(); i++)
|
||||
for (SignalInfoArray::index_type i = 0;
|
||||
i < SignalPipeWatcher::mSignalInfo.Length(); i++)
|
||||
{
|
||||
if (mSignalInfo[i].mSignal == aSignal) {
|
||||
if (SignalPipeWatcher::mSignalInfo[i].mSignal == aSignal) {
|
||||
LOG("Register Signal(%d) callback failed! (DUPLICATE)", aSignal);
|
||||
return;
|
||||
}
|
||||
}
|
||||
SignalInfo signalInfo = { aSignal, aCallback };
|
||||
mSignalInfo.AppendElement(signalInfo);
|
||||
RegisterSignalHandler(signalInfo.mSignal);
|
||||
SignalInfo aSignalInfo = { aSignal, aCallback };
|
||||
SignalPipeWatcher::mSignalInfo.AppendElement(aSignalInfo);
|
||||
SignalPipeWatcher::RegisterSignalHandler(aSignalInfo.mSignal);
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
SignalPipeWatcher::RegisterSignalHandlerRunnable(const uint8_t& aSignal)
|
||||
/* static */ void
|
||||
SignalPipeWatcher::RegisterSignalHandler(const uint8_t aSignal)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetIOMessageLoop() == MessageLoopForIO::current());
|
||||
if (sSingleton) {
|
||||
sSingleton->RegisterSignalHandler(aSignal);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SignalPipeWatcher::RegisterSignalHandler(uint8_t aSignal)
|
||||
{
|
||||
if (XRE_GetIOMessageLoop() != MessageLoopForIO::current()) {
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(RegisterSignalHandlerRunnable, aSignal));
|
||||
return;
|
||||
}
|
||||
|
||||
struct sigaction action;
|
||||
memset(&action, 0, sizeof(action));
|
||||
sigemptyset(&action.sa_mask);
|
||||
@ -182,10 +148,10 @@ SignalPipeWatcher::RegisterSignalHandler(uint8_t aSignal)
|
||||
LOG("SignalPipeWatcher failed to register sig %d.", aSignal);
|
||||
}
|
||||
} else {
|
||||
for (SignalInfoArray::index_type i = 0; i < mSignalInfo.Length(); i++) {
|
||||
if (sigaction(mSignalInfo[i].mSignal, &action, nullptr)) {
|
||||
for (SignalInfoArray::index_type i = 0; i < SignalPipeWatcher::mSignalInfo.Length(); i++) {
|
||||
if (sigaction(SignalPipeWatcher::mSignalInfo[i].mSignal, &action, nullptr)) {
|
||||
LOG("SignalPipeWatcher failed to register signal(%d) "
|
||||
"dump signal handler.", mSignalInfo[i].mSignal);
|
||||
"dump signal handler.",SignalPipeWatcher::mSignalInfo[i].mSignal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -193,9 +159,8 @@ SignalPipeWatcher::RegisterSignalHandler(uint8_t aSignal)
|
||||
|
||||
SignalPipeWatcher::~SignalPipeWatcher()
|
||||
{
|
||||
if (sDumpPipeWriteFd != -1) {
|
||||
StopWatching();
|
||||
}
|
||||
if (sDumpPipeWriteFd != -1)
|
||||
SignalPipeWatcher::StopWatching();
|
||||
}
|
||||
|
||||
int SignalPipeWatcher::OpenFd()
|
||||
@ -217,7 +182,7 @@ int SignalPipeWatcher::OpenFd()
|
||||
int readFd = pipeFds[0];
|
||||
sDumpPipeWriteFd = pipeFds[1];
|
||||
|
||||
RegisterSignalHandler();
|
||||
SignalPipeWatcher::RegisterSignalHandler();
|
||||
return readFd;
|
||||
}
|
||||
|
||||
@ -250,9 +215,9 @@ void SignalPipeWatcher::OnFileCanReadWithoutBlocking(int aFd)
|
||||
return;
|
||||
}
|
||||
|
||||
for (SignalInfoArray::index_type i = 0; i < mSignalInfo.Length(); i++) {
|
||||
if(signum == mSignalInfo[i].mSignal) {
|
||||
mSignalInfo[i].mCallback(signum);
|
||||
for (SignalInfoArray::index_type i = 0; i < SignalPipeWatcher::mSignalInfo.Length(); i++) {
|
||||
if(signum == SignalPipeWatcher::mSignalInfo[i].mSignal) {
|
||||
SignalPipeWatcher::mSignalInfo[i].mCallback(signum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -292,42 +257,25 @@ FifoWatcher::MaybeCreate()
|
||||
}
|
||||
|
||||
// The FifoWatcher is held alive by the observer service.
|
||||
if (!sSingleton) {
|
||||
GetSingleton();
|
||||
if (!FifoWatcher::sSingleton) {
|
||||
FifoWatcher::GetSingleton();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//static
|
||||
void
|
||||
FifoWatcher::RegisterCallbackRunnable(const nsCString& aCommand,
|
||||
const FifoCallback& aCallback)
|
||||
FifoWatcher::RegisterCallback(const nsCString& aCommand,FifoCallback aCallback)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetIOMessageLoop() == MessageLoopForIO::current());
|
||||
if (sSingleton) {
|
||||
sSingleton->RegisterCallback(aCommand, aCallback);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FifoWatcher::RegisterCallback(const nsCString& aCommand, FifoCallback aCallback)
|
||||
{
|
||||
if (XRE_GetIOMessageLoop() != MessageLoopForIO::current()) {
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(RegisterCallbackRunnable, aCommand, aCallback));
|
||||
return;
|
||||
}
|
||||
|
||||
for (FifoInfoArray::index_type i = 0; i < mFifoInfo.Length(); i++)
|
||||
for (FifoInfoArray::index_type i = 0;
|
||||
i < FifoWatcher::mFifoInfo.Length(); i++)
|
||||
{
|
||||
if (mFifoInfo[i].mCommand.Equals(aCommand)) {
|
||||
if (FifoWatcher::mFifoInfo[i].mCommand.Equals(aCommand)) {
|
||||
LOG("Register command(%s) callback failed! (DUPLICATE)", aCommand.get());
|
||||
return;
|
||||
}
|
||||
}
|
||||
FifoInfo aFifoInfo = { aCommand, aCallback };
|
||||
mFifoInfo.AppendElement(aFifoInfo);
|
||||
FifoWatcher::mFifoInfo.AppendElement(aFifoInfo);
|
||||
}
|
||||
|
||||
FifoWatcher::~FifoWatcher()
|
||||
@ -444,10 +392,10 @@ void FifoWatcher::OnFileCanReadWithoutBlocking(int aFd)
|
||||
// it'll actually write "foo\n" to the fifo.
|
||||
inputStr.Trim("\b\t\r\n");
|
||||
|
||||
for (FifoInfoArray::index_type i = 0; i < mFifoInfo.Length(); i++) {
|
||||
const nsCString commandStr = mFifoInfo[i].mCommand;
|
||||
for (FifoInfoArray::index_type i = 0; i < FifoWatcher::mFifoInfo.Length(); i++) {
|
||||
const nsCString commandStr = FifoWatcher::mFifoInfo[i].mCommand;
|
||||
if(inputStr == commandStr.get()) {
|
||||
mFifoInfo[i].mCallback(inputStr);
|
||||
FifoWatcher::mFifoInfo[i].mCallback(inputStr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,6 @@ private:
|
||||
: mDirPath(aPath)
|
||||
{}
|
||||
|
||||
static void RegisterCallbackRunnable(const nsCString& aCommand, const FifoCallback& aCallback);
|
||||
FifoInfoArray mFifoInfo;
|
||||
};
|
||||
|
||||
@ -144,9 +143,9 @@ class SignalPipeWatcher : public FdWatcher
|
||||
public:
|
||||
static SignalPipeWatcher* GetSingleton();
|
||||
|
||||
void RegisterCallback(uint8_t aSignal, PipeCallback aCallback);
|
||||
void RegisterCallback(const uint8_t aSignal, PipeCallback aCallback);
|
||||
|
||||
void RegisterSignalHandler(uint8_t aSignal = 0);
|
||||
void RegisterSignalHandler(const uint8_t aSignal = 0);
|
||||
|
||||
virtual ~SignalPipeWatcher();
|
||||
|
||||
@ -164,9 +163,6 @@ private:
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
}
|
||||
|
||||
static void RegisterCallbackRunnable(const uint8_t& aSignal, const PipeCallback& aCallback);
|
||||
static void RegisterSignalHandlerRunnable(const uint8_t& aSignal);
|
||||
|
||||
SignalInfoArray mSignalInfo;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user