本文整理汇总了C++中dont_AddRef函数的典型用法代码示例。如果您正苦于以下问题:C++ dont_AddRef函数的具体用法?C++ dont_AddRef怎么用?C++ dont_AddRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dont_AddRef函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例5: dont_AddRef
already_AddRefed<TransactionItem>
TransactionStack::Pop()
{
RefPtr<TransactionItem> item =
dont_AddRef(static_cast<TransactionItem*>(nsDeque::Pop()));
return item.forget();
}
示例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;
}
示例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);
}
示例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;
}
示例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
}
示例10: dont_AddRef
already_AddRefed<nsTransactionItem>
nsTransactionStack::PopBottom()
{
RefPtr<nsTransactionItem> item =
dont_AddRef(static_cast<nsTransactionItem*>(nsDeque::PopFront()));
return item.forget();
}
示例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;
}
示例12: dont_AddRef
bool
nsIContentChild::DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActor)
{
RefPtr<IPCBlobInputStreamChild> actor =
dont_AddRef(static_cast<IPCBlobInputStreamChild*>(aActor));
return true;
}
示例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;
}
示例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;
}
示例15: dont_AddRef
bool
NeckoChild::DeallocPWebSocketEventListenerChild(PWebSocketEventListenerChild* aActor)
{
RefPtr<WebSocketEventListenerChild> c =
dont_AddRef(static_cast<WebSocketEventListenerChild*>(aActor));
MOZ_ASSERT(c);
return true;
}