• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ NS_ENSURE_TRUE_VOID函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NS_ENSURE_TRUE_VOID函数的典型用法代码示例。如果您正苦于以下问题:C++ NS_ENSURE_TRUE_VOID函数的具体用法?C++ NS_ENSURE_TRUE_VOID怎么用?C++ NS_ENSURE_TRUE_VOID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NS_ENSURE_TRUE_VOID函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DispatchStatusChangedEvent

void
DispatchStatusChangedEvent(const nsAString& aType,
                           const nsAString& aAddress,
                           bool aStatus)
{
  MOZ_ASSERT(NS_IsMainThread());

  InfallibleTArray<BluetoothNamedValue> data;
  BT_APPEND_NAMED_VALUE(data, "address", nsString(aAddress));
  BT_APPEND_NAMED_VALUE(data, "status", aStatus);

  BluetoothService* bs = BluetoothService::Get();
  NS_ENSURE_TRUE_VOID(bs);
  bs->DistributeSignal(aType, NS_LITERAL_STRING(KEY_ADAPTER), data);
}
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:15,代码来源:BluetoothUtils.cpp


示例2: MOZ_ASSERT

void
GMPCDMProxy::Init(PromiseId aPromiseId,
                  const nsAString& aOrigin,
                  const nsAString& aTopLevelOrigin,
                  const nsAString& aGMPName)
{
  MOZ_ASSERT(NS_IsMainThread());
  NS_ENSURE_TRUE_VOID(!mKeys.IsNull());

  EME_LOG("GMPCDMProxy::Init (%s, %s)",
          NS_ConvertUTF16toUTF8(aOrigin).get(),
          NS_ConvertUTF16toUTF8(aTopLevelOrigin).get());

  nsCString pluginVersion;
  if (!mOwnerThread) {
    nsCOMPtr<mozIGeckoMediaPluginService> mps =
      do_GetService("@mozilla.org/gecko-media-plugin-service;1");
    if (!mps) {
      RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
                    NS_LITERAL_CSTRING("Couldn't get MediaPluginService in GMPCDMProxy::Init"));
      return;
    }
    mps->GetThread(getter_AddRefs(mOwnerThread));
    if (!mOwnerThread) {
      RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
                    NS_LITERAL_CSTRING("Couldn't get GMP thread GMPCDMProxy::Init"));
      return;
    }
  }

  if (aGMPName.IsEmpty()) {
    RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
      nsPrintfCString("Unknown GMP for keysystem '%s'", NS_ConvertUTF16toUTF8(mKeySystem).get()));
    return;
  }

  UniquePtr<InitData> data(new InitData());
  data->mPromiseId = aPromiseId;
  data->mOrigin = aOrigin;
  data->mTopLevelOrigin = aTopLevelOrigin;
  data->mGMPName = aGMPName;
  data->mCrashHelper = mCrashHelper;
  nsCOMPtr<nsIRunnable> task(
    NewRunnableMethod<UniquePtr<InitData>&&>(this,
                                             &GMPCDMProxy::gmp_Init,
                                             Move(data)));
  mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL);
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:48,代码来源:GMPCDMProxy.cpp


示例3: NS_ENSURE_TRUE_VOID

void
KeyboardEvent::InitKeyEvent(const nsAString& aType, bool aCanBubble,
                            bool aCancelable, nsGlobalWindowInner* aView,
                            bool aCtrlKey, bool aAltKey,
                            bool aShiftKey, bool aMetaKey,
                            uint32_t aKeyCode, uint32_t aCharCode)
{
  NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);

  UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);

  WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();
  keyEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
  keyEvent->mKeyCode = aKeyCode;
  keyEvent->mCharCode = aCharCode;
}
开发者ID:artines1,项目名称:gecko-dev,代码行数:16,代码来源:KeyboardEvent.cpp


示例4: NS_ENSURE_TRUE_VOID

void
VideoTrackEncoder::CreateMutedFrame(nsTArray<uint8_t>* aOutputBuffer)
{
  NS_ENSURE_TRUE_VOID(aOutputBuffer);

  // Supports YUV420 image format only.
  int yPlaneLen = mFrameWidth * mFrameHeight;
  int cbcrPlaneLen = yPlaneLen / 2;
  int frameLen = yPlaneLen + cbcrPlaneLen;

  aOutputBuffer->SetLength(frameLen);
  // Fill Y plane.
  memset(aOutputBuffer->Elements(), 0x10, yPlaneLen);
  // Fill Cb/Cr planes.
  memset(aOutputBuffer->Elements() + yPlaneLen, 0x80, cbcrPlaneLen);
}
开发者ID:blue119,项目名称:gecko-dev,代码行数:16,代码来源:TrackEncoder.cpp


示例5: NS_ENSURE_TRUE_VOID

