• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dont_AddRef函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Test06_nsCOMPtr00

void // nsresult
Test06_nsCOMPtr00(nsIDOMWindowInternal* aDOMWindow, nsIWebShellWindow** aWebShellWindow)
    // m328, w191/199
{
//  if (!aDOMWindow)
//    return NS_ERROR_NULL_POINTER;
  nsresult status;
  nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject = do_QueryInterface(aDOMWindow, &status);
  nsIDocShell* temp0 = 0;
  if (scriptGlobalObject)
    scriptGlobalObject->GetDocShell(&temp0);
  nsCOMPtr<nsIDocShell> docShell = dont_AddRef(temp0);
  nsCOMPtr<nsIWebShell> webShell;
  if (docShell)
    webShell=do_QueryInterface(docShell, &status);
  nsIWebShellContainer* temp2 = 0;
  if (webShell)
    status = webShell->GetContainer(temp2);
  nsCOMPtr<nsIWebShellContainer> webShellContainer = dont_AddRef(temp2);
  if (webShellContainer)
    status = webShellContainer->QueryInterface(NS_GET_IID(nsIWebShellWindow), (void**)aWebShellWindow);
  else
    (*aWebShellWindow) = 0;
//    return status;
}
开发者ID:bringhurst,项目名称:vbox,代码行数:25,代码来源:SizeTest06.cpp


示例2: Test06_nsCOMPtr03

void // nsresult
Test06_nsCOMPtr03(nsIDOMWindowInternal* aDOMWindow, nsCOMPtr<nsIWebShellWindow>* aWebShellWindow)
    // m332, w189/188
{
//    if (!aDOMWindow)
//      return NS_ERROR_NULL_POINTER;
  (*aWebShellWindow) = 0;
  nsresult status;
  nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject = do_QueryInterface(aDOMWindow, &status);
  if (scriptGlobalObject) {
    nsIDocShell* temp0;
    scriptGlobalObject->GetDocShell(&temp0);
    nsCOMPtr<nsIDocShell> docShell = dont_AddRef(temp0);
    if (docShell) {
      nsCOMPtr<nsIWebShell> webShell = do_QueryInterface(docShell, &status);
      if (webShell) {
        nsIWebShellContainer* temp2;
        status = webShell->GetContainer(temp2);
        nsCOMPtr<nsIWebShellContainer> webShellContainer = dont_AddRef(temp2);
        (*aWebShellWindow) = do_QueryInterface(webShellContainer, &status);
      }
    }
  }
//    return status;
}
开发者ID:bringhurst,项目名称:vbox,代码行数:25,代码来源:SizeTest06.cpp


示例3: dont_AddRef

void
nsFileView::ReverseArray(nsISupportsArray* aArray)
{
  PRUint32 count;
  aArray->Count(&count);
  for (PRUint32 i = 0; i < count/2; ++i) {
    nsCOMPtr<nsISupports> element = dont_AddRef(aArray->ElementAt(i));
    nsCOMPtr<nsISupports> element2 = dont_AddRef(aArray->ElementAt(count-i-1));
    aArray->ReplaceElementAt(element2, i);
    aArray->ReplaceElementAt(element, count-i-1);
  }
}
开发者ID:krellian,项目名称:mozilla-central,代码行数:12,代码来源:nsFileView.cpp


示例4: key

NS_INTERFACE_MAP_END

// nsIWindowMediatorListener implementation
// handle notifications from the window mediator and reflect them into
// RDF

