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

C++ NS_NewRunnableFunction函数代码示例

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

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



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

示例1: MOZ_ASSERT

void
GMPCDMCallbackProxy::SessionClosed(const nsCString& aSessionId)
{
  MOZ_ASSERT(mProxy->IsOnOwnerThread());

  bool keyStatusesChange = false;
  auto sid = NS_ConvertUTF8toUTF16(aSessionId);
  {
    CDMCaps::AutoLock caps(mProxy->Capabilites());
    keyStatusesChange = caps.RemoveKeysForSession(NS_ConvertUTF8toUTF16(aSessionId));
  }
  if (keyStatusesChange) {
    RefPtr<CDMProxy> proxy = mProxy;
    NS_DispatchToMainThread(
      NS_NewRunnableFunction([proxy, sid] ()
      {
        proxy->OnKeyStatusesChange(sid);
      })
    );
  }

  RefPtr<CDMProxy> proxy = mProxy;
  NS_DispatchToMainThread(
    NS_NewRunnableFunction([proxy, sid] ()
    {
      proxy->OnSessionClosed(sid);
    })
  );
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:29,代码来源:GMPCDMCallbackProxy.cpp


示例2: lock

NotNull<AllocPolicy*> GlobalAllocPolicy::Instance(TrackType aTrack) {
  StaticMutexAutoLock lock(sMutex);
  if (aTrack == TrackType::kAudioTrack) {
    static RefPtr<AllocPolicyImpl> sAudioPolicy = []() {
      SystemGroup::Dispatch(
          TaskCategory::Other,
          NS_NewRunnableFunction(
              "GlobalAllocPolicy::GlobalAllocPolicy:Audio", []() {
                ClearOnShutdown(&sAudioPolicy, ShutdownPhase::ShutdownThreads);
              }));
      return new AllocPolicyImpl(MediaDecoderLimitDefault());
    }();
    return WrapNotNull(sAudioPolicy.get());
  }
  static RefPtr<AllocPolicyImpl> sVideoPolicy = []() {
    SystemGroup::Dispatch(
        TaskCategory::Other,
        NS_NewRunnableFunction(
            "GlobalAllocPolicy::GlobalAllocPolicy:Audio", []() {
              ClearOnShutdown(&sVideoPolicy, ShutdownPhase::ShutdownThreads);
            }));
    return new AllocPolicyImpl(MediaDecoderLimitDefault());
  }();
  return WrapNotNull(sVideoPolicy.get());
}
开发者ID:jld,项目名称:gecko-dev,代码行数:25,代码来源:AllocationPolicy.cpp


示例3: 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_TRUE(NS_SUCCEEDED(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_TRUE(NS_SUCCEEDED(
      actor->mWorkerThread->Dispatch(nested, NS_DISPATCH_NORMAL)));
  });

  MOZ_ASSERT(runnable);
  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));

  return actor;
}
开发者ID:Danielzac,项目名称:gecko-dev,代码行数:55,代码来源:NuwaParent.cpp


示例4: ref

void
BenchmarkPlayback::DrainComplete()
{
  RefPtr<Benchmark> ref(mMainThreadState);
  Dispatch(NS_NewRunnableFunction([this, ref]() {
    int32_t frames = mFrameCount - ref->mParameters.mStartupFrame;
    TimeDuration elapsedTime = TimeStamp::Now() - mDecodeStartTime;
    uint32_t decodeFps = frames / elapsedTime.ToSeconds();
    MainThreadShutdown();
    ref->Dispatch(NS_NewRunnableFunction([ref, decodeFps]() {
      ref->ReturnResult(decodeFps);
    }));
  }));
}
开发者ID:devtools-html,项目名称:gecko-dev,代码行数:14,代码来源:Benchmark.cpp


示例5: SendTelemetry