void
nsBrowserElement::RemoveNextPaintListener(BrowserElementNextPaintEventCallback& aListener,
                                          ErrorResult& aRv)
{
  NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));

  CallbackObjectHolder<BrowserElementNextPaintEventCallback,
                       nsIBrowserElementNextPaintListener> holder(&aListener);
  nsCOMPtr<nsIBrowserElementNextPaintListener> listener = holder.ToXPCOMCallback();

  nsresult rv = mBrowserElementAPI->RemoveNextPaintListener(listener);

  if (NS_WARN_IF(NS_FAILED(rv))) {
    aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
  }
}
开发者ID:MekliCZ,项目名称:positron,代码行数:16,代码来源:nsBrowserElement.cpp


示例6: contextPtr

void
ThreadStackHelper::GetNativeStack(Stack& aStack)
{
#ifdef MOZ_THREADSTACKHELPER_NATIVE
  ThreadContext context;
  context.mStack = MakeUnique<uint8_t[]>(ThreadContext::kMaxStackSize);

  ScopedSetPtr<ThreadContext> contextPtr(mContextToFill, &context);

  // Get pseudostack first and fill the thread context.
  GetStack(aStack);
  NS_ENSURE_TRUE_VOID(context.mValid);

  // TODO: walk the saved stack frames.
#endif // MOZ_THREADSTACKHELPER_NATIVE
}
开发者ID:MekliCZ,项目名称:positron,代码行数:16,代码来源:ThreadStackHelper.cpp


示例7: MOZ_ASSERT

void
CDMProxy::UpdateSession(const nsAString& aSessionId,
                        PromiseId aPromiseId,
                        nsTArray<uint8_t>& aResponse)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(mGMPThread);
  NS_ENSURE_TRUE_VOID(!mKeys.IsNull());

  nsAutoPtr<UpdateSessionData> data(new UpdateSessionData());
  data->mPromiseId = aPromiseId;
  data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
  data->mResponse = Move(aResponse);
  nsCOMPtr<nsIRunnable> task(
    NewRunnableMethod<nsAutoPtr<UpdateSessionData>>(this, &CDMProxy::gmp_UpdateSession, data));
  mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
}
开发者ID:NAndreasson,项目名称:cowl-patches,代码行数:17,代码来源:CDMProxy.cpp


示例8: NS_ENSURE_TRUE_VOID

void
StorageEvent::InitStorageEvent(const nsAString& aType, bool aCanBubble,
                               bool aCancelable, const nsAString& aKey,
                               const nsAString& aOldValue,
                               const nsAString& aNewValue,
                               const nsAString& aURL,
                               DOMStorage* aStorageArea)
{
    NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);

    InitEvent(aType, aCanBubble, aCancelable);
    mKey = aKey;
    mOldValue = aOldValue;
    mNewValue = aNewValue;
    mUrl = aURL;
    mStorageArea = aStorageArea;
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:17,代码来源:StorageEvent.cpp


示例9: MOZ_ASSERT

void
CDMProxy::UpdateSession(const nsAString& aSessionId,
                        PromiseId aPromiseId,
                        const Uint8Array& aResponse)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(mGMPThread);
  NS_ENSURE_TRUE_VOID(!mKeys.IsNull());

  nsAutoPtr<UpdateSessionData> data(new UpdateSessionData());
  data->mPromiseId = aPromiseId;
  data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
  data->mResponse.AppendElements(aResponse.Data(), aResponse.Length());
  nsRefPtr<nsIRunnable> task(
    NS_NewRunnableMethodWithArg<nsAutoPtr<UpdateSessionData>>(this, &CDMProxy::gmp_UpdateSession, data));
  mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
}
开发者ID:chenhequn,项目名称:gecko,代码行数:17,代码来源:CDMProxy.cpp


示例10: GetFrameLoader

void
nsBrowserElement::InitBrowserElementAPI()
{
  RefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
  NS_ENSURE_TRUE_VOID(frameLoader);

  if (!frameLoader->OwnerIsMozBrowserFrame()) {
    return;
  }

  if (!mBrowserElementAPI) {
    mBrowserElementAPI = do_CreateInstance("@mozilla.org/dom/browser-element-api;1");
    if (NS_WARN_IF(!mBrowserElementAPI)) {
      return;
    }
  }
  mBrowserElementAPI->SetFrameLoader(frameLoader);
}
开发者ID:artines1,项目名称:gecko-dev,代码行数:18,代码来源:nsBrowserElement.cpp


示例11: MOZ_ASSERT

