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


C++ NS_DispatchToCurrentThread函数代码示例

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


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

示例1: nsPositionChangedEvent

nsresult
nsListBoxBodyFrame::InternalPositionChanged(bool aUp, PRInt32 aDelta)
{
  nsRefPtr<nsPositionChangedEvent> ev =
    new nsPositionChangedEvent(this, aUp, aDelta);
  nsresult rv = NS_DispatchToCurrentThread(ev);
  if (NS_SUCCEEDED(rv)) {
    if (!mPendingPositionChangeEvents.AppendElement(ev)) {
      rv = NS_ERROR_OUT_OF_MEMORY;
      ev->Revoke();
    }
  }
  return rv;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:14,代码来源:nsListBoxBodyFrame.cpp

示例2: NS_NewRunnableMethod

void
AndroidSurfaceTexture::NotifyFrameAvailable()
{
  if (mFrameAvailableCallback) {
    // Proxy to main thread if we aren't on it
    if (!NS_IsMainThread()) {
      // Proxy to main thread
      nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &AndroidSurfaceTexture::NotifyFrameAvailable);
      NS_DispatchToCurrentThread(event);
    } else {
      mFrameAvailableCallback->Run();
    }
  }
}
开发者ID:MekliCZ,项目名称:positron,代码行数:14,代码来源:AndroidSurfaceTexture.cpp

示例3: MOZ_ASSERT

void
GMPParent::DecryptorDestroyed(GMPDecryptorParent* aSession)
{
  MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());

  MOZ_ALWAYS_TRUE(mDecryptors.RemoveElement(aSession));

  // Recv__delete__ is on the stack, don't potentially destroy the top-level actor
  // until after this has completed.
  if (mDecryptors.IsEmpty()) {
    nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &GMPParent::CloseIfUnused);
    NS_DispatchToCurrentThread(event);
  }
}
开发者ID:chenhequn,项目名称:gecko,代码行数:14,代码来源:GMPParent.cpp

示例4: DOMRequest

ArchiveRequest::ArchiveRequest(nsIDOMWindow* aWindow,
                               ArchiveReader* aReader)
: DOMRequest(aWindow),
  mArchiveReader(aReader)
{
  MOZ_ASSERT(aReader);

  MOZ_COUNT_CTOR(ArchiveRequest);
  nsLayoutStatics::AddRef();

  /* An event to make this request asynchronous: */
  nsRefPtr<ArchiveRequestEvent> event = new ArchiveRequestEvent(this);
  NS_DispatchToCurrentThread(event);
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:14,代码来源:ArchiveRequest.cpp

示例5:

ErrorReporter::~ErrorReporter()
{
  // Schedule deferred cleanup for cached data. We want to strike a
  // balance between performance and memory usage, so we only allow
  // short-term caching.
  if (sSpecCache && sSpecCache->IsInUse() && !sSpecCache->IsPending()) {
    if (NS_FAILED(NS_DispatchToCurrentThread(sSpecCache))) {
      // Peform the "deferred" cleanup immediately if the dispatch fails.
      sSpecCache->Run();
    } else {
      sSpecCache->SetPending();
    }
  }
}
开发者ID:multi-sim,项目名称:releases-mozilla-central,代码行数:14,代码来源:ErrorReporter.cpp

示例6: NS_NewRunnableMethod

nsresult
FTPChannelChild::AsyncCall(void (FTPChannelChild::*funcPtr)(),
                           nsRunnableMethod<FTPChannelChild> **retval)
{
  nsresult rv;

  nsRefPtr<nsRunnableMethod<FTPChannelChild> > event = NS_NewRunnableMethod(this, funcPtr);
  rv = NS_DispatchToCurrentThread(event);
  if (NS_SUCCEEDED(rv) && retval) {
    *retval = event;
  }

  return rv;
}
开发者ID:TheTypoMaster,项目名称:fennec-777045,代码行数:14,代码来源:FTPChannelChild.cpp

示例7: NS_NewRunnableFunction

void
HttpServer::TransportProvider::MaybeNotify()
{
  if (mTransport && mListener) {
    RefPtr<TransportProvider> self = this;
    nsCOMPtr<nsIRunnable> event = NS_NewRunnableFunction(
      "dom::HttpServer::TransportProvider::MaybeNotify", [self, this]() {
        DebugOnly<nsresult> rv =
          mListener->OnTransportAvailable(mTransport, mInput, mOutput);
        MOZ_ASSERT(NS_SUCCEEDED(rv));
      });
    NS_DispatchToCurrentThread(event);
  }
}
开发者ID:bgrins,项目名称:gecko-dev,代码行数:14,代码来源:HttpServer.cpp

示例8: NS_LITERAL_STRING

nsresult
TVSource::DispatchEITBroadcastedEvent(const Sequence<OwningNonNull<TVProgram>>& aPrograms)
{
  TVEITBroadcastedEventInit init;
  init.mPrograms = aPrograms;
  nsCOMPtr<nsIDOMEvent> event =
    TVEITBroadcastedEvent::Constructor(this,
                                       NS_LITERAL_STRING("eitbroadcasted"),
                                       init);
  nsCOMPtr<nsIRunnable> runnable =
    NewRunnableMethod<nsCOMPtr<nsIDOMEvent>>(this,
                                             &TVSource::DispatchTVEvent,
                                             event);
  return NS_DispatchToCurrentThread(runnable);
}
开发者ID:SJasoria,项目名称:gecko-dev,代码行数:15,代码来源:TVSource.cpp

示例9: NS_LITERAL_STRING

nsresult
TVTuner::DispatchCurrentSourceChangedEvent(TVSource* aSource)
{
  TVCurrentSourceChangedEventInit init;
  init.mSource = aSource;
  nsCOMPtr<nsIDOMEvent> event =
    TVCurrentSourceChangedEvent::Constructor(this,
                                             NS_LITERAL_STRING("currentsourcechanged"),
                                             init);
  nsCOMPtr<nsIRunnable> runnable =
    NewRunnableMethod<nsCOMPtr<nsIDOMEvent>>(this,
                                             &TVTuner::DispatchTVEvent,
                                             event);
  return NS_DispatchToCurrentThread(runnable);
}
开发者ID:philbooth,项目名称:gecko-dev,代码行数:15,代码来源:TVTuner.cpp

示例10: NS_DispatchToCurrentThread

void
nsNativeAppSupportUnix::InteractCB(SmcConn smc_conn, SmPointer client_data)
{
  nsNativeAppSupportUnix *self =
    static_cast<nsNativeAppSupportUnix *>(client_data);

  self->SetClientState(STATE_INTERACTING);

  // We do this asynchronously, as we spin the event loop recursively if
  // a dialog is displayed. If we do this synchronously, we don't finish
  // processing the current ICE event whilst the dialog is displayed, which
  // means we won't process any more. libsm hates us if we do the InteractDone
  // with a pending ShutdownCancelled, and we would certainly like to handle Die
  // whilst a dialog is displayed
  NS_DispatchToCurrentThread(NewRunnableMethod(self, &nsNativeAppSupportUnix::DoInteract));
}
开发者ID:brendandahl,项目名称:positron,代码行数:16,代码来源:nsNativeAppSupportUnix.cpp

示例11: BCPostMessageRunnable

void
BroadcastChannel::PostMessageData(BroadcastChannelMessage* aData)
{
  if (mActor) {
    nsRefPtr<BCPostMessageRunnable> runnable =
      new BCPostMessageRunnable(mActor, aData);

    if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) {
      NS_WARNING("Failed to dispatch to the current thread!");
    }

    return;
  }

  mPendingMessages.AppendElement(aData);
}
开发者ID:RobertJGabriel,项目名称:Waterfox,代码行数:16,代码来源:BroadcastChannel.cpp

