本文整理汇总了C++中NS_IF_RELEASE函数的典型用法代码示例。如果您正苦于以下问题:C++ NS_IF_RELEASE函数的具体用法?C++ NS_IF_RELEASE怎么用?C++ NS_IF_RELEASE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NS_IF_RELEASE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Run
NS_IMETHOD Run() {
NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
// Explicitly release the MediaResource reference. We *must* do this on
// the main thread, so we must explicitly release it here, we can't rely
// on the destructor to release it, since if this event runs before its
// dispatch call returns the destructor may run on the non-main thread.
mResource = nullptr;
NS_ASSERTION(sThreadPoolRefCnt > 0, "sThreadPoolRefCnt Should be non-negative");
sThreadPoolRefCnt--;
if (sThreadPoolRefCnt == 0) {
NS_ASSERTION(sThreadPool != nullptr, "Should have thread pool ref if sThreadPoolRefCnt==0.");
// Note: store ref to thread pool, then clear global ref, then
// Shutdown() using the stored ref. Events can run during the Shutdown()
// call, so if we release after calling Shutdown(), another event may
// have incremented the refcnt in the meantime, and have a dangling
// pointer to the now destroyed threadpool!
nsCOMPtr<nsIThreadPool> pool = sThreadPool;
NS_IF_RELEASE(sThreadPool);
pool->Shutdown();
}
return NS_OK;
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:22,代码来源:WMFByteStream.cpp
示例2: Init
NS_IMETHODIMP nsRenderingContextPh :: Init( nsIDeviceContext* aContext, nsIWidget *aWindow )
{
nsresult res;
mContext = aContext;
NS_IF_ADDREF(mContext);
PtWidget_t *widget = (PtWidget_t*) aWindow->GetNativeData( NS_NATIVE_WIDGET );
if( !widget ) {
NS_IF_RELEASE( mContext ); // new
NS_ASSERTION(widget,"nsRenderingContext::Init (with a widget) widget is NULL!");
return NS_ERROR_FAILURE;
}
mRegionID = PtWidgetRid( widget );
if( mRegionID ) {
mSurface = new nsDrawingSurfacePh();
if( mSurface ) {
mGC = PgCreateGC( 0 );
mOwner = PR_TRUE;
/* use the dc you get by doing a PhDCSetCurrent( NULL ) */
res = mSurface->Init( _Ph_->dflt_draw_context, mGC );
if( res != NS_OK )
return NS_ERROR_FAILURE;
mOffscreenSurface = mSurface;
NS_ADDREF( mSurface );
mSurfaceDC = ((nsDrawingSurfacePh*)mSurface)->GetDC();
}
else
return NS_ERROR_FAILURE;
}
return CommonInit();
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:39,代码来源:nsRenderingContextPh.cpp
示例3: SupportedSocketTypesResponse
static void
SupportedSocketTypesResponse(TpProxy *proxy, const GValue *out,
const GError *error, gpointer user_data, GObject *weak_object)
{
csITpChannelTypeStreamTubeSupportedSocketTypesCB *callback = (csITpChannelTypeStreamTubeSupportedSocketTypesCB *)user_data;
if (!callback)
return;
if (error != NULL) {
callback->GetPropertySupportedSocketTypesError(nsDependentCString(g_quark_to_string(error->domain)),
error->code, nsDependentCString(error->message));
return;
}
GHashTable * supportedsockettypes;
supportedsockettypes = (GHashTable *)g_value_get_boxed(out);
nsCOMPtr<nsIArray> cSupportedSocketTypes;
csTpSupportedSocketMap::Create((gpointer)supportedsockettypes, getter_AddRefs(cSupportedSocketTypes));
callback->GetPropertySupportedSocketTypesDone(cSupportedSocketTypes);
NS_IF_RELEASE(callback);
}
开发者ID:psunkari,项目名称:spicebird,代码行数:22,代码来源:csTpChannelTypeStreamTube.cpp
示例4: HandleOwnersResponse
static void
HandleOwnersResponse(TpProxy *proxy, const GValue *out,
const GError *error, gpointer user_data, GObject *weak_object)
{
csITpChannelInterfaceGroupHandleOwnersCB *callback = (csITpChannelInterfaceGroupHandleOwnersCB *)user_data;
if (!callback)
return;
if (error != NULL) {
callback->GetPropertyHandleOwnersError(nsDependentCString(g_quark_to_string(error->domain)),
error->code, nsDependentCString(error->message));
return;
}
GHashTable * handleowners;
handleowners = (GHashTable *)g_value_get_boxed(out);
nsCOMPtr<nsIArray> cHandleOwners;
csTpHandleOwnerMap::Create((gpointer)handleowners, getter_AddRefs(cHandleOwners));
callback->GetPropertyHandleOwnersDone(cHandleOwners);
NS_IF_RELEASE(callback);
}
开发者ID:psunkari,项目名称:spicebird,代码行数:22,代码来源:csTpChannelInterfaceGroup.cpp
示例5: LocationAccessControlResponse
static void
LocationAccessControlResponse(TpProxy *proxy, const GValue *out,
const GError *error, gpointer user_data, GObject *weak_object)
{
csITpConnectionInterfaceLocationLocationAccessControlCB *callback = (csITpConnectionInterfaceLocationLocationAccessControlCB *)user_data;
if (!callback)
return;
if (error != NULL) {
callback->GetPropertyLocationAccessControlError(nsDependentCString(g_quark_to_string(error->domain)),
error->code, nsDependentCString(error->message));
return;
}
GValueArray * locationaccesscontrol;
locationaccesscontrol = (GValueArray *)g_value_get_boxed(out);
nsCOMPtr<csITpRichPresenceAccessControl> cLocationAccessControl;
csTpRichPresenceAccessControl::Create((gpointer)locationaccesscontrol, getter_AddRefs(cLocationAccessControl));
callback->GetPropertyLocationAccessControlDone(cLocationAccessControl);
NS_IF_RELEASE(callback);
}
开发者ID:psunkari,项目名称:spicebird,代码行数:22,代码来源:csTpConnectionInterfaceLocation.cpp
示例6: GetAvailableTubeTypesResponse
static void
GetAvailableTubeTypesResponse(TpChannel *proxy,
const GArray *available_tube_types,
const GError *error, gpointer user_data, GObject *weak_object)
{
csITpChannelTypeTubesGetAvailableTubeTypesCB *callback = (csITpChannelTypeTubesGetAvailableTubeTypesCB *)user_data;
if (!callback)
return;
if (error != NULL) {
callback->OnGetAvailableTubeTypesError(nsDependentCString(g_quark_to_string(error->domain)),
error->code, nsDependentCString(error->message));
return;
}
PRUint32 cAvailableTubeTypesCount = available_tube_types->len;
PRUint32 *cAvailableTubeTypes = (PRUint32 *)nsMemory::Alloc(sizeof(PRUint32)*cAvailableTubeTypesCount);
for (unsigned int i=0; i<cAvailableTubeTypesCount; i++)
cAvailableTubeTypes[i] = g_array_index(available_tube_types, guint, i);
callback->OnGetAvailableTubeTypesDone(cAvailableTubeTypesCount, cAvailableTubeTypes);
NS_IF_RELEASE(callback);
}
开发者ID:psunkari,项目名称:spicebird,代码行数:23,代码来源:csTpChannelTypeTubes.cpp
示例7: SetFont
NS_IMETHODIMP nsRenderingContextPh :: SetFont( nsIFontMetrics *aFontMetrics )
{
if( mFontMetrics == aFontMetrics ) return NS_OK;
nsFontHandle fontHandle; /* really a nsString */
char *pFontHandle;
NS_IF_RELEASE(mFontMetrics);
mFontMetrics = aFontMetrics;
NS_IF_ADDREF(mFontMetrics);
if( mFontMetrics == nsnull ) return NS_OK;
mFontMetrics->GetFontHandle( fontHandle );
pFontHandle = (char *) fontHandle;
if( pFontHandle ) {
if( mPhotonFontName ) free( mPhotonFontName );
mPhotonFontName = strdup( pFontHandle );
}
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:23,代码来源:nsRenderingContextPh.cpp
示例8: NS_IF_RELEASE
void
nsTreeSanitizer::ReleaseStatics()
{
delete sElementsHTML;
sElementsHTML = nsnull;
delete sAttributesHTML;
sAttributesHTML = nsnull;
delete sElementsSVG;
sElementsSVG = nsnull;
delete sAttributesSVG;
sAttributesSVG = nsnull;
delete sElementsMathML;
sElementsMathML = nsnull;
delete sAttributesMathML;
sAttributesMathML = nsnull;
NS_IF_RELEASE(sNullPrincipal);
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:23,代码来源:nsTreeSanitizer.cpp
示例9: GetRemotePendingMembersResponse
static void
GetRemotePendingMembersResponse(TpChannel *proxy,
const GArray *handles,
const GError *error, gpointer user_data, GObject *weak_object)
{
csITpChannelInterfaceGroupGetRemotePendingMembersCB *callback = (csITpChannelInterfaceGroupGetRemotePendingMembersCB *)user_data;
if (!callback)
return;
if (error != NULL) {
callback->OnGetRemotePendingMembersError(nsDependentCString(g_quark_to_string(error->domain)),
error->code, nsDependentCString(error->message));
return;
}
PRUint32 cHandlesCount = handles->len;
PRUint32 *cHandles = (PRUint32 *)nsMemory::Alloc(sizeof(PRUint32)*cHandlesCount);
for (unsigned int i=0; i<cHandlesCount; i++)
cHandles[i] = g_array_index(handles, guint, i);
callback->OnGetRemotePendingMembersDone(cHandlesCount, cHandles);
NS_IF_RELEASE(callback);
}
开发者ID:psunkari,项目名称:spicebird,代码行数:23,代码来源:csTpChannelInterfaceGroup.cpp
示例10: NS_ADDREF
NS_IMETHODIMP nsWidget::DispatchEvent( nsGUIEvent *aEvent, nsEventStatus &aStatus ) {
NS_ADDREF(aEvent->widget);
if( nsnull != mMenuListener ) {
if( NS_MENU_EVENT == aEvent->eventStructType )
aStatus = mMenuListener->MenuSelected(NS_STATIC_CAST(nsMenuEvent&, *aEvent));
}
aStatus = nsEventStatus_eIgnore;
///* ATENTIE */ printf( "mEventCallback call (%d %d) this=%p\n", aEvent->point.x, aEvent->point.y, this );
if( nsnull != mEventCallback ) aStatus = (*mEventCallback)(aEvent);
// Dispatch to event listener if event was not consumed
if( (aStatus != nsEventStatus_eIgnore) && (nsnull != mEventListener) )
aStatus = mEventListener->ProcessEvent(*aEvent);
NS_IF_RELEASE(aEvent->widget);
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:23,代码来源:nsWidget.cpp
示例11: GetServerByIdentity
NS_IMETHODIMP nsSmtpService::SendMailMessage(nsIFile * aFilePath,
const char * aRecipients,
nsIMsgIdentity * aSenderIdentity,
const char * aPassword,
nsIUrlListener * aUrlListener,
nsIMsgStatusFeedback *aStatusFeedback,
nsIInterfaceRequestor* aNotificationCallbacks,
bool aRequestDSN,
nsIURI ** aURL,
nsIRequest ** aRequest)
{
nsIURI * urlToRun = nullptr;
nsresult rv = NS_OK;
nsCOMPtr<nsISmtpServer> smtpServer;
rv = GetServerByIdentity(aSenderIdentity, getter_AddRefs(smtpServer));
if (NS_SUCCEEDED(rv) && smtpServer)
{
if (aPassword && *aPassword)
smtpServer->SetPassword(nsDependentCString(aPassword));
// this ref counts urlToRun
rv = NS_MsgBuildSmtpUrl(aFilePath, smtpServer, aRecipients, aSenderIdentity,
aUrlListener, aStatusFeedback,
aNotificationCallbacks, &urlToRun, aRequestDSN);
if (NS_SUCCEEDED(rv) && urlToRun)
rv = NS_MsgLoadSmtpUrl(urlToRun, nullptr, aRequest);
if (aURL) // does the caller want a handle on the url?
*aURL = urlToRun; // transfer our ref count to the caller....
else
NS_IF_RELEASE(urlToRun);
}
return rv;
}
开发者ID:SphereWeb,项目名称:releases-comm-central,代码行数:37,代码来源:nsSmtpService.cpp
示例12: MOZ_COUNT_DTOR
txExecutionState::~txExecutionState()
{
MOZ_COUNT_DTOR(txExecutionState);
delete mResultHandler;
delete mLocalVariables;
delete mEvalContext;
PRInt32 i;
for (i = 0; i < mTemplateRuleCount; ++i) {
NS_IF_RELEASE(mTemplateRules[i].mModeLocalName);
}
delete [] mTemplateRules;
txStackIterator varsIter(&mLocalVarsStack);
while (varsIter.hasNext()) {
delete (txVariableMap*)varsIter.next();
}
txStackIterator contextIter(&mEvalContextStack);
while (contextIter.hasNext()) {
txIEvalContext* context = (txIEvalContext*)contextIter.next();
if (context != mInitialEvalContext) {
delete context;
}
}
txStackIterator handlerIter(&mResultHandlerStack);
while (handlerIter.hasNext()) {
delete (txAXMLEventHandler*)handlerIter.next();
}
txStackIterator paramIter(&mParamStack);
while (paramIter.hasNext()) {
delete (txVariableMap*)paramIter.next();
}
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:37,代码来源:txExecutionState.cpp
示例13: NS_IF_RELEASE
nsresult nsAbView::RemoveCardAt(PRInt32 row)
{
nsresult rv;
AbCard *abcard = (AbCard*) (mCards.ElementAt(row));
NS_IF_RELEASE(abcard->card);
mCards.RemoveElementAt(row);
PR_FREEIF(abcard->primaryCollationKey);
PR_FREEIF(abcard->secondaryCollationKey);
PR_FREEIF(abcard);
// This needs to happen after we remove the card, as RowCountChanged() will call GetRowCount()
if (mTree) {
rv = mTree->RowCountChanged(row, -1);
NS_ENSURE_SUCCESS(rv,rv);
}
if (mAbViewListener && !mSuppressCountChange) {
rv = mAbViewListener->OnCountChanged(mCards.Count());
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
开发者ID:vanto,项目名称:comm-central,代码行数:24,代码来源:nsAbView.cpp
示例14: RemotePendingMembersResponse
static void
RemotePendingMembersResponse(TpProxy *proxy, const GValue *out,
const GError *error, gpointer user_data, GObject *weak_object)
{
csITpChannelInterfaceGroupRemotePendingMembersCB *callback = (csITpChannelInterfaceGroupRemotePendingMembersCB *)user_data;
if (!callback)
return;
if (error != NULL) {
callback->GetPropertyRemotePendingMembersError(nsDependentCString(g_quark_to_string(error->domain)),
error->code, nsDependentCString(error->message));
return;
}
GArray * remotependingmembers;
remotependingmembers = (GArray *)g_value_get_boxed(out);
PRUint32 cRemotePendingMembersCount = remotependingmembers->len;
PRUint32 *cRemotePendingMembers = (PRUint32 *)nsMemory::Alloc(sizeof(PRUint32)*cRemotePendingMembersCount);
for (unsigned int i=0; i<cRemotePendingMembersCount; i++)
cRemotePendingMembers[i] = g_array_index(remotependingmembers, guint, i);
callback->GetPropertyRemotePendingMembersDone(cRemotePendingMembersCount, cRemotePendingMembers);
NS_IF_RELEASE(callback);
}
开发者ID:psunkari,项目名称:spicebird,代码行数:24,代码来源:csTpChannelInterfaceGroup.cpp
示例15: IMPORT_LOG0
nsresult MailEwsMsgCompose::CreateComponents(void)
{
nsresult rv = NS_OK;
if (!m_pIOService) {
IMPORT_LOG0("Creating nsIOService\n");
m_pIOService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
NS_IF_RELEASE(m_pMsgFields);
if (NS_SUCCEEDED(rv)) {
rv = CallCreateInstance(kMsgCompFieldsCID, &m_pMsgFields);
if (NS_SUCCEEDED(rv) && m_pMsgFields) {
IMPORT_LOG0("nsOutlookCompose - CreateComponents succeeded\n");
m_pMsgFields->SetForcePlainText(false);
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
开发者ID:stonewell,项目名称:exchange-ews-thunderbird,代码行数:24,代码来源:MailEwsMsgUtils.cpp
示例16: LocationAccessControlTypesResponse
static void
LocationAccessControlTypesResponse(TpProxy *proxy, const GValue *out,
const GError *error, gpointer user_data, GObject *weak_object)
{
csITpConnectionInterfaceLocationLocationAccessControlTypesCB *callback = (csITpConnectionInterfaceLocationLocationAccessControlTypesCB *)user_data;
if (!callback)
return;
if (error != NULL) {
callback->GetPropertyLocationAccessControlTypesError(nsDependentCString(g_quark_to_string(error->domain)),
error->code, nsDependentCString(error->message));
return;
}
GArray * locationaccesscontroltypes;
locationaccesscontroltypes = (GArray *)g_value_get_boxed(out);
PRUint32 cLocationAccessControlTypesCount = locationaccesscontroltypes->len;
PRUint32 *cLocationAccessControlTypes = (PRUint32 *)nsMemory::Alloc(sizeof(PRUint32)*cLocationAccessControlTypesCount);
for (unsigned int i=0; i<cLocationAccessControlTypesCount; i++)
cLocationAccessControlTypes[i] = g_array_index(locationaccesscontroltypes, guint, i);
callback->GetPropertyLocationAccessControlTypesDone(cLocationAccessControlTypesCount, cLocationAccessControlTypes);
NS_IF_RELEASE(callback);
}
开发者ID:psunkari,项目名称:spicebird,代码行数:24,代码来源:csTpConnectionInterfaceLocation.cpp
示例17: ShutdownXPCOM
nsresult
ShutdownXPCOM(nsIServiceManager* servMgr)
{
// Make sure the hang monitor is enabled for shutdown.
HangMonitor::NotifyActivity();
NS_ENSURE_STATE(NS_IsMainThread());
nsresult rv;
nsCOMPtr<nsISimpleEnumerator> moduleLoaders;
// Notify observers of xpcom shutting down
{
// Block it so that the COMPtr will get deleted before we hit
// servicemanager shutdown
nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
NS_ENSURE_STATE(thread);
nsRefPtr<nsObserverService> observerService;
CallGetService("@mozilla.org/observer-service;1",
(nsObserverService**) getter_AddRefs(observerService));
if (observerService)
{
(void) observerService->
NotifyObservers(nullptr, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID,
nullptr);
nsCOMPtr<nsIServiceManager> mgr;
rv = NS_GetServiceManager(getter_AddRefs(mgr));
if (NS_SUCCEEDED(rv))
{
(void) observerService->
NotifyObservers(mgr, NS_XPCOM_SHUTDOWN_OBSERVER_ID,
nullptr);
}
}
NS_ProcessPendingEvents(thread);
mozilla::scache::StartupCache::DeleteSingleton();
if (observerService)
(void) observerService->
NotifyObservers(nullptr, NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID,
nullptr);
nsCycleCollector_shutdownThreads();
NS_ProcessPendingEvents(thread);
// Shutdown the timer thread and all timers that might still be alive before
// shutting down the component manager
nsTimerImpl::Shutdown();
NS_ProcessPendingEvents(thread);
// Shutdown all remaining threads. This method does not return until
// all threads created using the thread manager (with the exception of
// the main thread) have exited.
nsThreadManager::get()->Shutdown();
NS_ProcessPendingEvents(thread);
HangMonitor::NotifyActivity();
// We save the "xpcom-shutdown-loaders" observers to notify after
// the observerservice is gone.
if (observerService) {
observerService->
EnumerateObservers(NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID,
getter_AddRefs(moduleLoaders));
observerService->Shutdown();
}
}
// Free ClearOnShutdown()'ed smart pointers. This needs to happen *after*
// we've finished notifying observers of XPCOM shutdown, because shutdown
// observers themselves might call ClearOnShutdown().
mozilla::KillClearOnShutdown();
// XPCOM is officially in shutdown mode NOW
// Set this only after the observers have been notified as this
// will cause servicemanager to become inaccessible.
mozilla::services::Shutdown();
#ifdef DEBUG_dougt
fprintf(stderr, "* * * * XPCOM shutdown. Access will be denied * * * * \n");
#endif
// We may have AddRef'd for the caller of NS_InitXPCOM, so release it
// here again:
NS_IF_RELEASE(servMgr);
// Shutdown global servicemanager
if (nsComponentManagerImpl::gComponentManager) {
nsComponentManagerImpl::gComponentManager->FreeServices();
}
// Release the directory service
NS_IF_RELEASE(nsDirectoryService::gService);
//.........这里部分代码省略.........
开发者ID:hideakihata,项目名称:mozilla-central.fgv,代码行数:101,代码来源:nsXPComInit.cpp
示例18: NS_IF_RELEASE
/*static*/ void
nsStackLayout::Shutdown()
{
NS_IF_RELEASE(gInstance);
}
开发者ID:ahadzi,项目名称:celtx,代码行数:5,代码来源:nsStackLayout.cpp
示例19: NS_IF_RELEASE
void
nsHttpTransaction::SetConnection(nsAHttpConnection *conn)
{
NS_IF_RELEASE(mConnection);
NS_IF_ADDREF(mConnection = conn);
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:6,代码来源:nsHttpTransaction.cpp
示例20: NS_IF_RELEASE
/* static */ void
nsBox::Shutdown()
{
gGotTheme = PR_FALSE;
NS_IF_RELEASE(gTheme);
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:6,代码来源:nsBox.cpp
注:本文中的NS_IF_RELEASE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论