本文整理汇总了C++中nsRefPtr::AddRef方法的典型用法代码示例。如果您正苦于以下问题:C++ nsRefPtr::AddRef方法的具体用法?C++ nsRefPtr::AddRef怎么用?C++ nsRefPtr::AddRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsRefPtr
的用法示例。
在下文中一共展示了nsRefPtr::AddRef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Begin
void
OpaqueRenderer::End()
{
mSurface = nullptr;
// gfxWindowsSurface returned from ::Begin() should be released before the
// texture is used. This will assert that this is the case
#if 1
if (mD3D9ThebesSurface) {
mD3D9ThebesSurface->AddRef();
nsrefcnt c = mD3D9ThebesSurface->Release();
if (c != 1)
NS_RUNTIMEABORT("Reference mD3D9ThebesSurface must be released by caller of Begin() before calling End()");
}
#endif
mD3D9ThebesSurface = nullptr;
}
示例2: Begin
void
TransparentRenderer::End()
{
// gfxImageSurface returned from ::Begin() should be released before the
// texture is used. This will assert that this is the case
#if 1
if (mD3D9ThebesSurface) {
mD3D9ThebesSurface->AddRef();
nsrefcnt c = mD3D9ThebesSurface->Release();
if (c != 1)
NS_RUNTIMEABORT("Reference mD3D9ThebesSurface must be released by caller of Begin() before calling End()");
}
#endif
mD3D9ThebesSurface = nullptr;
if (mTmpTexture)
mTmpTexture->UnlockRect(0);
}
示例3: window
// Trigger permission prompt UI
nsresult
MediaDeviceSuccessCallback::DoPrompt(nsRefPtr<MediaPermissionRequest> &req)
{
// for content process
if (XRE_GetProcessType() == GeckoProcessType_Content) {
MOZ_ASSERT(NS_IsMainThread()); // IPC can only be execute on main thread.
nsresult rv;
nsCOMPtr<nsPIDOMWindow> window(req->GetOwner());
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
dom::TabChild* child = dom::TabChild::GetFrom(window->GetDocShell());
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
nsAutoCString type;
rv = req->GetType(type);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString access;
rv = req->GetAccess(access);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> principal;
rv = req->GetPrincipal(getter_AddRefs(principal));
NS_ENSURE_SUCCESS(rv, rv);
req->AddRef();
child->SendPContentPermissionRequestConstructor(req,
type,
access,
IPC::Principal(principal));
req->Sendprompt();
return NS_OK;
}
// for chrome process
nsCOMPtr<nsIContentPermissionPrompt> prompt =
do_GetService(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
if (prompt) {
prompt->Prompt(req);
}
return NS_OK;
}