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


C++ StaticRefPtr::Dispatch方法代码示例

本文整理汇总了C++中StaticRefPtr::Dispatch方法的典型用法代码示例。如果您正苦于以下问题:C++ StaticRefPtr::Dispatch方法的具体用法?C++ StaticRefPtr::Dispatch怎么用?C++ StaticRefPtr::Dispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StaticRefPtr的用法示例。


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

示例1: dbusThread

bool
StartDBus()
{
  MOZ_ASSERT(!NS_IsMainThread());
  NS_ENSURE_TRUE(!gDBusThread, true);

  nsRefPtr<DBusThread> dbusThread(new DBusThread());

  bool eventLoopStarted = dbusThread->Initialize();
  NS_ENSURE_TRUE(eventLoopStarted, false);

  nsresult rv;

  if (!gDBusServiceThread) {
    nsIThread* dbusServiceThread;
    rv = NS_NewNamedThread("DBus Thread", &dbusServiceThread);
    NS_ENSURE_SUCCESS(rv, false);
    gDBusServiceThread = dbusServiceThread;
  }

#ifdef DEBUG
  LOG("DBus Thread Starting\n");
#endif

  nsRefPtr<nsIRunnable> pollTask(new DBusPollTask(dbusThread));
  NS_ENSURE_TRUE(pollTask, false);

  rv = gDBusServiceThread->Dispatch(pollTask, NS_DISPATCH_NORMAL);
  NS_ENSURE_SUCCESS(rv, false);

  gDBusThread = dbusThread;

  return true;
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:34,代码来源:DBusThread.cpp

示例2: InitForContent

/* static */
void VideoDecoderManagerChild::InitForContent(
    Endpoint<PVideoDecoderManagerChild>&& aVideoManager) {
  InitializeThread();
  sVideoDecoderChildThread->Dispatch(
      NewRunnableFunction("InitForContentRunnable", &Open,
                          std::move(aVideoManager)),
      NS_DISPATCH_NORMAL);
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:9,代码来源:VideoDecoderManagerChild.cpp

示例3: Move

void
VideoDecoderManagerChild::DeallocateSurfaceDescriptorGPUVideo(const SurfaceDescriptorGPUVideo& aSD)
{
  RefPtr<VideoDecoderManagerChild> ref = this;
  SurfaceDescriptorGPUVideo sd = Move(aSD);
  sVideoDecoderChildThread->Dispatch(NS_NewRunnableFunction([ref, sd]() {
    if (ref->CanSend()) {
      ref->SendDeallocateSurfaceDescriptorGPUVideo(sd);
    }
  }), NS_DISPATCH_NORMAL);
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:11,代码来源:VideoDecoderManagerChild.cpp

示例4:

nsresult
DispatchToDBusThread(nsIRunnable* event)
{
  MOZ_ASSERT(gDBusServiceThread);
  MOZ_ASSERT(gDBusThread);

  nsresult rv = gDBusServiceThread->Dispatch(event, NS_DISPATCH_NORMAL);
  NS_ENSURE_SUCCESS(rv, rv);

  gDBusThread->WakeUp();

  return NS_OK;
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:13,代码来源:DBusThread.cpp

示例5: DeallocShmem

bool
VideoDecoderManagerChild::DeallocShmem(mozilla::ipc::Shmem& aShmem)
{
  if (NS_GetCurrentThread() != sVideoDecoderChildThread) {
    RefPtr<VideoDecoderManagerChild> self = this;
    mozilla::ipc::Shmem shmem = aShmem;
    sVideoDecoderChildThread->Dispatch(NS_NewRunnableFunction([self, shmem]() {
      if (self->CanSend()) {
        mozilla::ipc::Shmem shmemCopy = shmem;
        self->DeallocShmem(shmemCopy);
      }
    }), NS_DISPATCH_NORMAL);
    return true;
  }
  return PVideoDecoderManagerChild::DeallocShmem(aShmem);
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:16,代码来源:VideoDecoderManagerChild.cpp

示例6:

/* static */ void
VideoDecoderManagerChild::Shutdown()
{
  MOZ_ASSERT(NS_IsMainThread());

  if (sVideoDecoderChildThread) {
    sVideoDecoderChildThread->Dispatch(NS_NewRunnableFunction([]() {
      if (sDecoderManager && sDecoderManager->CanSend()) {
        sDecoderManager->Close();
        sDecoderManager = nullptr;
      }
    }), NS_DISPATCH_NORMAL);

    sVideoDecoderChildAbstractThread = nullptr;
    sVideoDecoderChildThread->Shutdown();
    sVideoDecoderChildThread = nullptr;

    sRecreateTasks = nullptr;
  }
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:20,代码来源:VideoDecoderManagerChild.cpp

示例7: task

already_AddRefed<SourceSurface> VideoDecoderManagerChild::Readback(
    const SurfaceDescriptorGPUVideo& aSD) {
  // We can't use NS_DISPATCH_SYNC here since that can spin the event
  // loop while it waits. This function can be called from JS and we
  // don't want that to happen.
  SynchronousTask task("Readback sync");

  RefPtr<VideoDecoderManagerChild> ref = this;
  SurfaceDescriptor sd;
  if (NS_FAILED(sVideoDecoderChildThread->Dispatch(
          NS_NewRunnableFunction("VideoDecoderManagerChild::Readback",
                                 [&]() {
                                   AutoCompleteTask complete(&task);
                                   if (ref->CanSend()) {
                                     ref->SendReadback(aSD, &sd);
                                   }
                                 }),
          NS_DISPATCH_NORMAL))) {
    return nullptr;
  }

  task.Wait();

  if (!IsSurfaceDescriptorValid(sd)) {
    return nullptr;
  }

  RefPtr<DataSourceSurface> source = GetSurfaceForDescriptor(sd);
  if (!source) {
    DestroySurfaceDescriptor(this, &sd);
    NS_WARNING("Failed to map SurfaceDescriptor in Readback");
    return nullptr;
  }

  static UserDataKey sSurfaceDescriptor;
  source->AddUserData(&sSurfaceDescriptor,
                      new SurfaceDescriptorUserData(this, sd),
                      DeleteSurfaceDescriptorUserData);

  return source.forget();
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:41,代码来源:VideoDecoderManagerChild.cpp


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