示例12: MOZ_ASSERT

void
WebBrowserPersistSerializeParent::ActorDestroy(ActorDestroyReason aWhy)
{
    if (mFinish) {
        MOZ_ASSERT(aWhy != Deletion);
        // See comment in WebBrowserPersistDocumentParent::ActorDestroy
        // (or bug 1202887) for why this is deferred.
        nsCOMPtr<nsIRunnable> errorLater = NS_NewRunnableMethodWithArgs
            <nsCOMPtr<nsIWebBrowserPersistDocument>, nsCOMPtr<nsIOutputStream>,
             nsCString, nsresult>
            (mFinish, &nsIWebBrowserPersistWriteCompletion::OnFinish,
             mDocument, mStream, EmptyCString(), NS_ERROR_FAILURE);
        NS_DispatchToCurrentThread(errorLater);
        mFinish = nullptr;
    }
}
开发者ID:70599,项目名称:Waterfox,代码行数:16,代码来源:WebBrowserPersistSerializeParent.cpp

示例13: do_GetService

void nsFormFillController::RevalidateDataList()
{
  nsresult rv;
  nsCOMPtr <nsIInputListAutoComplete> inputListAutoComplete =
    do_GetService("@mozilla.org/satchel/inputlist-autocomplete;1", &rv);

  nsCOMPtr<nsIAutoCompleteResult> result;

  rv = inputListAutoComplete->AutoCompleteSearch(mLastSearchResult,
                                                 mLastSearchString,
                                                 mFocusedInput,
                                                 getter_AddRefs(result));

  nsCOMPtr<nsIRunnable> event =
    new UpdateSearchResultRunnable(mLastListener, this, result);
  NS_DispatchToCurrentThread(event);
}
开发者ID:moussa1,项目名称:mozilla-central,代码行数:17,代码来源:nsFormFillController.cpp

示例14: MOZ_ASSERT

void
ProgressTracker::NotifyCurrentState(imgRequestProxy* proxy)
{
  MOZ_ASSERT(NS_IsMainThread(), "imgRequestProxy is not threadsafe");
#ifdef PR_LOGGING
  nsRefPtr<ImageURL> uri;
  proxy->GetURI(getter_AddRefs(uri));
  nsAutoCString spec;
  uri->GetSpec(spec);
  LOG_FUNC_WITH_PARAM(GetImgLog(), "ProgressTracker::NotifyCurrentState", "uri", spec.get());
#endif

  proxy->SetNotificationsDeferred(true);

  nsCOMPtr<nsIRunnable> ev = new AsyncNotifyCurrentStateRunnable(this, proxy);
  NS_DispatchToCurrentThread(ev);
}
开发者ID:marshall,项目名称:gecko-dev,代码行数:17,代码来源:ProgressTracker.cpp

示例15: mIPCOpen

DOMStorageDBParent::DOMStorageDBParent()
: mIPCOpen(false)
{
  DOMStorageObserver* observer = DOMStorageObserver::Self();
  if (observer) {
    observer->AddSink(this);
  }

  // We are always open by IPC only
  AddIPDLReference();

  // Cannot send directly from here since the channel
  // is not completely built at this moment.
  nsRefPtr<SendInitialChildDataRunnable> r =
    new SendInitialChildDataRunnable(this);
  NS_DispatchToCurrentThread(r);
}
开发者ID:Balakrishnan-Vivek,项目名称:gecko-dev,代码行数:17,代码来源:DOMStorageIPC.cpp


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