當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。