void
CDMProxy::UpdateSession(const nsAString& aSessionId,
                        PromiseId aPromiseId,
                        const Uint8Array& aResponse)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(mGMPThread);
  NS_ENSURE_TRUE_VOID(!mKeys.IsNull());

  // TODO: Dispatch task to GMPThread to call CDM UpdateSession via IPC.

  nsRefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId));
  nsAutoCString str(NS_LITERAL_CSTRING("Update_"));
  str.AppendInt(sUpdateCount++);
  nsTArray<uint8_t> msg;
  msg.AppendElements(str.get(), str.Length());
  session->DispatchKeyMessage(msg, NS_LITERAL_STRING("http://bogus.url"));
  ResolvePromise(aPromiseId);
}
开发者ID:Balakrishnan-Vivek,项目名称:gecko-dev,代码行数:19,代码来源:CDMProxy.cpp


示例12: NS_ENSURE_TRUE_VOID

void
nsBrowserElement::FindNext(BrowserFindDirection aDirection,
                          ErrorResult& aRv)
{
  NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));

  uint32_t direction;
  if (aDirection == BrowserFindDirection::Backward) {
    direction = nsIBrowserElementAPI::FIND_BACKWARD;
  } else {
    direction = nsIBrowserElementAPI::FIND_FORWARD;
  }

  nsresult rv = mBrowserElementAPI->FindNext(direction);

  if (NS_FAILED(rv)) {
    aRv.Throw(rv);
  }
}
开发者ID:artines1,项目名称:gecko-dev,代码行数:19,代码来源:nsBrowserElement.cpp


示例13: DispatchStatusChangedEvent

void
DispatchStatusChangedEvent(const nsAString& aType,
                           const nsAString& aAddress,
                           bool aStatus)
{
  MOZ_ASSERT(NS_IsMainThread());

  InfallibleTArray<BluetoothNamedValue> data;
  data.AppendElement(
    BluetoothNamedValue(NS_LITERAL_STRING("address"), nsString(aAddress)));
  data.AppendElement(
    BluetoothNamedValue(NS_LITERAL_STRING("status"), aStatus));

  BluetoothSignal signal(nsString(aType), NS_LITERAL_STRING(KEY_ADAPTER), data);

  BluetoothService* bs = BluetoothService::Get();
  NS_ENSURE_TRUE_VOID(bs);
  bs->DistributeSignal(signal);
}
开发者ID:Gabuzo,项目名称:mozilla-central,代码行数:19,代码来源:BluetoothUtils.cpp


示例14: MOZ_ASSERT

void MediaOmxReader::NotifyDataArrivedInternal()
{
  MOZ_ASSERT(OnTaskQueue());
  RefPtr<AbstractMediaDecoder> decoder = SafeGetDecoder();
  if (!decoder) { // reader has shut down
    return;
  }
  if (HasVideo()) {
    return;
  }
  if (!mMP3FrameParser.NeedsData()) {
    return;
  }

  AutoPinned<MediaResource> resource(mDecoder->GetResource());
  MediaByteRangeSet byteRanges;
  nsresult rv = resource->GetCachedRanges(byteRanges);

  if (NS_FAILED(rv)) {
    return;
  }

  if (byteRanges == mLastCachedRanges) {
    return;
  }
  MediaByteRangeSet intervals = byteRanges - mLastCachedRanges;
  mLastCachedRanges = byteRanges;

  for (const auto& interval : intervals) {
    RefPtr<MediaByteBuffer> bytes =
      resource->MediaReadAt(interval.mStart, interval.Length());
    NS_ENSURE_TRUE_VOID(bytes);
    mMP3FrameParser.Parse(bytes->Elements(), interval.Length(), interval.mStart);
    if (!mMP3FrameParser.IsMP3()) {
      return;
    }
  }
  int64_t duration = mMP3FrameParser.GetDuration();
  if (duration != mLastParserDuration) {
    mLastParserDuration = duration;
    decoder->DispatchUpdateEstimatedMediaDuration(mLastParserDuration);
  }
}
开发者ID:MekliCZ,项目名称:positron,代码行数:43,代码来源:MediaOmxReader.cpp


示例15: NS_PRECONDITION

void
IDBTransaction::RollbackSavepoint()
{
  NS_PRECONDITION(!NS_IsMainThread(), "Wrong thread!");
  NS_PRECONDITION(mConnection, "No connection!");

  NS_ASSERTION(mSavepointCount == 1, "Mismatch!");
  mSavepointCount = 0;

  nsCOMPtr<mozIStorageStatement> stmt = GetCachedStatement(NS_LITERAL_CSTRING(
    "ROLLBACK TO SAVEPOINT " SAVEPOINT_NAME
  ));
  NS_ENSURE_TRUE_VOID(stmt);

  mozStorageStatementScoper scoper(stmt);

  nsresult rv = stmt->Execute();
  NS_ENSURE_SUCCESS_VOID(rv);
}
开发者ID:hadicoffee,项目名称:jb412gecko,代码行数:19,代码来源:IDBTransaction.cpp


