本文整理汇总了C++中AssertIsOnBackgroundThread函数的典型用法代码示例。如果您正苦于以下问题:C++ AssertIsOnBackgroundThread函数的具体用法?C++ AssertIsOnBackgroundThread怎么用?C++ AssertIsOnBackgroundThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AssertIsOnBackgroundThread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssertIsOnBackgroundThread
bool
VsyncParent::RecvUnobserve()
{
AssertIsOnBackgroundThread();
if (mObservingVsync) {
mVsyncDispatcher->RemoveChildRefreshTimer(this);
mObservingVsync = false;
return true;
}
return false;
}
示例2: AssertIsOnBackgroundThread
// static
already_AddRefed<BroadcastChannelService>
BroadcastChannelService::GetOrCreate()
{
AssertIsOnBackgroundThread();
RefPtr<BroadcastChannelService> instance = sInstance;
if (!instance) {
instance = new BroadcastChannelService();
}
return instance.forget();
}
示例3: MOZ_ASSERT
void
VsyncParent::ActorDestroy(ActorDestroyReason aReason)
{
MOZ_ASSERT(!mDestroyed);
AssertIsOnBackgroundThread();
if (mObservingVsync) {
mVsyncDispatcher->RemoveChildRefreshTimer(this);
}
mVsyncDispatcher = nullptr;
mDestroyed = true;
}
示例4: AssertIsOnBackgroundThread
void RemoteWorkerManager::UnregisterActor(RemoteWorkerServiceParent* aActor) {
AssertIsOnBackgroundThread();
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(aActor);
if (aActor == mParentActor) {
mParentActor = nullptr;
} else {
MOZ_ASSERT(mChildActors.Contains(aActor));
mChildActors.RemoveElement(aActor);
}
}
示例5: AssertIsOnBackgroundThread
mozilla::ipc::IPCResult
BroadcastChannelParent::RecvPostMessage(const ClonedMessageData& aData)
{
AssertIsOnBackgroundThread();
if (NS_WARN_IF(!mService)) {
return IPC_FAIL_NO_REASON(this);
}
mService->PostMessage(this, aData, mOriginChannelKey);
return IPC_OK();
}
示例6: AssertIsInMainProcess
/* static */ MessagePortService*
MessagePortService::GetOrCreate()
{
AssertIsInMainProcess();
AssertIsOnBackgroundThread();
if (!gInstance) {
gInstance = new MessagePortService();
}
return gInstance;
}
示例7: AssertIsOnBackgroundThread
bool
ServiceWorkerManagerParent::RecvPropagateRemove(const nsCString& aHost)
{
AssertIsOnBackgroundThread();
if (NS_WARN_IF(!mService)) {
return false;
}
mService->PropagateRemove(mID, aHost);
return true;
}
示例8: MOZ_ASSERT
mozilla::ipc::IProtocol*
NuwaParent::CloneProtocol(Channel* aChannel,
ProtocolCloneContext* aCtx)
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<NuwaParent> self = this;
MonitorAutoLock lock(mMonitor);
// Alloc NuwaParent on the worker thread.
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([self] () -> void
{
MonitorAutoLock lock(self->mMonitor);
// XXX Calling NuwaParent::Alloc() leads to a compilation error. Use
// self->Alloc() as a workaround.
self->mClonedActor = self->Alloc();
lock.Notify();
});
MOZ_ASSERT(runnable);
MOZ_ALWAYS_SUCCEEDS(mWorkerThread->Dispatch(runnable, NS_DISPATCH_NORMAL));
while (!mClonedActor) {
lock.Wait();
}
RefPtr<NuwaParent> actor = mClonedActor;
mClonedActor = nullptr;
// mManager of the cloned actor is assigned after returning from this method.
// We can't call ActorConstructed() right after Alloc() in the above runnable.
// To be safe we dispatch a runnable to the current thread to do it.
runnable = NS_NewRunnableFunction([actor] () -> void
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> nested = NS_NewRunnableFunction([actor] () -> void
{
AssertIsOnBackgroundThread();
// Call NuwaParent::ActorConstructed() on the worker thread.
actor->ActorConstructed();
// The actor can finally be deleted after fully constructed.
mozilla::Unused << actor->Send__delete__(actor);
});
MOZ_ASSERT(nested);
MOZ_ALWAYS_SUCCEEDS(actor->mWorkerThread->Dispatch(nested, NS_DISPATCH_NORMAL));
});
MOZ_ASSERT(runnable);
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
return actor;
}
示例9: AssertIsOnBackgroundThread
void
ServiceWorkerManagerParent::ActorDestroy(ActorDestroyReason aWhy)
{
AssertIsOnBackgroundThread();
mActorDestroyed = true;
if (mService) {
// This object is about to be released and with it, also mService will be
// released too.
mService->UnregisterActor(this);
}
}
示例10: AssertIsOnBackgroundThread
bool
BroadcastChannelParent::RecvPostMessage(const ClonedMessageData& aData)
{
AssertIsOnBackgroundThread();
if (NS_WARN_IF(!mService)) {
return false;
}
mService->PostMessage(this, aData, mOrigin, mAppId, mIsInBrowserElement,
mChannel, mPrivateBrowsing);
return true;
}
示例11: AssertIsOnBackgroundThread
void
FileSystemTaskParentBase::HandleResult()
{
AssertIsOnBackgroundThread();
mFileSystem->AssertIsOnOwningThread();
if (mFileSystem->IsShutdown()) {
return;
}
MOZ_ASSERT(mRequestParent);
Unused << mRequestParent->Send__delete__(mRequestParent, GetRequestResult());
}
示例12: AssertIsOnBackgroundThread
FileSystemResponseValue
CreateDirectoryTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
{
AssertIsOnBackgroundThread();
nsAutoString path;
aRv = mTargetPath->GetPath(path);
if (NS_WARN_IF(aRv.Failed())) {
return FileSystemDirectoryResponse();
}
return FileSystemDirectoryResponse(path);
}
示例13: AssertIsOnBackgroundThread
void
GamepadPlatformService::RemoveChannelParent(GamepadEventChannelParent* aParent)
{
// mChannelParents can only be modified once GamepadEventChannelParent
// is created or removed in Background thread
AssertIsOnBackgroundThread();
MOZ_ASSERT(aParent);
MOZ_ASSERT(mChannelParents.Contains(aParent));
// We use mutex here to prevent race condition with monitor thread
MutexAutoLock autoLock(mMutex);
mChannelParents.RemoveElement(aParent);
}
示例14: AssertIsOnBackgroundThread
void
VsyncParent::DispatchVsyncEvent(TimeStamp aTimeStamp)
{
AssertIsOnBackgroundThread();
// If we call NotifyVsync() when we handle ActorDestroy() message, we might
// still call DispatchVsyncEvent().
// Similarly, we might also receive RecvUnobserveVsync() when call
// NotifyVsync(). We use mObservingVsync and mDestroyed flags to skip this
// notification.
if (mObservingVsync && !mDestroyed) {
Unused << SendNotify(aTimeStamp);
}
}
示例15: AssertIsOnBackgroundThread
void
BroadcastChannelService::PostMessage(BroadcastChannelParent* aParent,
const ClonedMessageData& aData,
const nsAString& aOrigin,
const nsAString& aChannel,
bool aPrivateBrowsing)
{
AssertIsOnBackgroundThread();
MOZ_ASSERT(aParent);
MOZ_ASSERT(mAgents.Contains(aParent));
PostMessageData data(aParent, aData, aOrigin, aChannel, aPrivateBrowsing);
mAgents.EnumerateEntries(PostMessageEnumerator, &data);
}