// A single telemetry sample is reported for each MediaDataDecoder object
// that has detected error or produced output successfully.
static void
SendTelemetry(unsigned long hr)
{
  // Collapse the error codes into a range of 0-0xff that can be viewed in
  // telemetry histograms.  For most MF_E_* errors, unique samples are used,
  // retaining the least significant 7 or 8 bits.  Other error codes are
  // bucketed.
  uint32_t sample;
  if (SUCCEEDED(hr)) {
    sample = 0;
  } else if (hr < 0xc00d36b0) {
    sample = 1; // low bucket
  } else if (hr < 0xc00d3700) {
    sample = hr & 0xffU; // MF_E_*
  } else if (hr <= 0xc00d3705) {
    sample = 0x80 + (hr & 0xfU); // more MF_E_*
  } else if (hr < 0xc00d6d60) {
    sample = 2; // mid bucket
  } else if (hr <= 0xc00d6d78) {
    sample = hr & 0xffU; // MF_E_TRANSFORM_*
  } else {
    sample = 3; // high bucket
  }

  nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction(
    [sample] {
      Telemetry::Accumulate(Telemetry::MEDIA_WMF_DECODE_ERROR, sample);
    });
  NS_DispatchToMainThread(runnable);
}
开发者ID:LaiPhil,项目名称:gecko-dev,代码行数:32,代码来源:WMFMediaDataDecoder.cpp


示例6: MOZ_ASSERT

/* static */ void
IDecodingTask::NotifyDecodeComplete(NotNull<RasterImage*> aImage,
                                    NotNull<Decoder*> aDecoder)
{
  MOZ_ASSERT(aDecoder->HasError() || !aDecoder->InFrame(),
             "Decode complete in the middle of a frame?");

  // Capture the decoder's state.
  DecoderFinalStatus finalStatus = aDecoder->FinalStatus();
  ImageMetadata metadata = aDecoder->GetImageMetadata();
  DecoderTelemetry telemetry = aDecoder->Telemetry();
  Progress progress = aDecoder->TakeProgress();
  IntRect invalidRect = aDecoder->TakeInvalidRect();
  Maybe<uint32_t> frameCount = aDecoder->TakeCompleteFrameCount();
  SurfaceFlags surfaceFlags = aDecoder->GetSurfaceFlags();

  // Synchronously notify if we can.
  if (NS_IsMainThread() &&
      !(aDecoder->GetDecoderFlags() & DecoderFlags::ASYNC_NOTIFY)) {
    aImage->NotifyDecodeComplete(finalStatus, metadata, telemetry, progress,
                                 invalidRect, frameCount, surfaceFlags);
    return;
  }

  // We're forced to notify asynchronously.
  NotNull<RefPtr<RasterImage>> image = aImage;
  NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
    image->NotifyDecodeComplete(finalStatus, metadata, telemetry, progress,
                                invalidRect, frameCount, surfaceFlags);
  }));
}
开发者ID:zbraniecki,项目名称:gecko-dev,代码行数:31,代码来源:IDecodingTask.cpp


示例7: EmptyString

/*static*/
void
SmsManager::NotifySmsReceived(int32_t aId,
                              jni::String::Param aSender,
                              jni::String::Param aBody,
                              int32_t aMessageClass,
                              int64_t aSentTimestamp,
                              int64_t aTimestamp)
{
    // TODO Need to correct the message `threadId` parameter value. Bug 859098
    SmsMessageData message;
    message.id() = aId;
    message.threadId() = 0;
    message.iccId() = EmptyString();
    message.delivery() = eDeliveryState_Received;
    message.deliveryStatus() = eDeliveryStatus_Success;
    message.sender() = aSender ? aSender->ToString() : EmptyString();
    message.receiver() = EmptyString();
    message.body() = aBody ? aBody->ToString() : EmptyString();
    message.messageClass() = static_cast<MessageClass>(aMessageClass);
    message.timestamp() = aTimestamp;
    message.sentTimestamp() = aSentTimestamp;
    message.deliveryTimestamp() = aTimestamp;
    message.read() = false;

    nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([=] () {
        nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
        if (!obs) {
            return;
        }

        nsCOMPtr<nsISmsMessage> domMessage = new SmsMessageInternal(message);
        obs->NotifyObservers(domMessage, kSmsReceivedObserverTopic, nullptr);
    });
    NS_DispatchToMainThread(runnable);
}
开发者ID:MekliCZ,项目名称:positron,代码行数:36,代码来源:SmsManager.cpp


