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;

}
Example #2
0
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);
}
// 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;
}