本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例12: AssertIsOnMainThread
void
CompareCache::RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
{
AssertIsOnMainThread();
if (mAborted) {
return;
}
mManager->CacheFinished(NS_ERROR_FAILURE, false);
}
示例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;
}
示例14: RequestSample
void
MediaDecodeTask::SampleDecoded(AudioData* aData)
{
MOZ_ASSERT(!NS_IsMainThread());
mAudioQueue.Push(aData);
if (!mFirstFrameDecoded) {
mDecoderReader->ReadUpdatedMetadata(&mMediaInfo);
mFirstFrameDecoded = true;
}
RequestSample();
}
示例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();
}