示例8: do_QueryInterface

already_AddRefed<Promise>
PresentationReceiver::GetConnectionList(ErrorResult& aRv)
{
  nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mOwner);
  if (NS_WARN_IF(!global)) {
    aRv.Throw(NS_ERROR_UNEXPECTED);
    return nullptr;
  }

  if (!mGetConnectionListPromise) {
    mGetConnectionListPromise = Promise::Create(global, aRv);
    if (NS_WARN_IF(aRv.Failed())) {
      return nullptr;
    }

    RefPtr<PresentationReceiver> self = this;
    nsresult rv =
      NS_DispatchToMainThread(NS_NewRunnableFunction([self] () -> void {
        self->CreateConnectionList();
      }));
    if (NS_FAILED(rv)) {
      aRv.Throw(rv);
      return nullptr;
    }
  }

  RefPtr<Promise> promise = mGetConnectionListPromise;
  return promise.forget();
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:29,代码来源:PresentationReceiver.cpp


示例9: mon

void
PDMFactory::EnsureInit() const
{
  {
    StaticMutexAutoLock mon(sMonitor);
    if (sInstance) {
      // Quick exit if we already have an instance.
      return;
    }
    if (NS_IsMainThread()) {
      // On the main thread and holding the lock -> Create instance.
      sInstance = new PDMFactoryImpl();
      ClearOnShutdown(&sInstance);
      return;
    }
  }

  // Not on the main thread -> Sync-dispatch creation to main thread.
  nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
  nsCOMPtr<nsIRunnable> runnable =
    NS_NewRunnableFunction([]() {
      StaticMutexAutoLock mon(sMonitor);
      if (!sInstance) {
        sInstance = new PDMFactoryImpl();
        ClearOnShutdown(&sInstance);
      }
    });
  SyncRunnable::DispatchToThread(mainThread, runnable);
}
开发者ID:nwgh,项目名称:gecko-dev,代码行数:29,代码来源:PDMFactory.cpp


示例10: caps

void
GMPCDMCallbackProxy::BatchedKeyStatusChangedInternal(const nsCString& aSessionId,
                                                     const nsTArray<CDMKeyInfo>& aKeyInfos)
{
  bool keyStatusesChange = false;
  {
    CDMCaps::AutoLock caps(mProxy->Capabilites());
    for (size_t i = 0; i < aKeyInfos.Length(); i++) {
      keyStatusesChange |=
        caps.SetKeyStatus(aKeyInfos[i].mKeyId,
                          NS_ConvertUTF8toUTF16(aSessionId),
                          aKeyInfos[i].mStatus);
    }
  }
  if (keyStatusesChange) {
    RefPtr<CDMProxy> proxy = mProxy;
    auto sid = NS_ConvertUTF8toUTF16(aSessionId);
    NS_DispatchToMainThread(
      NS_NewRunnableFunction([proxy, sid] ()
      {
        proxy->OnKeyStatusesChange(sid);
      })
    );
  }
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:25,代码来源:GMPCDMCallbackProxy.cpp


示例11: NotifyProgress

static void
NotifyProgress(NotNull<Decoder*> aDecoder)
{
  MOZ_ASSERT(aDecoder->HasProgress() && !aDecoder->IsMetadataDecode());

  Progress progress = aDecoder->TakeProgress();
  IntRect invalidRect = aDecoder->TakeInvalidRect();
  Maybe<uint32_t> frameCount = aDecoder->TakeCompleteFrameCount();
  SurfaceFlags surfaceFlags = aDecoder->GetSurfaceFlags();

  // Synchronously notify if we can.
  if (NS_IsMainThread() &&
      !(aDecoder->GetDecoderFlags() & DecoderFlags::ASYNC_NOTIFY)) {
    aDecoder->GetImage()->NotifyProgress(progress, invalidRect,
                                         frameCount, surfaceFlags);
    return;
  }

  // We're forced to notify asynchronously.
  NotNull<RefPtr<Decoder>> decoder = aDecoder;
  NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
    decoder->GetImage()->NotifyProgress(progress, invalidRect,
                                        frameCount, surfaceFlags);
  }));
}
开发者ID:cliqz-oss,项目名称:browser-f,代码行数:25,代码来源:IDecodingTask.cpp


