本文整理汇总了C++中NS_WARN_IF_FALSE函数的典型用法代码示例。如果您正苦于以下问题:C++ NS_WARN_IF_FALSE函数的具体用法?C++ NS_WARN_IF_FALSE怎么用?C++ NS_WARN_IF_FALSE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NS_WARN_IF_FALSE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
}
示例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");
}
}
示例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");
}
示例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);
}
}
示例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;
}
示例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());
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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.");
};
示例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;
}
示例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;
}