本文整理汇总了C++中MOZ_RELEASE_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ MOZ_RELEASE_ASSERT函数的具体用法?C++ MOZ_RELEASE_ASSERT怎么用?C++ MOZ_RELEASE_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MOZ_RELEASE_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MOZ_RELEASE_ASSERT
// The global is used to extract the principal.
already_AddRefed<InternalRequest> InternalRequest::GetRequestConstructorCopy(
nsIGlobalObject* aGlobal, ErrorResult& aRv) const {
MOZ_RELEASE_ASSERT(!mURLList.IsEmpty(),
"Internal Request's urlList should not be empty when "
"copied from constructor.");
RefPtr<InternalRequest> copy =
new InternalRequest(mURLList.LastElement(), mFragment);
copy->SetMethod(mMethod);
copy->mHeaders = new InternalHeaders(*mHeaders);
copy->SetUnsafeRequest();
copy->mBodyStream = mBodyStream;
copy->mBodyLength = mBodyLength;
// The "client" is not stored in our implementation. Fetch API users should
// use the appropriate window/document/principal and other Gecko security
// mechanisms as appropriate.
copy->mSameOriginDataURL = true;
copy->mPreserveContentCodings = true;
copy->mReferrer = mReferrer;
copy->mReferrerPolicy = mReferrerPolicy;
copy->mEnvironmentReferrerPolicy = mEnvironmentReferrerPolicy;
copy->mIntegrity = mIntegrity;
copy->mMozErrors = mMozErrors;
copy->mContentPolicyType = mContentPolicyTypeOverridden
? mContentPolicyType
: nsIContentPolicy::TYPE_FETCH;
copy->mMode = mMode;
copy->mCredentialsMode = mCredentialsMode;
copy->mCacheMode = mCacheMode;
copy->mRedirectMode = mRedirectMode;
copy->mCreatedByFetchEvent = mCreatedByFetchEvent;
copy->mContentPolicyTypeOverridden = mContentPolicyTypeOverridden;
copy->mPreferredAlternativeDataType = mPreferredAlternativeDataType;
return copy.forget();
}
示例2: TestScanUnsignedMax
static void
TestScanUnsignedMax()
{
Input<uintmax_t> u;
PoisonInput(u);
sscanf("14220563454333534", "%" SCNoMAX, &u.i);
MOZ_RELEASE_ASSERT(u.i == UINTMAX_C(432157943248732));
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("432157943248732", "%" SCNuMAX, &u.i);
MOZ_RELEASE_ASSERT(u.i == UINTMAX_C(432157943248732));
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("4c337ca791", "%" SCNxMAX, &u.i);
MOZ_RELEASE_ASSERT(u.i == UINTMAX_C(327281321873));
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
}
示例3: TestScanUnsigned64
static void
TestScanUnsigned64()
{
Input<uint64_t> u;
PoisonInput(u);
sscanf("17421742173", "%" SCNo64, &u.i);
MOZ_RELEASE_ASSERT(u.i == UINT64_C(017421742173));
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("421786713579", "%" SCNu64, &u.i);
MOZ_RELEASE_ASSERT(u.i == UINT64_C(421786713579));
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("DEADBEEF7457E", "%" SCNx64, &u.i);
MOZ_RELEASE_ASSERT(u.i == UINT64_C(0xDEADBEEF7457E));
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
}
示例4: TestScanUnsigned32
static void
TestScanUnsigned32()
{
Input<uint32_t> u;
PoisonInput(u);
sscanf("17421742", "%" SCNo32, &u.i);
MOZ_RELEASE_ASSERT(u.i == 017421742);
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("4217867", "%" SCNu32, &u.i);
MOZ_RELEASE_ASSERT(u.i == 4217867);
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("2ABCBEEF", "%" SCNx32, &u.i);
MOZ_RELEASE_ASSERT(u.i == 0x2ABCBEEF);
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
}
示例5: TestScanUnsigned16
static void
TestScanUnsigned16()
{
Input<uint16_t> u;
PoisonInput(u);
sscanf("1742", "%" SCNo16, &u.i);
MOZ_RELEASE_ASSERT(u.i == 01742);
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("4217", "%" SCNu16, &u.i);
MOZ_RELEASE_ASSERT(u.i == 4217);
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("2ABC", "%" SCNx16, &u.i);
MOZ_RELEASE_ASSERT(u.i == 0x2ABC);
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
}
示例6: TestScanUnsignedPtr
static void
TestScanUnsignedPtr()
{
Input<uintptr_t> u;
PoisonInput(u);
sscanf("57060516", "%" SCNoPTR, &u.i);
MOZ_RELEASE_ASSERT(u.i == uintptr_t(reinterpret_cast<void*>(12345678)));
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("87654321", "%" SCNuPTR, &u.i);
MOZ_RELEASE_ASSERT(u.i == uintptr_t(reinterpret_cast<void*>(87654321)));
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("4c3a791", "%" SCNxPTR, &u.i);
MOZ_RELEASE_ASSERT(u.i == uintptr_t(reinterpret_cast<void*>(0x4c3a791)));
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
}
示例7: TestScanUnsigned8
static void
TestScanUnsigned8()
{
#if SHOULD_TEST_8BIT_FORMAT_MACROS
Input<uint8_t> u;
PoisonInput(u);
sscanf("17", "%" SCNo8, &u.i);
MOZ_RELEASE_ASSERT(u.i == 017);
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("42", "%" SCNu8, &u.i);
MOZ_RELEASE_ASSERT(u.i == 42);
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
PoisonInput(u);
sscanf("2A", "%" SCNx8, &u.i);
MOZ_RELEASE_ASSERT(u.i == 0x2A);
MOZ_RELEASE_ASSERT(ExtraBitsUntouched(u));
#endif
}
示例8: reporter
//.........这里部分代码省略.........
SYMBOL(GetError),
SYMBOL(GetConfigs),
SYMBOL(GetConfigAttrib),
SYMBOL(WaitNative),
SYMBOL(GetProcAddress),
SYMBOL(SwapBuffers),
SYMBOL(CopyBuffers),
SYMBOL(QueryString),
SYMBOL(QueryContext),
SYMBOL(BindTexImage),
SYMBOL(ReleaseTexImage),
SYMBOL(QuerySurface),
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
NS_WARNING("Couldn't find required entry points in EGL library (early init)");
return false;
}
GLLibraryLoader::SymLoadStruct optionalSymbols[] = {
// On Android 4.3 and up, certain features like ANDROID_native_fence_sync
// can only be queried by using a special eglQueryString.
{ (PRFuncPtr*) &mSymbols.fQueryStringImplementationANDROID,
{ "_Z35eglQueryStringImplementationANDROIDPvi", nullptr } },
{ nullptr, { nullptr } }
};
// Do not warn about the failure to load this - see bug 1092191
Unused << GLLibraryLoader::LoadSymbols(mEGLLibrary, &optionalSymbols[0],
nullptr, nullptr, false);
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
MOZ_RELEASE_ASSERT(mSymbols.fQueryStringImplementationANDROID,
"GFX: Couldn't find eglQueryStringImplementationANDROID");
#endif
InitClientExtensions();
const auto lookupFunction =
(GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;
// Client exts are ready. (But not display exts!)
if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
{ (PRFuncPtr*)&mSymbols.fGetPlatformDisplayEXT, { "eglGetPlatformDisplayEXT", nullptr } },
{ nullptr, { nullptr } }
};
bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
&d3dSymbols[0],
lookupFunction);
if (!success) {
NS_ERROR("EGL supports ANGLE_platform_angle_d3d without exposing its functions!");
MarkExtensionUnsupported(ANGLE_platform_angle_d3d);
mSymbols.fGetPlatformDisplayEXT = nullptr;
}
}
// Check the ANGLE support the system has
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
mIsANGLE = IsExtensionSupported(ANGLE_platform_angle);
EGLDisplay chosenDisplay = nullptr;
示例9: main
int
main()
{
MOZ_RELEASE_ASSERT(sum({1, 2, 3, 4, 5, 6}) == 7 * 3);
return 0;
}
示例10: MOZ_RELEASE_ASSERT
RefPtr<OmxPromiseLayer::OmxCommandPromise>
OmxPromiseLayer::SendCommand(OMX_COMMANDTYPE aCmd, OMX_U32 aParam1, OMX_PTR aCmdData)
{
if (aCmd == OMX_CommandFlush) {
// It doesn't support another flush commands before previous one is completed.
MOZ_RELEASE_ASSERT(!mFlushCommands.Length());
// Some coomponents don't send event with OMX_ALL, they send flush complete
// event with input port and another event for output port.
// In prupose of better compatibility, we interpret the OMX_ALL to OMX_DirInput
// and OMX_DirOutput flush separately.
OMX_DIRTYPE types[] = {OMX_DIRTYPE::OMX_DirInput, OMX_DIRTYPE::OMX_DirOutput};
for(const auto type : types) {
if ((aParam1 == type) || (aParam1 == OMX_ALL)) {
mFlushCommands.AppendElement(FlushCommand({type, aCmdData}));
}
if (type == OMX_DirInput) {
// Clear all buffered raw data.
mRawDatas.Clear();
}
}
// Don't overlay more than one flush command, some components can't overlay flush commands.
// So here we send another flush after receiving the previous flush completed event.
if (mFlushCommands.Length()) {
OMX_ERRORTYPE err =
mPlatformLayer->SendCommand(OMX_CommandFlush,
mFlushCommands.ElementAt(0).type,
mFlushCommands.ElementAt(0).cmd);
if (err != OMX_ErrorNone) {
OmxCommandFailureHolder failure(OMX_ErrorNotReady, OMX_CommandFlush);
return OmxCommandPromise::CreateAndReject(failure, __func__);
}
} else {
LOG("OMX_CommandFlush parameter error");
OmxCommandFailureHolder failure(OMX_ErrorNotReady, OMX_CommandFlush);
return OmxCommandPromise::CreateAndReject(failure, __func__);
}
} else {
OMX_ERRORTYPE err = mPlatformLayer->SendCommand(aCmd, aParam1, aCmdData);
if (err != OMX_ErrorNone) {
OmxCommandFailureHolder failure(OMX_ErrorNotReady, aCmd);
return OmxCommandPromise::CreateAndReject(failure, __func__);
}
}
RefPtr<OmxCommandPromise> p;
if (aCmd == OMX_CommandStateSet) {
p = mCommandStatePromise.Ensure(__func__);
} else if (aCmd == OMX_CommandFlush) {
p = mFlushPromise.Ensure(__func__);
} else if (aCmd == OMX_CommandPortEnable) {
p = mPortEnablePromise.Ensure(__func__);
} else if (aCmd == OMX_CommandPortDisable) {
p = mPortDisablePromise.Ensure(__func__);
} else {
LOG("error unsupport command");
MOZ_ASSERT(0);
}
return p;
}
示例11: MOZ_RELEASE_ASSERT
void
js::ThisThread::GetName(char* nameBuffer, size_t len)
{
MOZ_RELEASE_ASSERT(len > 0);
*nameBuffer = '\0';
}
示例12: params
void
OriginAttributes::CreateSuffix(nsACString& aStr) const
{
UniquePtr<URLParams> params(new URLParams());
nsAutoString value;
//
// Important: While serializing any string-valued attributes, perform a
// release-mode assertion to make sure that they don't contain characters that
// will break the quota manager when it uses the serialization for file
// naming (see addonId below).
//
if (mAppId != nsIScriptSecurityManager::NO_APP_ID) {
value.AppendInt(mAppId);
params->Set(NS_LITERAL_STRING("appId"), value);
}
if (mInIsolatedMozBrowser) {
params->Set(NS_LITERAL_STRING("inBrowser"), NS_LITERAL_STRING("1"));
}
if (!mAddonId.IsEmpty()) {
if (mAddonId.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) != kNotFound) {
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Crash_AddonId"),
NS_ConvertUTF16toUTF8(mAddonId));
#endif
MOZ_CRASH();
}
params->Set(NS_LITERAL_STRING("addonId"), mAddonId);
}
if (mUserContextId != nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID) {
value.Truncate();
value.AppendInt(mUserContextId);
params->Set(NS_LITERAL_STRING("userContextId"), value);
}
if (mPrivateBrowsingId) {
value.Truncate();
value.AppendInt(mPrivateBrowsingId);
params->Set(NS_LITERAL_STRING("privateBrowsingId"), value);
}
if (!mFirstPartyDomain.IsEmpty()) {
MOZ_RELEASE_ASSERT(mFirstPartyDomain.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) == kNotFound);
params->Set(NS_LITERAL_STRING("firstPartyDomain"), mFirstPartyDomain);
}
aStr.Truncate();
params->Serialize(value);
if (!value.IsEmpty()) {
aStr.AppendLiteral("^");
aStr.Append(NS_ConvertUTF16toUTF8(value));
}
// In debug builds, check the whole string for illegal characters too (just in case).
#ifdef DEBUG
nsAutoCString str;
str.Assign(aStr);
MOZ_ASSERT(str.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) == kNotFound);
#endif
}
示例13: unmapPages
void
unmapPages(void* p, size_t size)
{
if (munmap(p, size))
MOZ_RELEASE_ASSERT(errno == ENOMEM);
}
示例14: MOZ_RELEASE_ASSERT
void
ThreadStackHelper::CollectNativeLeafAddr(void* aAddr)
{
MOZ_RELEASE_ASSERT(mStackToFill);
TryAppendFrame(HangEntryProgCounter(reinterpret_cast<uintptr_t>(aAddr)));
}
示例15: MOZ_RELEASE_ASSERT
void
SharedSurface_SurfaceTexture::WaitForBufferOwnership()
{
MOZ_RELEASE_ASSERT(!mSurface->GetAvailable());
mSurface->SetAvailable(true);
}