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


C++ StaticAutoPtr::Length方法代码示例

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


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

示例1: locker

void
TelemetryIPCAccumulator::RecordChildEvent(const mozilla::TimeStamp& timestamp,
                                          const nsACString& category,
                                          const nsACString& method,
                                          const nsACString& object,
                                          const mozilla::Maybe<nsCString>& value,
                                          const nsTArray<mozilla::Telemetry::EventExtraEntry>& extra)
{
  StaticMutexAutoLock locker(gTelemetryIPCAccumulatorMutex);

  if (!gChildEvents) {
    gChildEvents = new nsTArray<ChildEventData>();
  }

  if (gChildEvents->Length() >=
      kWaterMarkDiscardFactor * kEventsArrayHighWaterMark) {
    gDiscardedData.mDiscardedChildEvents++;
    return;
  }

  if (gChildEvents->Length() == kEventsArrayHighWaterMark) {
    DispatchIPCTimerFired();
  }

  // Store the event.
  gChildEvents->AppendElement(ChildEventData{timestamp, nsCString(category),
                                             nsCString(method), nsCString(object),
                                             value,
                                             nsTArray<mozilla::Telemetry::EventExtraEntry>(extra)});
  ArmIPCTimer(locker);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:31,代码来源:TelemetryIPCAccumulator.cpp

示例2: ConnectResultHandler

void
BluetoothGattManager::Connect(const nsAString& aAppUuid,
                              const nsAString& aDeviceAddr,
                              BluetoothReplyRunnable* aRunnable)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(aRunnable);

  ENSURE_GATT_CLIENT_INTF_IS_READY_VOID(aRunnable);

  size_t index = sClients->IndexOf(aAppUuid, 0 /* Start */, UuidComparator());
  if (index == sClients->NoIndex) {
    index = sClients->Length();
    sClients->AppendElement(new BluetoothGattClient(aAppUuid, aDeviceAddr));
  }

  nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
  client->mConnectRunnable = aRunnable;

  if (client->mClientIf > 0) {
    sBluetoothGattClientInterface->Connect(client->mClientIf,
                                           aDeviceAddr,
                                           true, // direct connect
                                           new ConnectResultHandler(client));
  } else {
    BluetoothUuid uuid;
    StringToUuid(NS_ConvertUTF16toUTF8(aAppUuid).get(), uuid);

    // connect will be proceeded after client registered
    sBluetoothGattClientInterface->RegisterClient(
      uuid, new RegisterClientResultHandler(client));
  }
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:33,代码来源:BluetoothGattManager.cpp


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