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


C++ nsTArray::Clear方法代码示例

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


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

示例1:

nsresult
MockMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
{
  aRanges.Clear();
  aRanges.AppendElements(mRanges);
  return NS_OK;
}
开发者ID:70599,项目名称:Waterfox,代码行数:7,代码来源:MockMediaResource.cpp

示例2: GetNumberOfChars

void
nsSVGTextContainerFrame::CopyRotateList(nsTArray<float> *parentList,
                                        const SVGNumberList *selfList,
                                        nsTArray<float> &dstList,
                                        PRUint32 aOffset)
{
  dstList.Clear();

  PRUint32 strLength = GetNumberOfChars();
  PRUint32 parentCount = 0;
  if (parentList && parentList->Length() > aOffset) {
    parentCount = NS_MIN(parentList->Length() - aOffset, strLength);
  }

  PRUint32 selfCount = NS_MIN(selfList ? selfList->Length() : 0, strLength);
  PRUint32 count = NS_MAX(parentCount, selfCount);

  if (count > 0) {
    if (!dstList.SetLength(count))
      return;
    for (PRUint32 i = 0; i < selfCount; i++) {
      dstList[i] = (*selfList)[i];
    }
    for (PRUint32 i = selfCount; i < parentCount; i++) {
      dstList[i] = (*parentList)[aOffset + i];
    }
  } else if (parentList && !parentList->IsEmpty()) {
    // rotate is applied to extra characters too
    dstList.AppendElement((*parentList)[parentList->Length() - 1]);
  }
}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:31,代码来源:nsSVGTextContainerFrame.cpp

示例3: BuildDocShellArray

nsresult nsDocShellEnumerator::BuildDocShellArray(nsTArray<nsWeakPtr>& inItemArray)
{
    NS_ENSURE_TRUE(mRootItem, NS_ERROR_NOT_INITIALIZED);
    inItemArray.Clear();
    nsCOMPtr<nsIDocShellTreeItem> item = do_QueryReferent(mRootItem);
    return BuildArrayRecursive(item, inItemArray);
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例4:

void
FileDescriptorSetChild::ForgetFileDescriptors(
    nsTArray<FileDescriptor>& aFileDescriptors)
{
    aFileDescriptors.Clear();
    mFileDescriptors.SwapElements(aFileDescriptors);
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:7,代码来源:FileDescriptorSetChild.cpp

示例5:

void
LayerManager::StopFrameTimeRecording(uint32_t         aStartIndex,
                                     nsTArray<float>& aFrameIntervals)
{
  uint32_t bufferSize = mRecording.mIntervals.Length();
  uint32_t length = mRecording.mNextIndex - aStartIndex;
  if (mRecording.mIsPaused || length > bufferSize || aStartIndex < mRecording.mCurrentRunStartIndex) {
    // aStartIndex is too old. Also if aStartIndex was issued before mRecordingNextIndex overflowed (uint32_t)
    //   and stopped after the overflow (would happen once every 828 days of constant 60fps).
    length = 0;
  }

  if (!length) {
    aFrameIntervals.Clear();
    return; // empty recording, return empty arrays.
  }
  // Set length in advance to avoid possibly repeated reallocations
  aFrameIntervals.SetLength(length);

  uint32_t cyclicPos = aStartIndex % bufferSize;
  for (uint32_t i = 0; i < length; i++, cyclicPos++) {
    if (cyclicPos == bufferSize) {
      cyclicPos = 0;
    }
    aFrameIntervals[i] = mRecording.mIntervals[cyclicPos];
  }
}
开发者ID:nightahul,项目名称:gecko-dev,代码行数:27,代码来源:Layers.cpp

示例6: GetNumberOfChars

void
nsSVGTextContainerFrame::CopyPositionList(nsTArray<float> *parentList,
                                        SVGUserUnitList *selfList,
                                        nsTArray<float> &dstList,
                                        uint32_t aOffset)
{
  dstList.Clear();

  uint32_t strLength = GetNumberOfChars();
  uint32_t parentCount = 0;
  if (parentList && parentList->Length() > aOffset) {
    parentCount = std::min(parentList->Length() - aOffset, strLength);
  }

  uint32_t selfCount = std::min(selfList->Length(), strLength);

  uint32_t count = std::max(parentCount, selfCount);

  if (!dstList.SetLength(count))
    return;

  for (uint32_t i = 0; i < selfCount; i++) {
    dstList[i] = (*selfList)[i];
  }
  for (uint32_t i = selfCount; i < parentCount; i++) {
    dstList[i] = (*parentList)[aOffset + i];
  }

}
开发者ID:BrunoReX,项目名称:palemoon,代码行数:29,代码来源:nsSVGTextContainerFrame.cpp

示例7: defined

static void
FillPBufferAttribs_ByBits(nsTArray<EGLint>& aAttrs,
                          int redBits, int greenBits,
                          int blueBits, int alphaBits,
                          int depthBits, int stencilBits)
{
    aAttrs.Clear();

#if defined(A1) || defined(A2)
#error The temp-macro names we want are already defined.
#endif

#define A1(_x)      do { aAttrs.AppendElement(_x); } while (0)
#define A2(_x,_y)   do { A1(_x); A1(_y); } while (0)

    A2(LOCAL_EGL_RENDERABLE_TYPE, LOCAL_EGL_OPENGL_ES2_BIT);
    A2(LOCAL_EGL_SURFACE_TYPE, LOCAL_EGL_PBUFFER_BIT);

    A2(LOCAL_EGL_RED_SIZE, redBits);
    A2(LOCAL_EGL_GREEN_SIZE, greenBits);
    A2(LOCAL_EGL_BLUE_SIZE, blueBits);
    A2(LOCAL_EGL_ALPHA_SIZE, alphaBits);

    A2(LOCAL_EGL_DEPTH_SIZE, depthBits);
    A2(LOCAL_EGL_STENCIL_SIZE, stencilBits);

    A1(LOCAL_EGL_NONE);
#undef A1
#undef A2
}
开发者ID:bebef1987,项目名称:gecko-dev,代码行数:30,代码来源:SharedSurfaceANGLE.cpp

示例8:

void
PerformanceObserverEntryList::GetEntries(
  const PerformanceEntryFilterOptions& aFilter,
  nsTArray<RefPtr<PerformanceEntry>>& aRetval)
{
  aRetval.Clear();
  for (const RefPtr<PerformanceEntry>& entry : mEntries) {
    if (aFilter.mInitiatorType.WasPassed()) {
      const PerformanceResourceTiming* resourceEntry =
        entry->ToResourceTiming();
      if (!resourceEntry) {
        continue;
      }
      nsAutoString initiatorType;
      resourceEntry->GetInitiatorType(initiatorType);
      if (!initiatorType.Equals(aFilter.mInitiatorType.Value())) {
        continue;
      }
    }
    if (aFilter.mName.WasPassed() &&
        !entry->GetName().Equals(aFilter.mName.Value())) {
      continue;
    }
    if (aFilter.mEntryType.WasPassed() &&
        !entry->GetEntryType().Equals(aFilter.mEntryType.Value())) {
      continue;
    }

    aRetval.AppendElement(entry);
  }
}
开发者ID:70599,项目名称:Waterfox,代码行数:31,代码来源:PerformanceObserverEntryList.cpp

示例9: ReleaseShmems

// static
void IpcResourceUpdateQueue::ReleaseShmems(ipc::IProtocol* aShmAllocator,
                                           nsTArray<ipc::Shmem>& aShms) {
  for (auto& shm : aShms) {
    aShmAllocator->DeallocShmem(shm);
  }
  aShms.Clear();
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:8,代码来源:IpcResourceUpdateQueue.cpp

示例10:

nsresult
nsGonkCameraControl::GetVideoSizes(nsTArray<CameraSize>& aVideoSizes)
{
  aVideoSizes.Clear();

  Vector<Size> sizes;
  mParams.getSupportedVideoSizes(sizes);
  if (sizes.size() == 0) {
    DOM_CAMERA_LOGI("Camera doesn't support video independent of the preview\n");
    mParams.getSupportedPreviewSizes(sizes);
  }

  if (sizes.size() == 0) {
    DOM_CAMERA_LOGW("Camera doesn't report any supported video sizes at all\n");
    return NS_OK;
  }

  for (size_t i = 0; i < sizes.size(); ++i) {
    CameraSize size;
    size.width = sizes[i].width;
    size.height = sizes[i].height;
    aVideoSizes.AppendElement(size);
  }
  return NS_OK;
}
开发者ID:svevang,项目名称:mozilla-central,代码行数:25,代码来源:GonkCameraControl.cpp

示例11:

void
JetpackActorCommon::RecList::copyTo(nsTArray<jsval>& dst) const
{
  dst.Clear();
  for (RecNode* node = mHead; node; node = node->down)
    dst.AppendElement(node->value());
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:7,代码来源:JetpackActorCommon.cpp

示例12: SpeechSynthesisVoice

void
SpeechSynthesis::GetVoices(nsTArray< nsRefPtr<SpeechSynthesisVoice> >& aResult)
{
  aResult.Clear();
  uint32_t voiceCount = 0;

  nsresult rv = nsSynthVoiceRegistry::GetInstance()->GetVoiceCount(&voiceCount);
  NS_ENSURE_SUCCESS_VOID(rv);

  for (uint32_t i = 0; i < voiceCount; i++) {
    nsAutoString uri;
    rv = nsSynthVoiceRegistry::GetInstance()->GetVoice(i, uri);

    if (NS_FAILED(rv)) {
      NS_WARNING("Failed to retrieve voice from registry");
      continue;
    }

    SpeechSynthesisVoice* voice = mVoiceCache.GetWeak(uri);

    if (!voice) {
      voice = new SpeechSynthesisVoice(this, uri);
    }

    aResult.AppendElement(voice);
  }

  mVoiceCache.Clear();

  for (uint32_t i = 0; i < aResult.Length(); i++) {
    SpeechSynthesisVoice* voice = aResult[i];
    mVoiceCache.Put(voice->mUri, voice);
  }
}
开发者ID:ConradIrwin,项目名称:gecko-dev,代码行数:34,代码来源:SpeechSynthesis.cpp

示例13: Flush

void IpcResourceUpdateQueue::Flush(
    nsTArray<layers::OpUpdateResource>& aUpdates,
    nsTArray<layers::RefCountedShmem>& aSmallAllocs,
    nsTArray<ipc::Shmem>& aLargeAllocs) {
  aUpdates.Clear();
  mUpdates.SwapElements(aUpdates);
  mWriter.Flush(aSmallAllocs, aLargeAllocs);
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:8,代码来源:IpcResourceUpdateQueue.cpp

示例14: LOG

bool
DBusThread::TearDownData()
{
  LOG("Removing DBus Sockets\n");
  if (mControlFdW.get()) {
    mControlFdW.dispose();
  }
  if (mControlFdR.get()) {
    mControlFdR.dispose();
  }
  mPollData.Clear();

  // DBusWatch pointers are maintained by DBus, so we won't leak by
  // clearing.
  mWatchData.Clear();
  return true;
}
开发者ID:TheTypoMaster,项目名称:fennec-777045,代码行数:17,代码来源:DBusThread.cpp

示例15:

void
WindowsGamepadService::Cleanup()
{
  if (mXInputPollTimer) {
    mXInputPollTimer->Cancel();
  }
  mGamepads.Clear();
}
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:8,代码来源:WindowsGamepad.cpp


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