/* void onWindowTitleChange (in nsIXULWindow window, in wstring newTitle); */
NS_IMETHODIMP
nsWindowDataSource::OnWindowTitleChange(nsIXULWindow *window,
                                        const PRUnichar *newTitle)
{
    nsresult rv;
    
    nsVoidKey key(window);

    nsCOMPtr<nsISupports> sup =
        dont_AddRef(mWindowResources.Get(&key));

    // oops, make sure this window is in the hashtable!
    if (!sup) {
        OnOpenWindow(window);
        sup = dont_AddRef(mWindowResources.Get(&key));
    }
    
    NS_ENSURE_TRUE(sup, NS_ERROR_UNEXPECTED);

    nsCOMPtr<nsIRDFResource> windowResource =
        do_QueryInterface(sup);

    nsCOMPtr<nsIRDFLiteral> newTitleLiteral;
    rv = gRDFService->GetLiteral(newTitle, getter_AddRefs(newTitleLiteral));
    NS_ENSURE_SUCCESS(rv, rv);

    // get the old title
    nsCOMPtr<nsIRDFNode> oldTitleNode;
    rv = GetTarget(windowResource, kNC_Name, PR_TRUE,
                   getter_AddRefs(oldTitleNode));
    
    // assert the change
    if (NS_SUCCEEDED(rv) && oldTitleNode)
        // has an existing window title, update it
        rv = Change(windowResource, kNC_Name, oldTitleNode, newTitleLiteral);
    else
        // removed from the tasklist
        rv = Assert(windowResource, kNC_Name, newTitleLiteral, PR_TRUE);

    if (rv != NS_RDF_ASSERTION_ACCEPTED)
    {
      NS_ERROR("unable to set window name");
    }
    
    return NS_OK;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:53,代码来源:nsWindowDataSource.cpp


示例5: dont_AddRef

already_AddRefed<TransactionItem>
TransactionStack::Pop()
{
  RefPtr<TransactionItem> item =
    dont_AddRef(static_cast<TransactionItem*>(nsDeque::Pop()));
  return item.forget();
}
开发者ID:heiher,项目名称:gecko-dev,代码行数:7,代码来源:TransactionStack.cpp


示例6: dont_AddRef

nsresult
nsXPTZipLoader::EnumerateEntries(nsILocalFile* aFile,
                                 nsIXPTLoaderSink* aSink)
{
    nsCOMPtr<nsIZipReader> zip = dont_AddRef(GetZipReader(aFile));

    if (!zip) {
        NS_WARNING("Could not get Zip Reader");
        return NS_OK;
    }

    nsCOMPtr<nsIUTF8StringEnumerator> entries;
    if (NS_FAILED(zip->FindEntries("*.xpt", getter_AddRefs(entries))) ||
        !entries) {
        // no problem, just no .xpt files in this archive
        return NS_OK;
    }

    PRBool hasMore;
    int index = 0;
    while (NS_SUCCEEDED(entries->HasMore(&hasMore)) && hasMore) {
        nsCAutoString itemName;
        if (NS_FAILED(entries->GetNext(itemName)))
            return NS_ERROR_UNEXPECTED;

        nsCOMPtr<nsIInputStream> stream;
        if (NS_FAILED(zip->GetInputStream(itemName.get(), getter_AddRefs(stream))))
            return NS_ERROR_FAILURE;

        // ignore the result
        aSink->FoundEntry(itemName.get(), index++, stream);
    }

    return NS_OK;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:35,代码来源:nsXPTZipLoader.cpp


示例7: GetCurrentException

nsresult
nsExceptionService::DoGetExceptionFromProvider(nsresult errCode, 
                                               nsIException * defaultException,
                                               nsIException **_exc)
{
    // Check for an existing exception
    nsresult nr = GetCurrentException(_exc);
    if (NS_SUCCEEDED(nr) && *_exc) {
        (*_exc)->GetResult(&nr);
        // If it matches our result then use it
        if (nr == errCode)
            return NS_OK;
        NS_RELEASE(*_exc);
    }
    nsProviderKey key(NS_ERROR_GET_MODULE(errCode));
    nsCOMPtr<nsIExceptionProvider> provider =
        dont_AddRef((nsIExceptionProvider *)mProviders.Get(&key));

    // No provider so we'll return the default exception
    if (!provider) {
        *_exc = defaultException;
        NS_IF_ADDREF(*_exc);
        return NS_OK;
    }

    return provider->GetException(errCode, defaultException, _exc);
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:27,代码来源:nsExceptionService.cpp


示例8: xpc_NewIDObject

JSObject *
xpc_NewIDObject(JSContext *cx, JSObject* jsobj, const nsID& aID)
{
    JSObject *obj = nsnull;

    nsCOMPtr<nsIJSID> iid =
            dont_AddRef(static_cast<nsIJSID*>(nsJSID::NewID(aID)));
    if(iid)
    {
        nsXPConnect* xpc = nsXPConnect::GetXPConnect();
        if(xpc)
        {
            nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
            nsresult rv = xpc->WrapNative(cx, jsobj,
                                          static_cast<nsISupports*>(iid),
                                          NS_GET_IID(nsIJSID),
                                          getter_AddRefs(holder));
            if(NS_SUCCEEDED(rv) && holder)
            {
                holder->GetJSObject(&obj);
            }
        }
    }
    return obj;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:25,代码来源:xpcjsid.cpp


示例9: MOZ_ASSERT

void
EventTokenBucket::DispatchEvents()
{
    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
    SOCKET_LOG(("EventTokenBucket::DispatchEvents %p %d\n", this, mPaused));
    if (mPaused || mStopped)
        return;

    while (mEvents.GetSize() && mUnitCost <= mCredit) {
        nsRefPtr<TokenBucketCancelable> cancelable =
            dont_AddRef(static_cast<TokenBucketCancelable *>(mEvents.PopFront()));
        if (cancelable->mEvent) {
            SOCKET_LOG(("EventTokenBucket::DispachEvents [%p] "
                        "Dispatching queue token bucket event cost=%lu credit=%lu\n",
                        this, mUnitCost, mCredit));
            mCredit -= mUnitCost;
            cancelable->Fire();
        }
    }

#ifdef XP_WIN
    if (!mEvents.GetSize())
        WantNormalTimers();
#endif
}
开发者ID:plancalculus,项目名称:xulrunner,代码行数:25,代码来源:EventTokenBucket.cpp


示例10: dont_AddRef

already_AddRefed<nsTransactionItem>
nsTransactionStack::PopBottom()
{
  RefPtr<nsTransactionItem> item =
    dont_AddRef(static_cast<nsTransactionItem*>(nsDeque::PopFront()));
  return item.forget();
}
开发者ID:MekliCZ,项目名称:positron,代码行数:7,代码来源:nsTransactionStack.cpp


示例11: do_CreateInstance

nsresult WebBrowserChrome::CreateBrowser(HWND nativeWnd)
{
	nsresult rv;
	mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
	if(NS_FAILED(rv))
		return NS_ERROR_FAILURE;

	AddRef();
	if(NS_FAILED(mWebBrowser->SetContainerWindow((nsIWebBrowserChrome*)this)))
		return NS_ERROR_FAILURE;
	
	mNativeWindow = nativeWnd;
	RECT area;
	GetClientRect(mNativeWindow, &area);
	nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebBrowser);
	if(NS_FAILED(baseWindow->InitWindow(mNativeWindow, NULL, area.left, area.top, area.right - area.left, area.bottom - area.top)))
		return NS_ERROR_FAILURE;
	if(NS_FAILED(baseWindow->Create()))
		return NS_ERROR_FAILURE;
	baseWindow->SetVisibility(PR_TRUE);

	nsWeakPtr weakling(dont_AddRef(NS_GetWeakReference(static_cast<nsIWebProgressListener*>(this))));
	if(NS_FAILED(mWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener))))
		return NS_ERROR_FAILURE;

	return NS_OK;
}
开发者ID:z4y4,项目名称:njord,代码行数:27,代码来源:webbrowserchrome.cpp


示例12: dont_AddRef

bool
nsIContentChild::DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActor)
{
  RefPtr<IPCBlobInputStreamChild> actor =
    dont_AddRef(static_cast<IPCBlobInputStreamChild*>(aActor));
  return true;
}
开发者ID:yrliou,项目名称:gecko-dev,代码行数:7,代码来源:nsIContentChild.cpp