示例16: DOMEventTargetHelper

BluetoothDevice::BluetoothDevice(nsPIDOMWindow* aWindow,
                                 const BluetoothValue& aValue)
  : DOMEventTargetHelper(aWindow)
  , mJsUuids(nullptr)
  , mJsServices(nullptr)
  , mIsRooted(false)
{
  MOZ_ASSERT(aWindow);
  MOZ_ASSERT(IsDOMBinding());

  const InfallibleTArray<BluetoothNamedValue>& values =
    aValue.get_ArrayOfBluetoothNamedValue();
  for (uint32_t i = 0; i < values.Length(); ++i) {
    SetPropertyByValue(values[i]);
  }

  BluetoothService* bs = BluetoothService::Get();
  NS_ENSURE_TRUE_VOID(bs);
  bs->RegisterBluetoothSignalHandler(mAddress, this);
}
开发者ID:djed,项目名称:gecko-dev,代码行数:20,代码来源:BluetoothDevice.cpp


示例17: MOZ_ASSERT

void
TextEditRules::WillInsert(Selection& aSelection, bool* aCancel)
{
  MOZ_ASSERT(aCancel);

  if (IsReadonly() || IsDisabled()) {
    *aCancel = true;
    return;
  }

  // initialize out param
  *aCancel = false;

  // check for the magic content node and delete it if it exists
  if (mBogusNode) {
    NS_ENSURE_TRUE_VOID(mTextEditor);
    mTextEditor->DeleteNode(mBogusNode);
    mBogusNode = nullptr;
  }
}
开发者ID:bgrins,项目名称:gecko-dev,代码行数:20,代码来源:TextEditRules.cpp


示例18: mMediaElement

TextTrackManager::TextTrackManager(HTMLMediaElement *aMediaElement)
  : mMediaElement(aMediaElement)
  , performedTrackSelection(false)
{
  nsISupports* parentObject =
    mMediaElement->OwnerDoc()->GetParentObject();

  NS_ENSURE_TRUE_VOID(parentObject);

  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(parentObject);
  mNewCues = new TextTrackCueList(window);
  mTextTracks = new TextTrackList(window, this);
  mPendingTextTracks = new TextTrackList(window, this);

  if (!sParserWrapper) {
    nsCOMPtr<nsIWebVTTParserWrapper> parserWrapper =
      do_CreateInstance(NS_WEBVTTPARSERWRAPPER_CONTRACTID);
    sParserWrapper = parserWrapper;
    ClearOnShutdown(&sParserWrapper);
  }
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:21,代码来源:TextTrackManager.cpp


示例19: OwnerDoc

void
HTMLVideoElement::WakeLockUpdate()
{
    bool hidden = OwnerDoc()->Hidden();

    if (mScreenWakeLock && (mPaused || hidden)) {
        mScreenWakeLock->Unlock();
        mScreenWakeLock = nullptr;
        return;
    }

    if (!mScreenWakeLock && !mPaused && !hidden) {
        nsCOMPtr<nsIPowerManagerService> pmService =
            do_GetService(POWERMANAGERSERVICE_CONTRACTID);
        NS_ENSURE_TRUE_VOID(pmService);

        pmService->NewWakeLock(NS_LITERAL_STRING("screen"),
                               OwnerDoc()->GetWindow(),
                               getter_AddRefs(mScreenWakeLock));
    }
}
开发者ID:jedp,项目名称:mozilla-central,代码行数:21,代码来源:HTMLVideoElement.cpp


示例20: DOMEventTargetHelper

BluetoothDevice::BluetoothDevice(nsPIDOMWindow* aWindow,
                                 const nsAString& aAdapterPath,
                                 const BluetoothValue& aValue)
  : DOMEventTargetHelper(aWindow)
  , BluetoothPropertyContainer(BluetoothObjectType::TYPE_DEVICE)
  , mJsUuids(nullptr)
  , mJsServices(nullptr)
  , mAdapterPath(aAdapterPath)
  , mIsRooted(false)
{
  MOZ_ASSERT(aWindow);

  const InfallibleTArray<BluetoothNamedValue>& values =
    aValue.get_ArrayOfBluetoothNamedValue();
  for (uint32_t i = 0; i < values.Length(); ++i) {
    SetPropertyByValue(values[i]);
  }

  BluetoothService* bs = BluetoothService::Get();
  NS_ENSURE_TRUE_VOID(bs);
  bs->RegisterBluetoothSignalHandler(mAddress, this);
}
开发者ID:alex-tifrea,项目名称:gecko-dev,代码行数:22,代码来源:BluetoothDevice.cpp



注:本文中的NS_ENSURE_TRUE_VOID函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NS_ERROR函数代码示例发布时间:2022-05-30
下一篇:
C++ NS_ENSURE_SUCCESS函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap