• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ AssertIsOnBackgroundThread函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AssertIsOnBackgroundThread函数的典型用法代码示例。如果您正苦于以下问题:C++ AssertIsOnBackgroundThread函数的具体用法?C++ AssertIsOnBackgroundThread怎么用?C++ AssertIsOnBackgroundThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AssertIsOnBackgroundThread函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: AssertIsOnBackgroundThread

void
ServiceWorkerManagerService::PropagateSoftUpdate(
                                      uint64_t aParentID,
                                      const PrincipalOriginAttributes& aOriginAttributes,
                                      const nsAString& aScope)
{
  AssertIsOnBackgroundThread();

  nsAutoPtr<nsTArray<NotifySoftUpdateData>> notifySoftUpdateDataArray(
      new nsTArray<NotifySoftUpdateData>());
  DebugOnly<bool> parentFound = false;
  for (auto iter = mAgents.Iter(); !iter.Done(); iter.Next()) {
    RefPtr<ServiceWorkerManagerParent> parent = iter.Get()->GetKey();
    MOZ_ASSERT(parent);

#ifdef DEBUG
    if (parent->ID() == aParentID) {
      parentFound = true;
    }
#endif

    RefPtr<ContentParent> contentParent = parent->GetContentParent();

    // If the ContentParent is null we are dealing with a same-process actor.
    if (!contentParent) {
      Unused << parent->SendNotifySoftUpdate(aOriginAttributes,
                                             nsString(aScope));
      continue;
    }

    NotifySoftUpdateData* data = notifySoftUpdateDataArray->AppendElement();
    data->mContentParent.swap(contentParent);
    data->mParent.swap(parent);
  }

  if (notifySoftUpdateDataArray->IsEmpty()) {
    return;
  }

  RefPtr<NotifySoftUpdateIfPrincipalOkRunnable> runnable =
    new NotifySoftUpdateIfPrincipalOkRunnable(notifySoftUpdateDataArray,
                                              aOriginAttributes, aScope);
  MOZ_ASSERT(!notifySoftUpdateDataArray);
  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));

#ifdef DEBUG
  MOZ_ASSERT(parentFound);
#endif
}
开发者ID:MekliCZ,项目名称:positron,代码行数:49,代码来源:ServiceWorkerManagerService.cpp


示例17: mErrorValue

FileSystemTaskParentBase::FileSystemTaskParentBase(FileSystemBase* aFileSystem,
                                                  const FileSystemParams& aParam,
                                                  FileSystemRequestParent* aParent)
  : mErrorValue(NS_OK)
  , mFileSystem(aFileSystem)
  , mRequestParent(aParent)
  , mBackgroundEventTarget(NS_GetCurrentThread())
{
  MOZ_ASSERT(XRE_IsParentProcess(),
             "Only call from parent process!");
  MOZ_ASSERT(aFileSystem, "aFileSystem should not be null.");
  MOZ_ASSERT(aParent);
  MOZ_ASSERT(mBackgroundEventTarget);
  AssertIsOnBackgroundThread();
}
开发者ID:cliqz-oss,项目名称:browser-f,代码行数:15,代码来源:FileSystemTaskBase.cpp


示例18: AssertIsOnBackgroundThread

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

  if (NeedToGoToMainThread()) {
    nsresult rv = NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
    NS_WARN_IF(NS_FAILED(rv));
    return;
  }

  nsresult rv = DispatchToIOThread(this);
  NS_WARN_IF(NS_FAILED(rv));
}
开发者ID:cliqz-oss,项目名称:browser-f,代码行数:15,代码来源:FileSystemTaskBase.cpp


示例19: AssertIsOnBackgroundThread

void
FileSystemRequestParent::ActorDestroy(ActorDestroyReason aWhy)
{
  AssertIsOnBackgroundThread();
  MOZ_ASSERT(!mDestroyed);

  if (!mFileSystem) {
    return;
  }

  mFileSystem->Shutdown();
  mFileSystem = nullptr;
  mTask = nullptr;
  mDestroyed = true;
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:15,代码来源:FileSystemRequestParent.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AssertIsOnOwningThread函数代码示例发布时间:2022-05-30
下一篇:
C++ AssertISV函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap