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


C++ nsRefPtr类代码示例

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


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

示例1:

PLDHashOperator 
gfxPlatformFontList::FindFontForCharProc(nsStringHashKey::KeyType aKey, nsRefPtr<gfxFontFamily>& aFamilyEntry,
     void *userArg)
{
    GlobalFontMatch *data = static_cast<GlobalFontMatch*>(userArg);

    // evaluate all fonts in this family for a match
    aFamilyEntry->FindFontForChar(data);

    return PL_DHASH_NEXT;
}
开发者ID:chuck-lee,项目名称:mozilla-central,代码行数:11,代码来源:gfxPlatformFontList.cpp

示例2: mTargetApzc

InputBlockState::InputBlockState(const nsRefPtr<AsyncPanZoomController>& aTargetApzc,
                                 bool aTargetConfirmed)
  : mTargetApzc(aTargetApzc)
  , mTargetConfirmed(aTargetConfirmed)
  , mBlockId(sBlockCounter++)
  , mTransformToApzc(aTargetApzc->GetTransformToThis())
{
  // We should never be constructed with a nullptr target.
  MOZ_ASSERT(mTargetApzc);
  mOverscrollHandoffChain = mTargetApzc->BuildOverscrollHandoffChain();
}
开发者ID:chirimen-oh,项目名称:gecko-dev,代码行数:11,代码来源:InputBlockState.cpp

示例3: WorkerRun

  bool
  WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
  {
    MOZ_ASSERT(aWorkerPrivate);
    aWorkerPrivate->AssertIsOnWorkerThread();
    MOZ_ASSERT(aWorkerPrivate == mResolver->GetWorkerPrivate());

    nsRefPtr<Promise> promise = mResolver->mFetchPromise.forget();

    if (mInternalResponse->Type() != ResponseType::Error) {
      nsRefPtr<nsIGlobalObject> global = aWorkerPrivate->GlobalScope();
      mResolver->mResponse = new Response(global, mInternalResponse);

      promise->MaybeResolve(mResolver->mResponse);
    } else {
      ErrorResult result;
      result.ThrowTypeError(MSG_FETCH_FAILED);
      promise->MaybeReject(result);
    }
    return true;
  }
开发者ID:Mardak,项目名称:tiles-dev,代码行数:21,代码来源:Fetch.cpp

示例4:

 virtual ~TestBinding()
 {
   {
     nsRefPtr<MediaTaskQueue> queue = reader->GetTaskQueue();
     queue->Dispatch(NS_NewRunnableMethod(reader, &MP4Reader::Shutdown));
     queue->AwaitShutdownAndIdle();
   }
   decoder = nullptr;
   resource = nullptr;
   reader = nullptr;
   SharedThreadPool::SpinUntilShutdown();
 }
开发者ID:Acidburn0zzz,项目名称:tor-browser,代码行数:12,代码来源:TestMP4Reader.cpp

示例5: LOG