示例12: PLAY_REQUEST_LOG

RefPtr<GenericPromise>
AutoplayRequest::RequestWithPrompt()
{
  // If we've already requested permission, we'll just return the promise,
  // as we don't want to show multiple permission requests at once.
  // The promise is non-exclusive, so if the request has already completed,
  // the ThenValue will run immediately.
  if (mRequestDispatched) {
    PLAY_REQUEST_LOG(
      "AutoplayRequest %p RequestWithPrompt() request already dispatched",
      this);
    return mPromiseHolder.Ensure(__func__);
  }

  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mWindow);
  if (!window) {
    return GenericPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR,
                                           __func__);
  }
  nsCOMPtr<nsIContentPermissionRequest> request = do_QueryInterface(this);
  MOZ_RELEASE_ASSERT(request);
  nsCOMPtr<nsIRunnable> f = NS_NewRunnableFunction(
    "AutoplayRequest::RequestWithPrompt", [window, request]() {
      dom::nsContentPermissionUtils::AskPermission(request, window);
    });
  mMainThreadTarget->Dispatch(f, NS_DISPATCH_NORMAL);

  mRequestDispatched = true;
  return mPromiseHolder.Ensure(__func__);
}
开发者ID:fitzgen,项目名称:gecko-dev,代码行数:30,代码来源:AutoplayRequest.cpp


示例13: AddDataEntry

void
URL::CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
                     const objectURLOptions& aOptions,
                     nsAString& aResult,
                     ErrorResult& aError)
{
  nsCOMPtr<nsIPrincipal> principal = nsContentUtils::ObjectPrincipal(aGlobal.Get());

  nsCString url;
  nsresult rv = nsHostObjectProtocolHandler::
    AddDataEntry(NS_LITERAL_CSTRING(MEDIASOURCEURI_SCHEME),
                 &aSource, principal, url);
  if (NS_FAILED(rv)) {
    aError.Throw(rv);
    return;
  }

  nsCOMPtr<nsIRunnable> revocation = NS_NewRunnableFunction(
    [url] {
      nsHostObjectProtocolHandler::RemoveDataEntry(url);
    });

  nsContentUtils::RunInStableState(revocation.forget());

  CopyASCIItoUTF16(url, aResult);
}
开发者ID:ShakoHo,项目名称:gecko-dev,代码行数:26,代码来源:URL.cpp


示例14: MOZ_ASSERT

