当前位置: 首页>>代码示例>>C++>>正文


C++ AssertIsOnBackgroundThread函数代码示例

本文整理汇总了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;
}
开发者ID:logicoftekk,项目名称:cyberfox,代码行数:11,代码来源:VsyncParent.cpp

示例2: AssertIsOnBackgroundThread

// static
already_AddRefed<BroadcastChannelService>
BroadcastChannelService::GetOrCreate()
{
  AssertIsOnBackgroundThread();

  RefPtr<BroadcastChannelService> instance = sInstance;
  if (!instance) {
    instance = new BroadcastChannelService();
  }
  return instance.forget();
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:12,代码来源:BroadcastChannelService.cpp

示例3: MOZ_ASSERT

void
VsyncParent::ActorDestroy(ActorDestroyReason aReason)
{
  MOZ_ASSERT(!mDestroyed);
  AssertIsOnBackgroundThread();
  if (mObservingVsync) {
    mVsyncDispatcher->RemoveChildRefreshTimer(this);
  }
  mVsyncDispatcher = nullptr;
  mDestroyed = true;
}
开发者ID:logicoftekk,项目名称:cyberfox,代码行数:11,代码来源:VsyncParent.cpp

示例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);
  }
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:12,代码来源:RemoteWorkerManager.cpp

示例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();
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:12,代码来源:BroadcastChannelParent.cpp

示例6: AssertIsInMainProcess

/* static */ MessagePortService*
MessagePortService::GetOrCreate()
{
  AssertIsInMainProcess();
  AssertIsOnBackgroundThread();

  if (!gInstance) {
    gInstance = new MessagePortService();
  }

  return gInstance;
}
开发者ID:Manishearth,项目名称:gecko-dev,代码行数:12,代码来源:MessagePortService.cpp

示例7: AssertIsOnBackgroundThread

bool
ServiceWorkerManagerParent::RecvPropagateRemove(const nsCString& aHost)
{
  AssertIsOnBackgroundThread();

  if (NS_WARN_IF(!mService)) {
    return false;
  }

  mService->PropagateRemove(mID, aHost);
  return true;
}
开发者ID:70599,项目名称:Waterfox,代码行数:12,代码来源:ServiceWorkerManagerParent.cpp

示例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;
}
开发者ID:MekliCZ,项目名称:positron,代码行数:53,代码来源:NuwaParent.cpp

示例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);
  }
}
开发者ID:devtools-html,项目名称:gecko-dev,代码行数:13,代码来源:ServiceWorkerManagerParent.cpp

示例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;
}
开发者ID:haasn,项目名称:gecko-dev,代码行数:13,代码来源:BroadcastChannelParent.cpp

示例11: AssertIsOnBackgroundThread

void
FileSystemTaskParentBase::HandleResult()
{
  AssertIsOnBackgroundThread();
  mFileSystem->AssertIsOnOwningThread();

  if (mFileSystem->IsShutdown()) {
    return;
  }

  MOZ_ASSERT(mRequestParent);
  Unused << mRequestParent->Send__delete__(mRequestParent, GetRequestResult());
}
开发者ID:bgrins,项目名称:gecko-dev,代码行数:13,代码来源:FileSystemTaskBase.cpp

示例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);
}
开发者ID:digideskio,项目名称:newtab-dev,代码行数:13,代码来源:CreateDirectoryTask.cpp

示例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);
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:13,代码来源:GamepadPlatformService.cpp

示例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);
  }
}
开发者ID:brendandahl,项目名称:positron,代码行数:14,代码来源:VsyncParent.cpp

示例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);
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:14,代码来源:BroadcastChannelService.cpp


注:本文中的AssertIsOnBackgroundThread函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。