mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
050f1df69c
Backed out changeset e6cd15d43b5a (bug 1121472) Backed out changeset 4f9788639f3f (bug 966439) Backed out changeset ac9a967e5a10 (bug 966439) Backed out changeset 14d322737871 (bug 966439) Backed out changeset 8f941e519580 (bug 966439) Backed out changeset b82d1010c6b4 (bug 966439) Backed out changeset 2c29a52a03bd (bug 966439) Backed out changeset e4b0802a3f06 (bug 966439) Backed out changeset bdc9a0310034 (bug 966439) Backed out changeset 6b3ae19628e6 (bug 966439) Backed out changeset 3d23e775033a (bug 966439) CLOSED TREE
199 lines
4.8 KiB
C++
199 lines
4.8 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 "BackgroundChildImpl.h"
|
|
|
|
#include "ActorsChild.h" // IndexedDB
|
|
#include "FileDescriptorSetChild.h"
|
|
#include "mozilla/Assertions.h"
|
|
#include "mozilla/dom/PBlobChild.h"
|
|
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryChild.h"
|
|
#include "mozilla/dom/ipc/BlobChild.h"
|
|
#include "mozilla/ipc/PBackgroundTestChild.h"
|
|
#include "nsID.h"
|
|
#include "nsTraceRefcnt.h"
|
|
|
|
namespace {
|
|
|
|
class TestChild MOZ_FINAL : public mozilla::ipc::PBackgroundTestChild
|
|
{
|
|
friend class mozilla::ipc::BackgroundChildImpl;
|
|
|
|
nsCString mTestArg;
|
|
|
|
explicit TestChild(const nsCString& aTestArg)
|
|
: mTestArg(aTestArg)
|
|
{
|
|
MOZ_COUNT_CTOR(TestChild);
|
|
}
|
|
|
|
protected:
|
|
~TestChild()
|
|
{
|
|
MOZ_COUNT_DTOR(TestChild);
|
|
}
|
|
|
|
public:
|
|
virtual bool
|
|
Recv__delete__(const nsCString& aTestArg) MOZ_OVERRIDE;
|
|
};
|
|
|
|
} // anonymous namespace
|
|
|
|
namespace mozilla {
|
|
namespace ipc {
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// BackgroundChildImpl::ThreadLocal
|
|
// -----------------------------------------------------------------------------
|
|
|
|
BackgroundChildImpl::
|
|
ThreadLocal::ThreadLocal()
|
|
{
|
|
// May happen on any thread!
|
|
MOZ_COUNT_CTOR(mozilla::ipc::BackgroundChildImpl::ThreadLocal);
|
|
}
|
|
|
|
BackgroundChildImpl::
|
|
ThreadLocal::~ThreadLocal()
|
|
{
|
|
// May happen on any thread!
|
|
MOZ_COUNT_DTOR(mozilla::ipc::BackgroundChildImpl::ThreadLocal);
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// BackgroundChildImpl
|
|
// -----------------------------------------------------------------------------
|
|
|
|
BackgroundChildImpl::BackgroundChildImpl()
|
|
{
|
|
// May happen on any thread!
|
|
MOZ_COUNT_CTOR(mozilla::ipc::BackgroundChildImpl);
|
|
}
|
|
|
|
BackgroundChildImpl::~BackgroundChildImpl()
|
|
{
|
|
// May happen on any thread!
|
|
MOZ_COUNT_DTOR(mozilla::ipc::BackgroundChildImpl);
|
|
}
|
|
|
|
void
|
|
BackgroundChildImpl::ProcessingError(Result aWhat)
|
|
{
|
|
// May happen on any thread!
|
|
|
|
nsAutoCString abortMessage;
|
|
|
|
switch (aWhat) {
|
|
|
|
#define HANDLE_CASE(_result) \
|
|
case _result: \
|
|
abortMessage.AssignLiteral(#_result); \
|
|
break
|
|
|
|
HANDLE_CASE(MsgDropped);
|
|
HANDLE_CASE(MsgNotKnown);
|
|
HANDLE_CASE(MsgNotAllowed);
|
|
HANDLE_CASE(MsgPayloadError);
|
|
HANDLE_CASE(MsgProcessingError);
|
|
HANDLE_CASE(MsgRouteError);
|
|
HANDLE_CASE(MsgValueError);
|
|
|
|
#undef HANDLE_CASE
|
|
|
|
default:
|
|
MOZ_CRASH("Unknown error code!");
|
|
}
|
|
|
|
// This is just MOZ_CRASH() un-inlined so that we can pass the result code as
|
|
// a string. MOZ_CRASH() only supports string literals at the moment.
|
|
MOZ_ReportCrash(abortMessage.get(), __FILE__, __LINE__); MOZ_REALLY_CRASH();
|
|
}
|
|
|
|
void
|
|
BackgroundChildImpl::ActorDestroy(ActorDestroyReason aWhy)
|
|
{
|
|
// May happen on any thread!
|
|
}
|
|
|
|
PBackgroundTestChild*
|
|
BackgroundChildImpl::AllocPBackgroundTestChild(const nsCString& aTestArg)
|
|
{
|
|
return new TestChild(aTestArg);
|
|
}
|
|
|
|
bool
|
|
BackgroundChildImpl::DeallocPBackgroundTestChild(PBackgroundTestChild* aActor)
|
|
{
|
|
MOZ_ASSERT(aActor);
|
|
|
|
delete static_cast<TestChild*>(aActor);
|
|
return true;
|
|
}
|
|
|
|
BackgroundChildImpl::PBackgroundIDBFactoryChild*
|
|
BackgroundChildImpl::AllocPBackgroundIDBFactoryChild(
|
|
const LoggingInfo& aLoggingInfo)
|
|
{
|
|
MOZ_CRASH("PBackgroundIDBFactoryChild actors should be manually "
|
|
"constructed!");
|
|
}
|
|
|
|
bool
|
|
BackgroundChildImpl::DeallocPBackgroundIDBFactoryChild(
|
|
PBackgroundIDBFactoryChild* aActor)
|
|
{
|
|
MOZ_ASSERT(aActor);
|
|
|
|
delete aActor;
|
|
return true;
|
|
}
|
|
|
|
auto
|
|
BackgroundChildImpl::AllocPBlobChild(const BlobConstructorParams& aParams)
|
|
-> PBlobChild*
|
|
{
|
|
MOZ_ASSERT(aParams.type() != BlobConstructorParams::T__None);
|
|
|
|
return mozilla::dom::BlobChild::Create(this, aParams);
|
|
}
|
|
|
|
bool
|
|
BackgroundChildImpl::DeallocPBlobChild(PBlobChild* aActor)
|
|
{
|
|
MOZ_ASSERT(aActor);
|
|
|
|
mozilla::dom::BlobChild::Destroy(aActor);
|
|
return true;
|
|
}
|
|
|
|
PFileDescriptorSetChild*
|
|
BackgroundChildImpl::AllocPFileDescriptorSetChild(
|
|
const FileDescriptor& aFileDescriptor)
|
|
{
|
|
return new FileDescriptorSetChild(aFileDescriptor);
|
|
}
|
|
|
|
bool
|
|
BackgroundChildImpl::DeallocPFileDescriptorSetChild(
|
|
PFileDescriptorSetChild* aActor)
|
|
{
|
|
MOZ_ASSERT(aActor);
|
|
|
|
delete static_cast<FileDescriptorSetChild*>(aActor);
|
|
return true;
|
|
}
|
|
|
|
} // namespace ipc
|
|
} // namespace mozilla
|
|
|
|
bool
|
|
TestChild::Recv__delete__(const nsCString& aTestArg)
|
|
{
|
|
MOZ_RELEASE_ASSERT(aTestArg == mTestArg,
|
|
"BackgroundTest message was corrupted!");
|
|
|
|
return true;
|
|
}
|