PLDHashOperator
CacheFile::WriteAllCachedChunks(const uint32_t& aIdx,
                                nsRefPtr<CacheFileChunk>& aChunk,
                                void* aClosure)
{
  CacheFile *file = static_cast<CacheFile*>(aClosure);

  LOG(("CacheFile::WriteAllCachedChunks() [this=%p, idx=%d, chunk=%p]",
       file, aIdx, aChunk.get()));

  file->mChunks.Put(aIdx, aChunk);
  aChunk->mFile = file;
  aChunk->mRemovingChunk = false;

  MOZ_ASSERT(aChunk->IsReady());

  NS_ADDREF(aChunk);
  file->ReleaseOutsideLock(aChunk);

  return PL_DHASH_REMOVE;
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例6:

nsresult
nsDOMEventTargetHelper::GetInnerEventListener(nsRefPtr<nsDOMEventListenerWrapper>& aWrapper,
                                              nsIDOMEventListener** aListener)
{
  NS_ENSURE_ARG_POINTER(aListener);
  if (aWrapper) {
    NS_ADDREF(*aListener = aWrapper->GetInner());
  } else {
    *aListener = nsnull;
  }
  return NS_OK;
}
开发者ID:adityavs,项目名称:mozilla-history,代码行数:12,代码来源:nsDOMEventTargetHelper.cpp

示例7: MOZ_ASSERT

bool
MediaDecodeTask::CreateReader()
{
  MOZ_ASSERT(NS_IsMainThread());


  nsCOMPtr<nsIPrincipal> principal;
  nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(mDecodeJob.mContext->GetParentObject());
  if (sop) {
    principal = sop->GetPrincipal();
  }

  nsRefPtr<BufferMediaResource> resource =
    new BufferMediaResource(static_cast<uint8_t*> (mBuffer),
                            mLength, principal, mContentType);

  MOZ_ASSERT(!mBufferDecoder);
  mBufferDecoder = new BufferDecoder(resource);

  // If you change this list to add support for new decoders, please consider
  // updating HTMLMediaElement::CreateDecoder as well.

  mDecoderReader = DecoderTraits::CreateReader(mContentType, mBufferDecoder);

  if (!mDecoderReader) {
    return false;
  }

  nsresult rv = mDecoderReader->Init(nullptr);
  if (NS_FAILED(rv)) {
    return false;
  }

  if (!mDecoderReader->EnsureTaskQueue()) {
    return false;
  }

  return true;
}
开发者ID:Lootyhoof,项目名称:Tycho,代码行数:39,代码来源:MediaBufferDecoder.cpp

示例8:

void
APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(
        nsIWidget* aWidget,
        const WidgetTouchEvent& aEvent,
        uint64_t aInputBlockId,
        const nsRefPtr<SetAllowedTouchBehaviorCallback>& aCallback)
{
  nsTArray<TouchBehaviorFlags> flags;
  for (uint32_t i = 0; i < aEvent.touches.Length(); i++) {
    flags.AppendElement(widget::ContentHelper::GetAllowedTouchBehavior(aWidget, aEvent.touches[i]->mRefPoint));
  }
  aCallback->Run(aInputBlockId, flags);
}
开发者ID:WuChengLin,项目名称:gecko-dev,代码行数:13,代码来源:APZCCallbackHelper.cpp

示例9: Run

NS_IMETHODIMP DispatchAsyncScrollEventRunnable::Run()
{
  nsCOMPtr<Element> frameElement = mTabParent->GetOwnerElement();
  // Create the event's detail object.
  nsRefPtr<nsAsyncScrollEventDetail> detail =
    new nsAsyncScrollEventDetail(mContentRect.x, mContentRect.y,
                                 mContentRect.width, mContentRect.height,
                                 mContentSize.width, mContentSize.height);
  DispatchCustomDOMEvent(frameElement,
                         NS_LITERAL_STRING("mozbrowserasyncscroll"),
                         detail);
  return NS_OK;
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:13,代码来源:BrowserElementParent.cpp

示例10: FontListHashEnumFunc

static PLDHashOperator
FontListHashEnumFunc(nsStringHashKey::KeyType aKey,
                     nsRefPtr<FontFamily>& aFontFamily,
                     void* userArg)
{
    FontListData *data = (FontListData*)userArg;

    // use the first variation for now.  This data should be the same
    // for all the variations and should probably be moved up to
    // the Family
    gfxFontStyle style;
    style.language = data->mLangGroup;
    nsRefPtr<FontEntry> aFontEntry = aFontFamily->FindFontEntry(style);
    NS_ASSERTION(aFontEntry, "couldn't find any font entry in family");
    if (!aFontEntry)
        return PL_DHASH_NEXT;


    data->mStringArray.AppendElement(aFontFamily->Name());

    return PL_DHASH_NEXT;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:22,代码来源:gfxAndroidPlatform.cpp

示例11:

already_AddRefed<ProgressTracker>
RequestBehaviour::GetProgressTracker() const
{
  // NOTE: It's possible that our mOwner has an Image that it didn't notify
  // us about, if we were Canceled before its Image was constructed.
  // (Canceling removes us as an observer, so mOwner has no way to notify us).
  // That's why this method uses mOwner->GetProgressTracker() instead of just
  // mOwner->mProgressTracker -- we might have a null mImage and yet have an
  // mOwner with a non-null mImage (and a null mProgressTracker pointer).
  return mOwner->GetProgressTracker();
}
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:11,代码来源:imgRequestProxy.cpp

示例12: AssertIsOnMainThread

void
CompareCache::RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
{
  AssertIsOnMainThread();

  if (mAborted) {
    return;
  }

  mManager->CacheFinished(NS_ERROR_FAILURE, false);
}
开发者ID:hobinjk,项目名称:gecko-dev,代码行数:11,代码来源:ServiceWorkerScriptCache.cpp

示例13: Increment

NS_IMETHODIMP
nsPrefetchQueueEnumerator::GetNext(nsISupports **aItem)
{
    if (!mCurrent) return NS_ERROR_FAILURE;

    NS_ADDREF(*aItem = static_cast<nsIDOMLoadStatus*>(mCurrent.get()));

    Increment();

    return NS_OK;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:11,代码来源:nsPrefetchService.cpp

示例14: RequestSample

void
MediaDecodeTask::SampleDecoded(AudioData* aData)
{
  MOZ_ASSERT(!NS_IsMainThread());
  mAudioQueue.Push(aData);
  if (!mFirstFrameDecoded) {
    mDecoderReader->ReadUpdatedMetadata(&mMediaInfo);
    mFirstFrameDecoded = true;
  }
  RequestSample();
}
开发者ID:Lootyhoof,项目名称:Tycho,代码行数:11,代码来源:MediaBufferDecoder.cpp

示例15: scopedTex

TemporaryRef<gfx::SourceSurface>
GLImage::GetAsSourceSurface()
{
  MOZ_ASSERT(NS_IsMainThread(), "Should be on the main thread");

  if (!sSnapshotContext) {
    sSnapshotContext = GLContextProvider::CreateHeadless();

    if (!sSnapshotContext) {
      NS_WARNING("Failed to create snapshot GLContext");
      return nullptr;
    }
  }

  sSnapshotContext->MakeCurrent();
  ScopedTexture scopedTex(sSnapshotContext);
  ScopedBindTexture boundTex(sSnapshotContext, scopedTex.Texture());

  gfx::IntSize size = GetSize();
  sSnapshotContext->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_RGBA,
                                size.width, size.height, 0,
                                LOCAL_GL_RGBA,
                                LOCAL_GL_UNSIGNED_BYTE,
                                nullptr);

  ScopedFramebufferForTexture fb(sSnapshotContext, scopedTex.Texture());

  GLBlitHelper helper(sSnapshotContext);

  helper.BlitImageToFramebuffer(this, size, fb.FB(), false);
  ScopedBindFramebuffer bind(sSnapshotContext, fb.FB());

  RefPtr<gfx::DataSourceSurface> source =
        gfx::Factory::CreateDataSourceSurface(size, gfx::SurfaceFormat::B8G8R8A8);
  if (NS_WARN_IF(!source)) {
    return nullptr;
  }

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


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