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


C++ nsRefPtr::AddRef方法代码示例

本文整理汇总了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;

}
开发者ID:mxOBS,项目名称:deb-pkg_icedove,代码行数:17,代码来源:ThebesLayerD3D9.cpp

示例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);
}
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:17,代码来源:PaintedLayerD3D9.cpp

示例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;
}
开发者ID:ConradIrwin,项目名称:gecko-dev,代码行数:46,代码来源:MediaPermissionGonk.cpp


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