本文整理汇总了C++中NS_WARN_IF_FALSE函数的典型用法代码示例。如果您正苦于以下问题:C++ NS_WARN_IF_FALSE函数的具体用法?C++ NS_WARN_IF_FALSE怎么用?C++ NS_WARN_IF_FALSE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NS_WARN_IF_FALSE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: MOZ_ASSERT
void
nsSpeechTask::Cancel()
{
MOZ_ASSERT(XRE_IsParentProcess());
LOG(LogLevel::Debug, ("nsSpeechTask::Cancel"));
if (mCallback) {
DebugOnly<nsresult> rv = mCallback->OnCancel();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Unable to call onCancel() callback");
}
if (mStream) {
mStream->ChangeExplicitBlockerCount(1);
DispatchEndImpl(GetCurrentTime(), GetCurrentCharOffset());
}
}
开发者ID:Bouh,项目名称:gecko-dev,代码行数:17,代码来源:nsSpeechTask.cpp
示例2: FindFirstSelectedCase
void
nsXFormsSwitchElement::Init(nsIDOMElement* aDeselected)
{
nsCOMPtr<nsIDOMElement> firstCase = FindFirstSelectedCase(aDeselected);
mSelected = firstCase;
nsCOMPtr<nsIXFormsCaseElement> selected(do_QueryInterface(mSelected));
if (selected) {
nsresult rv = selected->SetSelected(PR_TRUE);
// it is ok to fail if Init is called during the initialization phase since
// XBL might not have attached on the xf:case, yet.
// nsXFormsCaseElement::SetSelected will fail if it cannot QI the case
// element to nsIXFormsCaseElementUI.
NS_WARN_IF_FALSE(mAddingChildren || NS_SUCCEEDED(rv),
"Failed to select case");
}
}
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:17,代码来源:nsXFormsSwitchElement.cpp
示例3: while
// helper to get the presentation data of a frame, by possibly walking up
// the frame hierarchy if we happen to be surrounded by non-MathML frames.
/* static */ void
nsMathMLFrame::GetPresentationDataFrom(nsIFrame* aFrame,
nsPresentationData& aPresentationData,
bool aClimbTree)
{
// initialize OUT params
aPresentationData.flags = 0;
aPresentationData.baseFrame = nullptr;
aPresentationData.mstyle = nullptr;
nsIFrame* frame = aFrame;
while (frame) {
if (frame->IsFrameOfType(nsIFrame::eMathML)) {
nsIMathMLFrame* mathMLFrame = do_QueryFrame(frame);
if (mathMLFrame) {
mathMLFrame->GetPresentationData(aPresentationData);
break;
}
}
// stop if the caller doesn't want to lookup beyond the frame
if (!aClimbTree) {
break;
}
// stop if we reach the root <math> tag
nsIContent* content = frame->GetContent();
NS_ASSERTION(content || !frame->GetParent(), // no assert for the root
"dangling frame without a content node");
if (!content)
break;
if (content->Tag() == nsGkAtoms::math) {
const nsStyleDisplay* display = frame->GetStyleDisplay();
if (display->mDisplay == NS_STYLE_DISPLAY_BLOCK) {
aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
}
FindAttrDisplaystyle(content, aPresentationData);
FindAttrDirectionality(content, aPresentationData);
aPresentationData.mstyle = frame->GetFirstContinuation();
break;
}
frame = frame->GetParent();
}
NS_WARN_IF_FALSE(frame && frame->GetContent(),
"bad MathML markup - could not find the top <math> element");
}
开发者ID:jraff,项目名称:mozilla-central,代码行数:47,代码来源:nsMathMLFrame.cpp
示例4: NS_WARN_IF_FALSE
void
RPCChannel::DumpRPCStack(const char* const pfx) const
{
NS_WARN_IF_FALSE(MessageLoop::current() != mWorkerLoop,
"The worker thread had better be paused in a debugger!");
printf_stderr("%sRPCChannel 'backtrace':\n", pfx);
// print a python-style backtrace, first frame to last
for (uint32_t i = 0; i < mCxxStackFrames.size(); ++i) {
int32_t id;
const char* dir, *sems, *name;
mCxxStackFrames[i].Describe(&id, &dir, &sems, &name);
printf_stderr("%s[(%u) %s %s %s(actor=%d) ]\n", pfx,
i, dir, sems, name, id);
}
}
开发者ID:matyapiro31,项目名称:instantbird-1.5,代码行数:18,代码来源:RPCChannel.cpp
示例5: InitTabChildGlobal
nsresult
nsInProcessTabChildGlobal::Init()
{
#ifdef DEBUG
nsresult rv =
#endif
InitTabChildGlobal();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Couldn't initialize nsInProcessTabChildGlobal");
mMessageManager = new nsFrameMessageManager(PR_FALSE,
SendSyncMessageToParent,
SendAsyncMessageToParent,
nsnull,
this,
nsnull,
mCx);
return NS_OK;
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:18,代码来源:nsInProcessTabChildGlobal.cpp
示例6: MOZ_ASSERT
void
nsSpeechTask::Cancel()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
LOG(PR_LOG_DEBUG, ("nsSpeechTask::Cancel"));
if (mCallback) {
DebugOnly<nsresult> rv = mCallback->OnCancel();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Unable to call onCancel() callback");
}
if (mStream) {
mStream->ChangeExplicitBlockerCount(1);
}
DispatchEndImpl(GetCurrentTime(), GetCurrentCharOffset());
}
开发者ID:Balakrishnan-Vivek,项目名称:gecko-dev,代码行数:18,代码来源:nsSpeechTask.cpp
示例7: NS_WARN_IF_FALSE
nsresult
nsQueryInterfaceWithError::operator()( const nsIID& aIID, void** answer ) const
{
nsresult status;
if ( mRawPtr )
{
status = mRawPtr->QueryInterface(aIID, answer);
#ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?");
#endif
}
else
status = NS_ERROR_NULL_POINTER;
if ( mErrorPtr )
*mErrorPtr = status;
return status;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:18,代码来源:nsCOMPtr.cpp
示例8: LOG
void
nsSynthVoiceRegistry::Speak(const nsAString& aText,
const nsAString& aLang,
const nsAString& aUri,
const float& aVolume,
const float& aRate,
const float& aPitch,
nsSpeechTask* aTask)
{
LOG(LogLevel::Debug,
("nsSynthVoiceRegistry::Speak text='%s' lang='%s' uri='%s' rate=%f pitch=%f",
NS_ConvertUTF16toUTF8(aText).get(), NS_ConvertUTF16toUTF8(aLang).get(),
NS_ConvertUTF16toUTF8(aUri).get(), aRate, aPitch));
VoiceData* voice = FindBestMatch(aUri, aLang);
if (!voice) {
NS_WARNING("No voices found.");
aTask->DispatchError(0, 0);
return;
}
aTask->SetChosenVoiceURI(voice->mUri);
LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::Speak - Using voice URI: %s",
NS_ConvertUTF16toUTF8(voice->mUri).get()));
SpeechServiceType serviceType;
DebugOnly<nsresult> rv = voice->mService->GetServiceType(&serviceType);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to get speech service type");
if (serviceType == nsISpeechService::SERVICETYPE_INDIRECT_AUDIO) {
aTask->SetIndirectAudio(true);
} else {
if (!mStream) {
mStream = MediaStreamGraph::GetInstance()->CreateTrackUnionStream(nullptr);
}
aTask->BindStream(mStream);
}
voice->mService->Speak(aText, voice->mUri, aVolume, aRate, aPitch, aTask);
}
开发者ID:miketaylr,项目名称:gecko-dev,代码行数:43,代码来源:nsSynthVoiceRegistry.cpp
示例9: NS_ENSURE_SUCCESS
nsresult
LookupCache::WriteFile()
{
nsCOMPtr<nsIFile> storeFile;
nsresult rv = mStoreDirectory->Clone(getter_AddRefs(storeFile));
NS_ENSURE_SUCCESS(rv, rv);
rv = storeFile->AppendNative(mTableName + NS_LITERAL_CSTRING(CACHE_SUFFIX));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIOutputStream> out;
rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(out), storeFile,
PR_WRONLY | PR_TRUNCATE | PR_CREATE_FILE);
NS_ENSURE_SUCCESS(rv, rv);
UpdateHeader();
LOG(("Writing %d completions", mHeader.numCompletions));
uint32_t written;
rv = out->Write(reinterpret_cast<char*>(&mHeader), sizeof(mHeader), &written);
NS_ENSURE_SUCCESS(rv, rv);
rv = WriteTArray(out, mCompletions);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISafeOutputStream> safeOut = do_QueryInterface(out);
rv = safeOut->Finish();
NS_ENSURE_SUCCESS(rv, rv);
rv = EnsureSizeConsistent();
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFile> psFile;
rv = mStoreDirectory->Clone(getter_AddRefs(psFile));
NS_ENSURE_SUCCESS(rv, rv);
rv = psFile->AppendNative(mTableName + NS_LITERAL_CSTRING(PREFIXSET_SUFFIX));
NS_ENSURE_SUCCESS(rv, rv);
rv = mPrefixSet->StoreToFile(psFile);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "failed to store the prefixset");
return NS_OK;
}
开发者ID:afabbro,项目名称:gecko-dev,代码行数:43,代码来源:LookupCache.cpp
示例10: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
sbMockCDService::NotifyEject(sbICDDevice *aCDDevice)
{
NS_ENSURE_ARG_POINTER(aCDDevice);
// Ensure that a mock CD device was removed.
nsresult rv;
nsCOMPtr<sbIMockCDDevice> mockDevice = do_QueryInterface(aCDDevice, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// Inform the listeners
for (PRInt32 i = 0; i < mListeners.Count(); i++) {
rv = mListeners[i]->OnMediaEjected(aCDDevice);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Could not inform the listener of media eject!");
}
return NS_OK;
}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:19,代码来源:sbMockCDDevice.cpp
示例11: GetCurrentDoc
NS_IMETHODIMP
nsXTFElementWrapper::SetIntrinsicState(nsEventStates::InternalType aNewState)
{
nsIDocument *doc = GetCurrentDoc();
nsEventStates newStates(aNewState);
nsEventStates bits = mIntrinsicState ^ newStates;
if (!doc || bits.IsEmpty())
return NS_OK;
NS_WARN_IF_FALSE(!newStates.HasAllStates(NS_EVENT_STATE_MOZ_READONLY |
NS_EVENT_STATE_MOZ_READWRITE),
"Both READONLY and READWRITE are being set. Yikes!!!");
mIntrinsicState = newStates;
mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
doc->ContentStateChanged(this, bits);
return NS_OK;
}
开发者ID:nikhilm,项目名称:v8monkey,代码行数:20,代码来源:nsXTFElementWrapper.cpp
示例12: while
/**
* Place below-current-line floats.
*/
PRBool
nsBlockReflowState::PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aList, PRBool aForceFit)
{
nsFloatCache* fc = aList.Head();
while (fc) {
{
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("placing bcl float: ");
nsFrame::ListTag(stdout, fc->mFloat);
printf("\n");
}
#endif
// Place the float
nsReflowStatus reflowStatus;
PRBool placed = FlowAndPlaceFloat(fc->mFloat, reflowStatus, aForceFit);
NS_ASSERTION(placed || !aForceFit,
"If we're in force-fit mode, we should have placed the float");
if (!placed || (NS_FRAME_IS_TRUNCATED(reflowStatus) && !aForceFit)) {
// return before processing all of the floats, since the line will be pushed.
return PR_FALSE;
}
else if (!NS_FRAME_IS_FULLY_COMPLETE(reflowStatus)) {
// Create a continuation for the incomplete float
nsresult rv = mBlock->SplitFloat(*this, fc->mFloat, reflowStatus);
if (NS_FAILED(rv))
return PR_FALSE;
} else {
// XXX We could deal with truncated frames better by breaking before
// the associated placeholder
NS_WARN_IF_FALSE(!NS_FRAME_IS_TRUNCATED(reflowStatus),
"This situation currently leads to data not printing");
// Float is complete.
}
}
fc = fc->Next();
}
return PR_TRUE;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:44,代码来源:nsBlockReflowState.cpp
示例13: NS_WARNING
void
AudioCallbackDriver::MixerCallback(AudioDataValue* aMixedBuffer,
AudioSampleFormat aFormat,
uint32_t aChannels,
uint32_t aFrames,
uint32_t aSampleRate)
{
uint32_t toWrite = mBuffer.Available();
if (!mBuffer.Available()) {
NS_WARNING("DataCallback buffer full, expect frame drops.");
}
MOZ_ASSERT(mBuffer.Available() <= aFrames);
mBuffer.WriteFrames(aMixedBuffer, mBuffer.Available());
MOZ_ASSERT(mBuffer.Available() == 0, "Missing frames to fill audio callback's buffer.");
DebugOnly<uint32_t> written = mScratchBuffer.Fill(aMixedBuffer + toWrite * aChannels, aFrames - toWrite);
NS_WARN_IF_FALSE(written == aFrames - toWrite, "Dropping frames.");
};
开发者ID:bitwiseworks,项目名称:mozilla-os2,代码行数:21,代码来源:GraphDriver.cpp
示例14: NS_ENSURE_ARG_POINTER
nsresult
sbDeviceFirmwareUpdater::PutRunningHandler(sbIDevice *aDevice,
sbIDeviceFirmwareHandler *aHandler)
{
NS_ENSURE_ARG_POINTER(aDevice);
NS_ENSURE_ARG_POINTER(aHandler);
nsCOMPtr<sbIDeviceFirmwareHandler> handler;
if(!mRunningHandlers.Get(aDevice, getter_AddRefs(handler))) {
PRBool success = mRunningHandlers.Put(aDevice, aHandler);
NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
}
#if defined PR_LOGGING
else {
NS_WARN_IF_FALSE(handler == aHandler,
"Attempting to replace a running firmware handler!");
}
#endif
return NS_OK;
}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:21,代码来源:sbDeviceFirmwareUpdater.cpp
示例15: NS_ENSURE_TRUE
// nsISimpleEnumerator implementation
NS_IMETHODIMP
sbMediaListEnumeratorWrapper::HasMoreElements(bool *aMore)
{
NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
NS_ENSURE_TRUE(mEnumerator, NS_ERROR_NOT_INITIALIZED);
nsAutoMonitor mon(mMonitor);
nsresult rv = mEnumerator->HasMoreElements(aMore);
NS_ENSURE_SUCCESS(rv, rv);
if(mListener) {
nsCOMPtr<nsISimpleEnumerator> grip(mEnumerator);
nsCOMPtr<sbIMediaListEnumeratorWrapperListener> listener(mListener);
mon.Exit();
rv = listener->OnHasMoreElements(grip, *aMore);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "onHasMoreElements returned an error");
}
return NS_OK;
}
开发者ID:Brijen,项目名称:nightingale-hacking,代码行数:22,代码来源:sbMediaListEnumeratorWrapper.cpp
示例16: MOZ_ASSERT
void
nsSpeechTask::Pause()
{
MOZ_ASSERT(XRE_IsParentProcess());
if (mCallback) {
DebugOnly<nsresult> rv = mCallback->OnPause();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Unable to call onPause() callback");
}
if (mStream) {
mStream->Suspend();
}
if (!mInited) {
mPrePaused = true;
}
if (!mIndirectAudio) {
DispatchPauseImpl(GetCurrentTime(), GetCurrentCharOffset());
}
}
开发者ID:kapeels,项目名称:gecko-dev,代码行数:22,代码来源:nsSpeechTask.cpp
示例17: GetReferencedGradient
PRInt32
nsSVGGradientFrame::GetStopFrame(PRInt32 aIndex, nsIFrame * *aStopFrame)
{
PRInt32 stopCount = 0;
nsIFrame *stopFrame = nsnull;
for (stopFrame = mFrames.FirstChild(); stopFrame;
stopFrame = stopFrame->GetNextSibling()) {
if (stopFrame->GetType() == nsGkAtoms::svgStopFrame) {
// Is this the one we're looking for?
if (stopCount++ == aIndex)
break; // Yes, break out of the loop
}
}
if (stopCount > 0) {
if (aStopFrame)
*aStopFrame = stopFrame;
return stopCount;
}
// Our gradient element doesn't have stops - try to "inherit" them
nsSVGGradientFrame *next = GetReferencedGradient();
if (!next) {
if (aStopFrame)
*aStopFrame = nsnull;
return 0;
}
// Set mLoopFlag before checking mNextGrad->mLoopFlag in case we are mNextGrad
mLoopFlag = PR_TRUE;
// XXXjwatt: we should really send an error to the JavaScript Console here:
NS_WARN_IF_FALSE(!next->mLoopFlag, "gradient reference loop detected "
"while inheriting stop!");
if (!next->mLoopFlag)
stopCount = next->GetStopFrame(aIndex, aStopFrame);
mLoopFlag = PR_FALSE;
return stopCount;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:39,代码来源:nsSVGGradientFrame.cpp
示例18: NS_ASSERTION
void
nsDOMWorkerScriptLoader::Cancel()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(!mCanceled, "Cancel called more than once!");
mCanceled = PR_TRUE;
for (PRUint32 index = 0; index < mScriptCount; index++) {
ScriptLoadInfo& loadInfo = mLoadInfos[index];
nsIRequest* request =
static_cast<nsIRequest*>(loadInfo.channel.get());
if (request) {
#ifdef DEBUG
nsresult rv =
#endif
request->Cancel(NS_BINDING_ABORTED);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to cancel channel!");
}
}
nsAutoTArray<ScriptLoaderRunnable*, 10> runnables;
{
nsAutoLock lock(mWorker->Lock());
runnables.AppendElements(mPendingRunnables);
mPendingRunnables.Clear();
}
PRUint32 runnableCount = runnables.Length();
for (PRUint32 index = 0; index < runnableCount; index++) {
runnables[index]->Revoke();
}
// We're about to post a revoked event to the worker thread, which seems
// silly, but we have to do this because the worker thread may be sleeping
// waiting on its event queue.
NotifyDone();
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:39,代码来源:nsDOMWorkerScriptLoader.cpp
示例19: LOG
// ----------------------------------------------------------------------------
// nsIObserver
// ----------------------------------------------------------------------------
NS_IMETHODIMP
sbDeviceFirmwareUpdater::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aData)
{
LOG(("[sbDeviceFirmwareUpdater] - Observe: %s", this, aTopic));
nsresult rv;
nsCOMPtr<nsIObserverService> observerService =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
if (strcmp(aTopic, SB_LIBRARY_MANAGER_SHUTDOWN_TOPIC) == 0) {
rv = observerService->RemoveObserver(this, SB_LIBRARY_MANAGER_SHUTDOWN_TOPIC);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to remove shutdown observer");
rv = Shutdown();
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:25,代码来源:sbDeviceFirmwareUpdater.cpp
示例20: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
sbWindowMoveService::StartWatchingWindow(nsISupports *aWindow,
sbIWindowMoveListener *aListener)
{
NS_ENSURE_ARG_POINTER(aWindow);
NS_ENSURE_ARG_POINTER(aListener);
NS_WARN_IF_FALSE(NS_IsMainThread(), "This service is MAIN THREAD ONLY!");
HWND windowHandle = NULL;
windowHandle = NativeWindowFromNode::get(aWindow);
NS_ENSURE_TRUE(windowHandle, NS_ERROR_INVALID_ARG);
// Already hooked. Can only hook once.
if(IsHooked(windowHandle)) {
NS_WARNING("Window already hooked. Can only hook a window once.");
return NS_OK;
}
BOOL success = ::SetPropW(windowHandle, PROP_WMS_INST, (HANDLE) this);
NS_ENSURE_TRUE(success != 0, NS_ERROR_UNEXPECTED);
HHOOK hookHandle = ::SetWindowsHookEx(WH_CALLWNDPROC,
sbWindowMoveService::CallWndProc,
NULL,
::GetCurrentThreadId());
NS_ENSURE_TRUE(hookHandle, NS_ERROR_FAILURE);
nsCOMPtr<sbIWindowMoveListener> listener(aListener);
mListeners.insert(
std::make_pair<HWND, nsCOMPtr<sbIWindowMoveListener> >(windowHandle,
listener));
mHooks.insert(std::make_pair<HWND, HHOOK>(windowHandle, hookHandle));
return NS_OK;
}
开发者ID:Brijen,项目名称:nightingale-hacking,代码行数:38,代码来源:sbWindowMoveService.cpp
注:本文中的NS_WARN_IF_FALSE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论