void BenchmarkPlayback::DemuxNextSample() {
  MOZ_ASSERT(OnThread());

  RefPtr<Benchmark> ref(mGlobalState);
  RefPtr<MediaTrackDemuxer::SamplesPromise> promise =
      mTrackDemuxer->GetSamples();
  promise->Then(
      Thread(), __func__,
      [this, ref](RefPtr<MediaTrackDemuxer::SamplesHolder> aHolder) {
        mSamples.AppendElements(std::move(aHolder->mSamples));
        if (ref->mParameters.mStopAtFrame &&
            mSamples.Length() == ref->mParameters.mStopAtFrame.ref()) {
          InitDecoder(std::move(*mTrackDemuxer->GetInfo()));
        } else {
          Dispatch(
              NS_NewRunnableFunction("BenchmarkPlayback::DemuxNextSample",
                                     [this, ref]() { DemuxNextSample(); }));
        }
      },
      [this, ref](const MediaResult& aError) {
        switch (aError.Code()) {
          case NS_ERROR_DOM_MEDIA_END_OF_STREAM:
            InitDecoder(std::move(*mTrackDemuxer->GetInfo()));
            break;
          default:
            Error(aError);
            break;
        }
      });
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:30,代码来源:Benchmark.cpp


示例15: ReportFailureOnMainThread

void
MediaDecodeTask::OnMetadataRead(MetadataHolder* aMetadata)
{
  mMediaInfo = aMetadata->mInfo;
  if (!mMediaInfo.HasAudio()) {
    mDecoderReader->Shutdown();
    ReportFailureOnMainThread(WebAudioDecodeJob::NoAudio);
    return;
  }

  nsCString codec;
  if (!mMediaInfo.mAudio.GetAsAudioInfo()->mMimeType.IsEmpty()) {
    codec = nsPrintfCString("webaudio; %s", mMediaInfo.mAudio.GetAsAudioInfo()->mMimeType.get());
  } else {
    codec = nsPrintfCString("webaudio;resource; %s", mContentType.get());
  }

  nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([codec]() -> void {
    MOZ_ASSERT(!codec.IsEmpty());
    MOZ_LOG(gMediaDecoderLog,
            LogLevel::Debug,
            ("Telemetry (WebAudio) MEDIA_CODEC_USED= '%s'", codec.get()));
    Telemetry::Accumulate(Telemetry::ID::MEDIA_CODEC_USED, codec);
  });
  AbstractThread::MainThread()->Dispatch(task.forget());

  RequestSample();
}
开发者ID:devtools-html,项目名称:gecko-dev,代码行数:28,代码来源:MediaBufferDecoder.cpp


示例16: MOZ_ASSERT

/* static */ void
URLMainThread::CreateObjectURL(const GlobalObject& aGlobal,
                               MediaSource& aSource,
                               const objectURLOptions& aOptions,
                               nsAString& aResult, ErrorResult& aRv)
{
  MOZ_ASSERT(NS_IsMainThread());

  nsCOMPtr<nsIPrincipal> principal =
    nsContentUtils::ObjectPrincipal(aGlobal.Get());

  nsAutoCString url;
  aRv = nsHostObjectProtocolHandler::AddDataEntry(&aSource, principal, url);
  if (NS_WARN_IF(aRv.Failed())) {
    return;
  }

  nsCOMPtr<nsIRunnable> revocation = NS_NewRunnableFunction(
    [url] {
      nsHostObjectProtocolHandler::RemoveDataEntry(url);
    });

  nsContentUtils::RunInStableState(revocation.forget());

  CopyASCIItoUTF16(url, aResult);
}
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:26,代码来源:URL.cpp


示例17: mon

void
DecodedAudioDataSink::Shutdown()
{
  {
    ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
    if (mAudioStream) {
      mAudioStream->Cancel();
    }
  }
  nsRefPtr<DecodedAudioDataSink> self = this;
  nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
    self->mStopAudioThread = true;
    if (!self->mAudioLoopScheduled) {
      self->AudioLoop();
    }
  });
  DispatchTask(r.forget());

  mThread->Shutdown();
  mThread = nullptr;
  if (mAudioStream) {
    mAudioStream->Shutdown();
    mAudioStream = nullptr;
  }

  // Should've reached the final state after shutdown.
  MOZ_ASSERT(mState == AUDIOSINK_STATE_SHUTDOWN ||
             mState == AUDIOSINK_STATE_ERROR);
  // Should have no pending state change.
  MOZ_ASSERT(mPendingState.isNothing());
}
开发者ID:norihirou,项目名称:gecko-dev,代码行数:31,代码来源:DecodedAudioDataSink.cpp