示例13: CoCreateInstance

// (static) Creates a ShellLink that encapsulate a separator.
nsresult JumpListSeparator::GetSeparator(nsRefPtr<IShellLinkW>& aShellLink)
{
  HRESULT hr;
  IShellLinkW* psl;

  // Create a IShellLink.
  hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, 
                        IID_IShellLinkW, (LPVOID*)&psl);
  if (FAILED(hr))
    return NS_ERROR_UNEXPECTED;

  IPropertyStore* pPropStore = nullptr;
  hr = psl->QueryInterface(IID_IPropertyStore, (LPVOID*)&pPropStore);
  if (FAILED(hr))
    return NS_ERROR_UNEXPECTED;

  PROPVARIANT pv;
  InitPropVariantFromBoolean(TRUE, &pv);

  pPropStore->SetValue(PKEY_AppUserModel_IsDestListSeparator, pv);
  pPropStore->Commit();
  pPropStore->Release();

  PropVariantClear(&pv);

  aShellLink = dont_AddRef(psl);

  return NS_OK;
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:30,代码来源:JumpListItem.cpp


示例14: key

NS_IMETHODIMP
nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result)
{
    nsCStringKey key(prop);

    nsCOMPtr<nsISupports> value = dont_AddRef(mHashtable.Get(&key));

    if (value)
    {
        nsCOMPtr<nsIFile> cloneFile;
        nsCOMPtr<nsIFile> cachedFile = do_QueryInterface(value);
        NS_ASSERTION(cachedFile, "nsIFile expected");

        cachedFile->Clone(getter_AddRefs(cloneFile));
        return cloneFile->QueryInterface(uuid, result);
    }

    // it is not one of our defaults, lets check any providers
    FileData fileData(prop, uuid);

    mProviders->EnumerateBackwards(FindProviderFile, &fileData);
    if (fileData.data)
    {
        if (fileData.persistent)
        {
            Set(prop, NS_STATIC_CAST(nsIFile*, fileData.data));
        }
        nsresult rv = (fileData.data)->QueryInterface(uuid, result);
        NS_RELEASE(fileData.data);  // addref occurs in FindProviderFile()
        return rv;
    }
开发者ID:etiago,项目名称:vbox,代码行数:31,代码来源:nsDirectoryService.cpp


示例15: dont_AddRef

bool
NeckoChild::DeallocPWebSocketEventListenerChild(PWebSocketEventListenerChild* aActor)
{
  RefPtr<WebSocketEventListenerChild> c =
    dont_AddRef(static_cast<WebSocketEventListenerChild*>(aActor));
  MOZ_ASSERT(c);
  return true;
}
开发者ID:brendandahl,项目名称:positron,代码行数:8,代码来源:NeckoChild.cpp


示例16: dont_AddRef

bool
PresentationParent::DeallocPPresentationRequestParent(
  PPresentationRequestParent* aActor)
{
  RefPtr<PresentationRequestParent> actor =
    dont_AddRef(static_cast<PresentationRequestParent*>(aActor));
  return true;
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:8,代码来源:PresentationParent.cpp


示例17: do_GetService

NS_IMETHODIMP
nsEmbedFilePicker::OnMessageReceived(const char* messageName, const PRUnichar* message)
{
  nsCOMPtr<nsIEmbedLiteJSON> json = do_GetService("@mozilla.org/embedlite-json;1");
  nsCOMPtr<nsIPropertyBag2> root;
  NS_ENSURE_SUCCESS(json->ParseJSON(nsDependentString(message), getter_AddRefs(root)), NS_ERROR_FAILURE);

  uint32_t winid = 0;
  root->GetPropertyAsUint32(NS_LITERAL_STRING("winid"), &winid);

  std::map<uint32_t, EmbedFilePickerResponse>::iterator it = mResponseMap.find(winid);
  if (it == mResponseMap.end()) {
    return NS_ERROR_FAILURE;
  }
  EmbedFilePickerResponse& response = it->second;

  root->GetPropertyAsBool(NS_LITERAL_STRING("accepted"), &response.accepted);
  nsCOMPtr<nsIVariant> itemsvar;
  nsresult rv = root->GetProperty(NS_LITERAL_STRING("items"), getter_AddRefs(itemsvar));

  uint16_t dataType = 0;
  itemsvar->GetDataType(&dataType);

  if (dataType == nsIDataType::VTYPE_ARRAY) {
    uint16_t valueType;
    nsIID iid;
    uint32_t valueCount;
    void* rawArray;
    if (NS_SUCCEEDED(itemsvar->GetAsArray(&valueType, &iid, &valueCount, &rawArray))) {
      if (valueType == nsIDataType::VTYPE_INTERFACE ||
          valueType == nsIDataType::VTYPE_INTERFACE_IS) {
        nsISupports** values = static_cast<nsISupports**>(rawArray);
        for (uint32_t i = 0; i < valueCount; ++i) {
          nsCOMPtr<nsISupports> supports = dont_AddRef(values[i]);
          nsCOMPtr<nsIVariant> item = do_QueryInterface(supports);
          nsString itemString;
          if (item && NS_SUCCEEDED(item->GetAsAString(itemString))) {
            response.items.AppendElement(itemString);
          }
        }
      }
      nsMemory::Free(rawArray);
    }
  } else {
    NS_ERROR("Unexpected items type");
  }

  if (mCallback) {
    mCallback->Done(nsIFilePicker::returnOK);
    mCallback = nullptr;
    mService->RemoveMessageListener("promptresponse", this);
  }
  else {
    mModalDepth--;
  }

  return NS_OK;
}
开发者ID:rojkov,项目名称:embedlite-components,代码行数:58,代码来源:nsFilePicker.cpp


示例18: TextureHostDirectUpload

DIBTextureHost::DIBTextureHost(TextureFlags aFlags,
                               const SurfaceDescriptorDIB& aDescriptor)
  : TextureHostDirectUpload(aFlags, SurfaceFormat::B8G8R8X8, IntSize())
{
  // We added an extra ref for transport, so we shouldn't AddRef now.
  mSurface =
    dont_AddRef(reinterpret_cast<gfxWindowsSurface*>(aDescriptor.surface()));
  MOZ_ASSERT(mSurface);

  mSize = mSurface->GetSize();
  mFormat = mSurface->GetSurfaceFormat();
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:12,代码来源:TextureDIB.cpp


示例19: mon

nsresult
FlushableTaskQueue::FlushAndDispatch(already_AddRefed<nsIRunnable> aRunnable)
{
  MonitorAutoLock mon(mQueueMonitor);
  AutoSetFlushing autoFlush(this);
  FlushLocked();
  nsCOMPtr<nsIRunnable> r = dont_AddRef(aRunnable.take());
  nsresult rv = DispatchLocked(r.forget(), IgnoreFlushing, AssertDispatchSuccess);
  NS_ENSURE_SUCCESS(rv, rv);
  AwaitIdleLocked();
  return NS_OK;
}
开发者ID:rhelmer,项目名称:gecko-dev,代码行数:12,代码来源:TaskQueue.cpp


示例20: do_QueryInterface

// (static) ShellItems are used to encapsulate links to things. We currently only support URI links,
// but more support could be added, such as local file and directory links.
nsresult JumpListLink::GetShellItem(nsCOMPtr<nsIJumpListItem>& item, nsRefPtr<IShellItem2>& aShellItem)
{
  IShellItem2 *psi = nullptr;
  nsresult rv;

  int16_t type; 
  if (NS_FAILED(item->GetType(&type)))
    return NS_ERROR_INVALID_ARG;

  if (type != nsIJumpListItem::JUMPLIST_ITEM_LINK)
    return NS_ERROR_INVALID_ARG;

  nsCOMPtr<nsIJumpListLink> link = do_QueryInterface(item, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsIURI> uri;
  rv = link->GetUri(getter_AddRefs(uri));
  NS_ENSURE_SUCCESS(rv, rv);

  nsAutoCString spec;
  rv = uri->GetSpec(spec);
  NS_ENSURE_SUCCESS(rv, rv);

  // Create the IShellItem
  if (FAILED(WinUtils::SHCreateItemFromParsingName(
               NS_ConvertASCIItoUTF16(spec).get(), NULL, IID_PPV_ARGS(&psi)))) {
    return NS_ERROR_INVALID_ARG;
  }

  // Set the title
  nsAutoString linkTitle;
  link->GetUriTitle(linkTitle);

  IPropertyStore* pPropStore = nullptr;
  HRESULT hres = psi->GetPropertyStore(GPS_DEFAULT, IID_IPropertyStore, (void**)&pPropStore);
  if (FAILED(hres))
    return NS_ERROR_UNEXPECTED;

  PROPVARIANT pv;
  InitPropVariantFromString(linkTitle.get(), &pv);

  // May fail due to shell item access permissions.
  pPropStore->SetValue(PKEY_ItemName, pv);
  pPropStore->Commit();
  pPropStore->Release();

  PropVariantClear(&pv);

  aShellItem = dont_AddRef(psi);

  return NS_OK;
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:54,代码来源:JumpListItem.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dooptions函数代码示例发布时间:2022-05-30
下一篇:
C++ done_testing函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap