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


C++ ASSERT_ON_THREAD函数代码示例

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


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

示例1: MOZ_ASSERT

int TestNrSocket::sendto(const void *msg, size_t len,
                         int flags, nr_transport_addr *to) {
  MOZ_ASSERT(my_addr_.protocol != IPPROTO_TCP);
  ASSERT_ON_THREAD(ststhread_);

  if (!nat_->enabled_ || nat_->is_an_internal_tuple(*to)) {
    return NrSocket::sendto(msg, len, flags, to);
  }

  destroy_stale_port_mappings();

  if (to->protocol == IPPROTO_UDP && nat_->block_udp_) {
    // Silently eat the packet
    return 0;
  }

  // Choose our port mapping based on our most selective criteria
  PortMapping *port_mapping = get_port_mapping(*to,
                                               std::max(nat_->filtering_type_,
                                                        nat_->mapping_type_));

  if (!port_mapping) {
    // See if we have already made the external socket we need to use.
    PortMapping *similar_port_mapping =
      get_port_mapping(*to, nat_->mapping_type_);
    nsRefPtr<NrSocket> external_socket;

    if (similar_port_mapping) {
      external_socket = similar_port_mapping->external_socket_;
    } else {
      external_socket = create_external_socket(*to);
      if (!external_socket) {
        MOZ_ASSERT(false);
        return R_INTERNAL;
      }
    }

    port_mapping = create_port_mapping(*to, external_socket);
    port_mappings_.push_back(port_mapping);

    if (poll_flags() & PR_POLL_READ) {
      // Make sure the new port mapping is ready to receive traffic if the
      // TestNrSocket is already waiting.
      port_mapping->async_wait(NR_ASYNC_WAIT_READ,
                              port_mapping_readable_callback,
                              this,
                              (char*)__FUNCTION__,
                              __LINE__);
    }
  }

  // We probably don't want to propagate the flags, since this is a simulated
  // external IP address.
  return port_mapping->sendto(msg, len, *to);
}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:55,代码来源:test_nr_socket.cpp

示例2: ASSERT_ON_THREAD

LocalSourceStreamInfo*
PeerConnectionMedia::GetLocalStreamByIndex(int aIndex)
{
  ASSERT_ON_THREAD(mMainThread);
  if(aIndex < 0 || aIndex >= (int) mLocalSourceStreams.Length()) {
    return nullptr;
  }

  MOZ_ASSERT(mLocalSourceStreams[aIndex]);
  return mLocalSourceStreams[aIndex];
}
开发者ID:carriercomm,项目名称:gecko-dev,代码行数:11,代码来源:PeerConnectionMedia.cpp

示例3: ASSERT_ON_THREAD

void
PeerConnectionMedia::UpdateSinkIdentity_m(const MediaStreamTrack* aTrack,
                                          nsIPrincipal* aPrincipal,
                                          const PeerIdentity* aSinkIdentity)
{
  ASSERT_ON_THREAD(mMainThread);

  for (RefPtr<TransceiverImpl>& transceiver : mTransceivers) {
    transceiver->UpdateSinkIdentity(aTrack, aPrincipal, aSinkIdentity);
  }
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:11,代码来源:PeerConnectionMedia.cpp

示例4: ASSERT_ON_THREAD

void RemoteSourceStreamInfo::DetachTransport_s()
{
  ASSERT_ON_THREAD(mParent->GetSTSThread());
  // walk through all the MediaPipelines and call the shutdown
  // transport functions. Must be on the STS thread.
  for (std::map<int, mozilla::RefPtr<mozilla::MediaPipeline> >::iterator it =
           mPipelines.begin(); it != mPipelines.end();
       ++it) {
    it->second->ShutdownTransport_s();
  }
}
开发者ID:mxOBS,项目名称:deb-pkg_icedove,代码行数:11,代码来源:PeerConnectionMedia.cpp

示例5: ASSERT_ON_THREAD

// callback while UDP packet is sent
NS_IMETHODIMP NrSocketIpc::CallListenerSent(const nsACString &type,
                                            nsresult result) {
  ASSERT_ON_THREAD(main_thread_);
  MOZ_ASSERT(type.EqualsLiteral("onsent"));

  if (NS_FAILED(result)) {
    ReentrantMonitorAutoEnter mon(monitor_);
    err_ = true;
  }
  return NS_OK;
}
开发者ID:captainbrosset,项目名称:gecko-dev,代码行数:12,代码来源:nr_socket_prsock.cpp

示例6: ASSERT_ON_THREAD

int NrSocketIpc::getaddr(nr_transport_addr *addrp) {
  ASSERT_ON_THREAD(sts_thread_);

  ReentrantMonitorAutoEnter mon(monitor_);

  if (state_ != NR_CONNECTED) {
    return R_INTERNAL;
  }

  return nr_transport_addr_copy(addrp, &my_addr_);
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:11,代码来源:nr_socket_prsock.cpp

示例7: CSFLogDebug

void
PeerConnectionMedia::SelfDestruct_m()
{
  CSFLogDebug(LOGTAG, "%s: ", __FUNCTION__);

  ASSERT_ON_THREAD(mMainThread);

  mMainThread = nullptr;

  // Final self-destruct.
  this->Release();
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:12,代码来源:PeerConnectionMedia.cpp

示例8: int

int NrIceResolver::resolve(nr_resolver_resource *resource,
                           int (*cb)(void *cb_arg, nr_transport_addr *addr),
                           void *cb_arg,
                           void **handle) {
  int _status;
  MOZ_ASSERT(allocated_resolvers_ > 0);
  ASSERT_ON_THREAD(sts_thread_);
  RefPtr<PendingResolution> pr;
  uint32_t resolve_flags = 0;
  OriginAttributes attrs;

  if (resource->transport_protocol != IPPROTO_UDP &&
      resource->transport_protocol != IPPROTO_TCP) {
    MOZ_MTLOG(ML_ERROR, "Only UDP and TCP are supported.");
    ABORT(R_NOT_FOUND);
  }
  pr = new PendingResolution(sts_thread_,
                             resource->port? resource->port : 3478,
                             resource->transport_protocol ?
                             resource->transport_protocol :
                             IPPROTO_UDP,
                             cb, cb_arg);

  switch(resource->address_family) {
    case AF_INET:
      resolve_flags |= nsIDNSService::RESOLVE_DISABLE_IPV6;
      break;
    case AF_INET6:
      resolve_flags |= nsIDNSService::RESOLVE_DISABLE_IPV4;
      break;
    default:
      ABORT(R_BAD_ARGS);
  }

  if (NS_FAILED(dns_->AsyncResolveNative(nsAutoCString(resource->domain_name),
                                         resolve_flags, pr,
                                         sts_thread_, attrs,
                                         getter_AddRefs(pr->request_)))) {
    MOZ_MTLOG(ML_ERROR, "AsyncResolve failed.");
    ABORT(R_NOT_FOUND);
  }
  // Because the C API offers no "finished" method to release the handle we
  // return, we cannot return the request we got from AsyncResolve directly.
  //
  // Instead, we return an addref'ed reference to PendingResolution itself,
  // which in turn holds the request and coordinates between cancel and
  // OnLookupComplete to release it only once.
  pr.forget(handle);

  _status=0;
abort:
  return _status;
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:53,代码来源:nriceresolver.cpp

示例9: CSFLogDebug

void
PeerConnectionMedia::SelfDestruct_m()
{
  CSFLogDebug(logTag, "%s: ", __FUNCTION__);

  ASSERT_ON_THREAD(mMainThread);
  mLocalSourceStreams.Clear();
  mRemoteSourceStreams.Clear();

  // Final self-destruct.
  this->Release();
}
开发者ID:mxOBS,项目名称:deb-pkg_icedove,代码行数:12,代码来源:PeerConnectionMedia.cpp


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