示例18: DisplayInfo

status_t
FakeSurfaceComposer::getDisplayConfigs(const sp<IBinder>& display, Vector<DisplayInfo>* configs)
{
    if (configs == NULL) {
        return BAD_VALUE;
    }

    // Limit DisplayConfigs only to primary display
    if (!display.get() || display != mPrimaryDisplay) {
        return NAME_NOT_FOUND;
    }

    configs->clear();
    DisplayInfo info = DisplayInfo();

    nsCOMPtr<nsIRunnable> runnable =
        NS_NewRunnableFunction([&]() {
            MOZ_ASSERT(NS_IsMainThread());
            getPrimaryDisplayInfo(&info);
        });
    NS_DispatchToMainThread(runnable, NS_DISPATCH_SYNC);

    configs->push_back(info);
    return NO_ERROR;
}
开发者ID:rlr,项目名称:gecko-dev,代码行数:25,代码来源:FakeSurfaceComposer.cpp


示例19: MOZ_ASSERT

void
PaintThread::PaintContents(CapturedPaintState* aState,
                           PrepDrawTargetForPaintingCallback aCallback)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(aState);

  // If painting asynchronously, we need to acquire the compositor bridge which
  // owns the underlying MessageChannel. Otherwise we leave it null and use
  // synchronous dispatch.
  RefPtr<CompositorBridgeChild> cbc;
  if (!gfxPrefs::LayersOMTPForceSync()) {
    cbc = CompositorBridgeChild::Get();
    cbc->NotifyBeginAsyncPaint(aState);
  }
  RefPtr<CapturedPaintState> state(aState);
  RefPtr<DrawTargetCapture> capture(aState->mCapture);

  RefPtr<PaintThread> self = this;
  RefPtr<Runnable> task = NS_NewRunnableFunction("PaintThread::PaintContents",
    [self, cbc, capture, state, aCallback]() -> void
  {
    self->PaintContentsAsync(cbc,
                             state,
                             aCallback);
  });

  if (cbc) {
    sThread->Dispatch(task.forget());
  } else {
    SyncRunnable::DispatchToThread(sThread, task);
  }
}
开发者ID:yrliou,项目名称:gecko-dev,代码行数:33,代码来源:PaintThread.cpp


示例20: PRES_DEBUG

NS_IMETHODIMP
PresentationService::UntrackSessionInfo(const nsAString& aSessionId,
                                        uint8_t aRole)
{
  PRES_DEBUG("%s:id[%s], role[%d]\n", __func__,
             NS_ConvertUTF16toUTF8(aSessionId).get(), aRole);

  MOZ_ASSERT(aRole == nsIPresentationService::ROLE_CONTROLLER ||
             aRole == nsIPresentationService::ROLE_RECEIVER);
  // Remove the session info.
  if (nsIPresentationService::ROLE_CONTROLLER == aRole) {
    mSessionInfoAtController.Remove(aSessionId);
  } else {
    // Terminate receiver page.
    uint64_t windowId;
    nsresult rv = GetWindowIdBySessionIdInternal(aSessionId, aRole, &windowId);
    if (NS_SUCCEEDED(rv)) {
      NS_DispatchToMainThread(NS_NewRunnableFunction([windowId]() -> void {
        PRES_DEBUG("Attempt to close window[%d]\n", windowId);

        if (auto* window = nsGlobalWindow::GetInnerWindowWithId(windowId)) {
          window->Close();
        }
      }));
    }

    mSessionInfoAtReceiver.Remove(aSessionId);
  }

  // Remove the in-process responding info if there's still any.
  RemoveRespondingSessionId(aSessionId, aRole);

  return NS_OK;
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:34,代码来源:PresentationService.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ NS_NewRunnableMethod函数代码示例发布时间:2022-05-30
下一篇:
C++ NS_NewNativeLocalFile函数代码示例发布时间: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