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

C++ MOZ_LOG函数代码示例

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

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



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

示例1: MOZ_LOG

nsPluginStreamListenerPeer::~nsPluginStreamListenerPeer() {
#ifdef PLUGIN_LOGGING
  MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL,
          ("nsPluginStreamListenerPeer::dtor this=%p, url=%s\n", this,
           mURLSpec.get()));
#endif

  if (mPStreamListener) {
    mPStreamListener->SetStreamListenerPeer(nullptr);
  }
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:11,代码来源:nsPluginStreamListenerPeer.cpp


示例2: mon

long
AudioStream::DataCallback(void* aBuffer, long aFrames)
{
    MonitorAutoLock mon(mMonitor);
    MOZ_ASSERT(mState != SHUTDOWN, "No data callback after shutdown");
    uint32_t available = std::min(static_cast<uint32_t>(FramesToBytes(aFrames)), mBuffer.Length());
    MOZ_ASSERT(available % mBytesPerFrame == 0, "Must copy complete frames");
    AudioDataValue* output = reinterpret_cast<AudioDataValue*>(aBuffer);
    uint32_t underrunFrames = 0;
    uint32_t servicedFrames = 0;

    // NOTE: wasapi (others?) can call us back *after* stop()/Shutdown() (mState == SHUTDOWN)
    // Bug 996162

    // callback tells us cubeb succeeded initializing
    if (mState == STARTED) {
        mState = RUNNING;
    }

    if (available) {
        if (mInRate == mOutRate) {
            servicedFrames = GetUnprocessed(output, aFrames);
        } else {
            servicedFrames = GetTimeStretched(output, aFrames);
        }

        MOZ_ASSERT(mBuffer.Length() % mBytesPerFrame == 0, "Must copy complete frames");

        // Notify any blocked Write() call that more space is available in mBuffer.
        mon.NotifyAll();
    }

    underrunFrames = aFrames - servicedFrames;

    // Always send audible frames first, and silent frames later.
    // Otherwise it will break the assumption of FrameHistory.
    if (mState != DRAINING) {
        mAudioClock.UpdateFrameHistory(servicedFrames, underrunFrames);
        uint8_t* rpos = static_cast<uint8_t*>(aBuffer) + FramesToBytes(aFrames - underrunFrames);
        memset(rpos, 0, FramesToBytes(underrunFrames));
        if (underrunFrames) {
            MOZ_LOG(gAudioStreamLog, LogLevel::Warning,
                    ("AudioStream %p lost %d frames", this, underrunFrames));
        }
        servicedFrames += underrunFrames;
    } else {
        mAudioClock.UpdateFrameHistory(servicedFrames, 0);
    }

    WriteDumpFile(mDumpFile, this, aFrames, aBuffer);

    return servicedFrames;
}
开发者ID:logicoftekk,项目名称:cyberfox,代码行数:53,代码来源:AudioStream.cpp


示例3: try_rust

// Helper to test the rust parser on a data source.
static bool try_rust(const UniquePtr<mp4parse_state, FreeMP4ParseState>& aRustState, RefPtr<Stream> aSource, int32_t* aCount)
{
  static LazyLogModule sLog("MP4Metadata");
  int64_t length;
  if (!aSource->Length(&length) || length <= 0) {
    MOZ_LOG(sLog, LogLevel::Warning, ("Couldn't get source length"));
    return false;
  }
  MOZ_LOG(sLog, LogLevel::Debug,
         ("Source length %d bytes\n", (long long int)length));
  size_t bytes_read = 0;
  auto buffer = std::vector<uint8_t>(length);
  bool rv = aSource->ReadAt(0, buffer.data(), length, &bytes_read);
  if (!rv || bytes_read != size_t(length)) {
    MOZ_LOG(sLog, LogLevel::Warning, ("Error copying mp4 data"));
    return false;
  }
  *aCount = mp4parse_read(aRustState.get(), buffer.data(), bytes_read);
  MOZ_LOG(sLog, LogLevel::Info, ("rust parser found %d tracks", int(*aCount)));
  return true;
}
开发者ID:bolt-dev,项目名称:gecko-dev,代码行数:22,代码来源:MP4Metadata.cpp


示例4: MOZ_LOG

bool StreamAdaptor::Read(uint8_t* buffer, uintptr_t size, size_t* bytes_read) {
  if (!mOffset.isValid()) {
    MOZ_LOG(gMP4MetadataLog, LogLevel::Error,
            ("Overflow in source stream offset"));
    return false;
  }
  bool rv = mSource->ReadAt(mOffset.value(), buffer, size, bytes_read);
  if (rv) {
    mOffset += *bytes_read;
  }
  return rv;
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:12,代码来源:MP4Metadata.cpp


示例5: printf

NS_IMETHODIMP
nsMimeBaseEmitter::Write(const nsACString &buf, uint32_t *amountWritten)
{
  unsigned int        written = 0;
  nsresult rv = NS_OK;
  uint32_t            needToWrite;

#ifdef DEBUG_BenB
  // If you want to see libmime output...
  printf("%s", buf);
#endif

  MOZ_LOG(gMimeEmitterLogModule, mozilla::LogLevel::Info, ("%s", PromiseFlatCString(buf).get()));
  //
  // Make sure that the buffer we are "pushing" into has enough room
  // for the write operation. If not, we have to buffer, return, and get
  // it on the next time through
  //
  *amountWritten = 0;

  needToWrite = mBufferMgr->GetSize();
  // First, handle any old buffer data...
  if (needToWrite > 0)
  {
    rv = WriteHelper(mBufferMgr->GetBuffer(), &written);

    mTotalWritten += written;
    mBufferMgr->ReduceBuffer(written);
    *amountWritten = written;

    // if we couldn't write all the old data, buffer the new data
    // and return
    if (mBufferMgr->GetSize() > 0)
    {
      mBufferMgr->IncreaseBuffer(buf);
      return rv;
    }
  }


  // if we get here, we are dealing with new data...try to write
  // and then do the right thing...
  rv = WriteHelper(buf, &written);
  *amountWritten = written;
  mTotalWritten += written;

  if (written < buf.Length()) {
    const nsACString &remainder = Substring(buf, written);
    mBufferMgr->IncreaseBuffer(remainder);
  }

  return rv;
}
开发者ID:SphereWeb,项目名称:releases-comm-central,代码行数:53,代码来源:nsMimeBaseEmitter.cpp


示例6: MOZ_LOG

nsresult
AudioStream::Init(int32_t aNumChannels, int32_t aRate,
                  const dom::AudioChannel aAudioChannel)
{
    mStartTime = TimeStamp::Now();
    mIsFirst = CubebUtils::GetFirstStream();

    if (!CubebUtils::GetCubebContext() || aNumChannels < 0 || aRate < 0) {
        return NS_ERROR_FAILURE;
    }

    MOZ_LOG(gAudioStreamLog, LogLevel::Debug,
            ("%s  channels: %d, rate: %d for %p", __FUNCTION__, aNumChannels, aRate, this));
    mInRate = mOutRate = aRate;
    mChannels = aNumChannels;
    mOutChannels = (aNumChannels > 2) ? 2 : aNumChannels;

    mDumpFile = OpenDumpFile(this);

    cubeb_stream_params params;
    params.rate = aRate;
    params.channels = mOutChannels;
#if defined(__ANDROID__)
#if defined(MOZ_B2G)
    mAudioChannel = aAudioChannel;
    params.stream_type = CubebUtils::ConvertChannelToCubebType(aAudioChannel);
#else
    mAudioChannel = dom::AudioChannel::Content;
    params.stream_type = CUBEB_STREAM_TYPE_MUSIC;
#endif

    if (params.stream_type == CUBEB_STREAM_TYPE_MAX) {
        return NS_ERROR_INVALID_ARG;
    }
#endif
    if (AUDIO_OUTPUT_FORMAT == AUDIO_FORMAT_S16) {
        params.format = CUBEB_SAMPLE_S16NE;
    } else {
        params.format = CUBEB_SAMPLE_FLOAT32NE;
    }
    mBytesPerFrame = sizeof(AudioDataValue) * mOutChannels;

    mAudioClock.Init();

    // Size mBuffer for one second of audio.  This value is arbitrary, and was
    // selected based on the observed behaviour of the existing AudioStream
    // implementations.
    uint32_t bufferLimit = FramesToBytes(aRate);
    MOZ_ASSERT(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
    mBuffer.SetCapacity(bufferLimit);

    return OpenCubeb(params);
}
开发者ID:logicoftekk,项目名称:cyberfox,代码行数:53,代码来源:AudioStream.cpp


示例7: read_source

static int32_t
read_source(RefPtr<Stream> aSource, std::vector<uint8_t>& aBuffer)
{
  static LazyLogModule sLog("MP4Metadata");
  int64_t length;
  if (!aSource->Length(&length) || length <= 0) {
    MOZ_LOG(sLog, LogLevel::Warning, ("Couldn't get source length"));
    return MP4PARSE_ERROR_IO;
  }
  MOZ_LOG(sLog, LogLevel::Debug,
         ("Source length %d bytes\n", (long long int)length));
  length = std::min<int64_t>(length, 1024 * 1024); // Don't read the entire file.
  aBuffer.resize(length);
  size_t bytes_read = 0;
  bool rv = aSource->ReadAt(0, aBuffer.data(), aBuffer.size(), &bytes_read);
  if (!rv || bytes_read != size_t(length)) {
    MOZ_LOG(sLog, LogLevel::Warning, ("Error copying mp4 data"));
    return MP4PARSE_ERROR_IO;
  }
  return MP4PARSE_OK;
}
开发者ID:MekliCZ,项目名称:positron,代码行数:21,代码来源:MP4Metadata.cpp


示例8: CSFLogV

void CSFLogV(CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, va_list args)
{
#ifdef STDOUT_LOGGING
  printf("%s\n:",tag);
  vprintf(format, args);
#else

  mozilla::LogLevel level = static_cast<mozilla::LogLevel>(priority);

  GetSignalingLogInfo();

  // Skip doing any of this work if we're not logging the indicated level...
  if (!MOZ_LOG_TEST(gLogModuleInfo,level)) {
    return;
  }

  // Trim the path component from the filename
  const char *lastSlash = sourceFile;
  while (*sourceFile) {
    if (*sourceFile == '/' || *sourceFile == '\\') {
      lastSlash = sourceFile;
    }
    sourceFile++;
  }
  sourceFile = lastSlash;
  if (*sourceFile == '/' || *sourceFile == '\\') {
    sourceFile++;
  }

#define MAX_MESSAGE_LENGTH 1024
  char message[MAX_MESSAGE_LENGTH];

  const char *threadName = NULL;

  // Check if we're the main thread...
  if (NS_IsMainThread()) {
    threadName = "main";
  } else {
    threadName = PR_GetThreadName(PR_GetCurrentThread());
  }

  // If we can't find it anywhere, use a blank string
  if (!threadName) {
    threadName = "";
  }

  VsprintfLiteral(message, format, args);
  MOZ_LOG(gLogModuleInfo, level, ("[%s|%s] %s:%d: %s",
                                  threadName, tag, sourceFile, sourceLine,
                                  message));
#endif

}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:53,代码来源:CSFLog.cpp


示例9: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP nsMsgPurgeService::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *aFolder)
{
  NS_ENSURE_ARG_POINTER(aMsgHdr);

  nsCString messageId;
  nsCString author;
  nsCString subject;

  aMsgHdr->GetMessageId(getter_Copies(messageId));
  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("messageId=%s", messageId.get()));
  aMsgHdr->GetSubject(getter_Copies(subject));
  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("subject=%s",subject.get()));
  aMsgHdr->GetAuthor(getter_Copies(author));
  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("author=%s",author.get()));

  // double check that the message is junk before adding to
  // the list of messages to delete
  //
  // note, we can't just search for messages that are junk
  // because not all imap server support keywords
  // (which we use for the junk score)
  // so the junk status would be in the message db.
  //
  // see bug #194090
  nsCString junkScoreStr;
  nsresult rv = aMsgHdr->GetStringProperty("junkscore", getter_Copies(junkScoreStr));
  NS_ENSURE_SUCCESS(rv,rv);

  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("junkScore=%s (if empty or != nsIJunkMailPlugin::IS_SPAM_SCORE, don't add to list delete)", junkScoreStr.get()));

  // if "junkscore" is not set, don't delete the message
  if (junkScoreStr.IsEmpty())
    return NS_OK;

  if (atoi(junkScoreStr.get()) == nsIJunkMailPlugin::IS_SPAM_SCORE) {
    MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("added message to delete"));
    return mHdrsToDelete->AppendElement(aMsgHdr);
  }
  return NS_OK;
}
开发者ID:mozilla,项目名称:releases-comm-central,代码行数:40,代码来源:nsMsgPurgeService.cpp


示例10: StartUnlocked

void
AudioStream::CheckForStart()
{
  mMonitor.AssertCurrentThreadOwns();
  if (mState == INITIALIZED) {
    // Start the stream right away when low latency has been requested. This means
    // that the DataCallback will feed silence to cubeb, until the first frames
    // are written to this AudioStream.  Also start if a start has been queued.
    if (mLatencyRequest == LowLatency || mNeedsStart) {
      StartUnlocked(); // mState = STARTED or ERRORED
      mNeedsStart = false;
      MOZ_LOG(gAudioStreamLog, LogLevel::Warning,
             ("Started waiting %s-latency stream",
              mLatencyRequest == LowLatency ? "low" : "high"));
    } else {
      // high latency, not full - OR Pause() was called before we got here
      MOZ_LOG(gAudioStreamLog, LogLevel::Debug,
             ("Not starting waiting %s-latency stream",
              mLatencyRequest == LowLatency ? "low" : "high"));
    }
  }
}
开发者ID:haasn,项目名称:gecko-dev,代码行数:22,代码来源:AudioStream.cpp


示例11: mp4parse_read

nsresult MP4Metadata::Parse() {
  Mp4parseStatus rv = mp4parse_read(mParser.get());
  if (rv != MP4PARSE_STATUS_OK) {
    MOZ_LOG(gMP4MetadataLog, LogLevel::Debug,
            ("Parse failed, return code %d\n", rv));
    return rv == MP4PARSE_STATUS_OOM ? NS_ERROR_OUT_OF_MEMORY
                                     : NS_ERROR_DOM_MEDIA_METADATA_ERR;
  }

  UpdateCrypto();

  return NS_OK;
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:13,代码来源:MP4Metadata.cpp


示例12: read_source

// Wrapper to allow rust to call our read adaptor.
static intptr_t read_source(uint8_t* buffer, uintptr_t size, void* userdata) {
  MOZ_ASSERT(buffer);
  MOZ_ASSERT(userdata);

  auto source = reinterpret_cast<StreamAdaptor*>(userdata);
  size_t bytes_read = 0;
  bool rv = source->Read(buffer, size, &bytes_read);
  if (!rv) {
    MOZ_LOG(gMP4MetadataLog, LogLevel::Warning, ("Error reading source data"));
    return -1;
  }
  return bytes_read;
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:14,代码来源:MP4Metadata.cpp


示例13: MOZ_LOG

bool
Clipboard::IsTestingPrefEnabled()
{
  static bool sPrefCached = false;
  static bool sPrefCacheValue = false;

  if (!sPrefCached) {
    sPrefCached = true;
    Preferences::AddBoolVarCache(&sPrefCacheValue, "dom.events.testing.asyncClipboard");
  }
  MOZ_LOG(GetClipboardLog(), LogLevel::Debug,
            ("Clipboard, Is testing enabled? %d\n", sPrefCacheValue));
  return sPrefCacheValue;
}
开发者ID:artines1,项目名称:gecko-dev,代码行数:14,代码来源:Clipboard.cpp


示例14: MOZ_LOG

void
U2FTokenManager::Sign(PWebAuthnTransactionParent* aTransactionParent,
                      const uint64_t& aTransactionId,
                      const WebAuthnGetAssertionInfo& aTransactionInfo)
{
  MOZ_LOG(gU2FTokenManagerLog, LogLevel::Debug, ("U2FAuthSign"));

  ClearTransaction();
  mTransactionParent = aTransactionParent;
  mTokenManagerImpl = GetTokenManagerImpl();

  if (!mTokenManagerImpl) {
    AbortTransaction(aTransactionId, NS_ERROR_DOM_NOT_ALLOWED_ERR);
    return;
  }

  if ((aTransactionInfo.RpIdHash().Length() != SHA256_LENGTH) ||
      (aTransactionInfo.ClientDataHash().Length() != SHA256_LENGTH)) {
    AbortTransaction(aTransactionId, NS_ERROR_DOM_UNKNOWN_ERR);
    return;
  }

  uint64_t tid = mLastTransactionId = aTransactionId;
  mozilla::TimeStamp startTime = mozilla::TimeStamp::Now();
  mTokenManagerImpl->Sign(aTransactionInfo.AllowList(),
                          aTransactionInfo.RpIdHash(),
                          aTransactionInfo.ClientDataHash(),
                          aTransactionInfo.RequireUserVerification(),
                          aTransactionInfo.TimeoutMS())
                   ->Then(GetCurrentThreadSerialEventTarget(), __func__,
                     [tid, startTime](U2FSignResult&& aResult) {
                       U2FTokenManager* mgr = U2FTokenManager::Get();
                       mgr->MaybeConfirmSign(tid, aResult);
                       Telemetry::ScalarAdd(
                         Telemetry::ScalarID::SECURITY_WEBAUTHN_USED,
                         NS_LITERAL_STRING("U2FSignFinish"), 1);
                       Telemetry::AccumulateTimeDelta(
                         Telemetry::WEBAUTHN_GET_ASSERTION_MS,
                         startTime);
                     },
                     [tid](nsresult rv) {
                       MOZ_ASSERT(NS_FAILED(rv));
                       U2FTokenManager* mgr = U2FTokenManager::Get();
                       mgr->MaybeAbortSign(tid, rv);
                       Telemetry::ScalarAdd(
                         Telemetry::ScalarID::SECURITY_WEBAUTHN_USED,
                         NS_LITERAL_STRING("U2FSignAbort"), 1);
                     })
                   ->Track(mSignPromise);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:50,代码来源:U2FTokenManager.cpp


示例15: lock

void
OCSPCache::Clear()
{
  MutexAutoLock lock(mMutex);
  MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("OCSPCache::Clear: clearing cache"));
  // First go through and delete the memory being pointed to by the pointers
  // in the vector.
  for (Entry** entry = mEntries.begin(); entry < mEntries.end();
       entry++) {
    delete *entry;
  }
  // Then remove the pointers themselves.
  mEntries.clearAndFree();
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:14,代码来源:OCSPCache.cpp


示例16: MOZ_LOG

void
MediaEngineWebRTCMicrophoneSource::InsertInGraph(const T* aBuffer,
                                                 size_t aFrames,
                                                 uint32_t aChannels)
{
  if (mState != kStarted) {
    return;
  }

  if (MOZ_LOG_TEST(AudioLogModule(), LogLevel::Debug)) {
    mTotalFrames += aFrames;
    if (mTotalFrames > mLastLogFrames + mSampleFrequency) { // ~ 1 second
      MOZ_LOG(AudioLogModule(), LogLevel::Debug,
              ("%p: Inserting %" PRIuSIZE " samples into graph, total frames = %" PRIu64,
               (void*)this, aFrames, mTotalFrames));
      mLastLogFrames = mTotalFrames;
    }
  }

  size_t len = mSources.Length();
  for (size_t i = 0; i < len; i++) {
    if (!mSources[i]) {
      continue;
    }
    RefPtr<SharedBuffer> buffer =
      SharedBuffer::Create(aFrames * aChannels * sizeof(T));
    PodCopy(static_cast<T*>(buffer->Data()),
            aBuffer, aFrames * aChannels);

    TimeStamp insertTime;
    // Make sure we include the stream and the track.
    // The 0:1 is a flag to note when we've done the final insert for a given input block.
    LogTime(AsyncLatencyLogger::AudioTrackInsertion,
            LATENCY_STREAM_ID(mSources[i].get(), mTrackID),
            (i+1 < len) ? 0 : 1, insertTime);

    nsAutoPtr<AudioSegment> segment(new AudioSegment());
    AutoTArray<const T*, 1> channels;
    // XXX Bug 971528 - Support stereo capture in gUM
    MOZ_ASSERT(aChannels == 1,
        "GraphDriver only supports us stereo audio for now");
    channels.AppendElement(static_cast<T*>(buffer->Data()));
    segment->AppendFrames(buffer.forget(), channels, aFrames,
                         mPrincipalHandles[i]);
    segment->GetStartTime(insertTime);

    mSources[i]->AppendToTrack(mTrackID, segment);
  }
}
开发者ID:ncalexan,项目名称:gecko-dev,代码行数:49,代码来源:MediaEngineWebRTCAudio.cpp


示例17: do_QueryInterface

nsresult
nsPop3Sink::ReleaseFolderLock()
{
  nsresult result = NS_OK;
  if (!m_folder)
    return result;
  bool haveSemaphore;
  nsCOMPtr <nsISupports> supports = do_QueryInterface(static_cast<nsIPop3Sink*>(this));
  result = m_folder->TestSemaphore(supports, &haveSemaphore);
  MOZ_LOG(POP3LOGMODULE, mozilla::LogLevel::Debug, ("ReleaseFolderLock haveSemaphore = %s", haveSemaphore ? "TRUE" : "FALSE"));

  if(NS_SUCCEEDED(result) && haveSemaphore)
    result = m_folder->ReleaseSemaphore(supports);
  return result;
}
开发者ID:bolt-dev,项目名称:comm,代码行数:15,代码来源:nsPop3Sink.cpp


示例18: MOZ_LOG

NS_IMETHODIMP
PSMContentStreamListener::OnStopRequest(nsIRequest* request,
                                        nsISupports* context,
                                        nsresult aStatus)
{
  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CertDownloader::OnStopRequest\n"));

  // Because importing the cert can spin the event loop (via alerts), we can't
  // do it here. Do it off the event loop instead.
  nsCOMPtr<nsIRunnable> r =
    NewRunnableMethod(this, &PSMContentStreamListener::ImportCertificate);
  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r));

  return NS_OK;
}
开发者ID:lazyparser,项目名称:gecko-dev,代码行数:15,代码来源:PSMContentListener.cpp


示例19: MOZ_LOG

void
U2FTokenManager::Sign(PWebAuthnTransactionParent* aTransactionParent,
                      const uint64_t& aTransactionId,
                      const WebAuthnGetAssertionInfo& aTransactionInfo)
{
  MOZ_LOG(gU2FTokenManagerLog, LogLevel::Debug, ("U2FAuthSign"));

  ClearTransaction();
  mTransactionParent = aTransactionParent;
  mTokenManagerImpl = GetTokenManagerImpl();

  if (!mTokenManagerImpl) {
    AbortTransaction(aTransactionId, NS_ERROR_DOM_NOT_ALLOWED_ERR);
    return;
  }

  // Show a prompt that lets the user cancel the ongoing transaction.
  NS_ConvertUTF16toUTF8 origin(aTransactionInfo.Origin());
  SendPromptNotification(kSignPromptNotifcation,
                         aTransactionId,
                         origin.get());

  uint64_t tid = mLastTransactionId = aTransactionId;
  mozilla::TimeStamp startTime = mozilla::TimeStamp::Now();

  mTokenManagerImpl
    ->Sign(aTransactionInfo)
    ->Then(GetCurrentThreadSerialEventTarget(), __func__,
      [tid, startTime](WebAuthnGetAssertionResult&& aResult) {
        U2FTokenManager* mgr = U2FTokenManager::Get();
        mgr->MaybeConfirmSign(tid, aResult);
        Telemetry::ScalarAdd(
          Telemetry::ScalarID::SECURITY_WEBAUTHN_USED,
          NS_LITERAL_STRING("U2FSignFinish"), 1);
        Telemetry::AccumulateTimeDelta(
          Telemetry::WEBAUTHN_GET_ASSERTION_MS,
          startTime);
      },
      [tid](nsresult rv) {
        MOZ_ASSERT(NS_FAILED(rv));
        U2FTokenManager* mgr = U2FTokenManager::Get();
        mgr->MaybeAbortSign(tid, rv);
        Telemetry::ScalarAdd(
          Telemetry::ScalarID::SECURITY_WEBAUTHN_USED,
          NS_LITERAL_STRING("U2FSignAbort"), 1);
      })
    ->Track(mSignPromise);
}
开发者ID:marcoscaceres,项目名称:gecko-dev,代码行数:48,代码来源:U2FTokenManager.cpp


示例20: MOZ_LOG

void BrowsingContext::Detach(bool aFromIPC) {
  MOZ_LOG(GetLog(), LogLevel::Debug,
          ("%s: Detaching 0x%08" PRIx64 " from 0x%08" PRIx64,
           XRE_IsParentProcess() ? "Parent" : "Child", Id(),
           mParent ? mParent->Id() : 0));

  RefPtr<BrowsingContext> kungFuDeathGrip(this);

  BrowsingContextMap<RefPtr>::Ptr p;
  if (sCachedBrowsingContexts && (p = sCachedBrowsingContexts->lookup(Id()))) {
    MOZ_DIAGNOSTIC_ASSERT(!mParent || !mParent->mChildren.Contains(this));
    MOZ_DIAGNOSTIC_ASSERT(!mGroup || !mGroup->Toplevels().Contains(this));
    sCachedBrowsingContexts->remove(p);
  } else {
    Children* children = nullptr;
    if (mParent) {
      children = &mParent->mChildren;
    } else if (mGroup) {
      children = &mGroup->Toplevels();
    }

    if (children) {
      // TODO(farre): This assert looks extremely fishy, I know, but
      // what we're actually saying is this: if we're detaching, but our
      // parent doesn't have any children, it is because we're being
      // detached by the cycle collector destroying docshells out of
      // order.
      MOZ_DIAGNOSTIC_ASSERT(children->IsEmpty() || children->Contains(this));

      children->RemoveElement(this);
    }
  }

  if (mGroup) {
    mGroup->Unregister(this);
  }

  // As our nsDocShell is going away, this should implicitly mark us as closed.
  // We directly set our member, rather than using a transaction as we're going
  // to send a `Detach` message to other processes either way.
  mClosed = true;

  if (!aFromIPC && XRE_IsContentProcess()) {
    auto cc = ContentChild::GetSingleton();
    MOZ_DIAGNOSTIC_ASSERT(cc);
    cc->SendDetachBrowsingContext(this, false /* aMoveToBFCache */);
  }
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:48,代码来源:BrowsingContext.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ MOZ_NOT_REACHED函数代码示例发布时间:2022-05-30
下一篇:
C++ MOZ_LIKELY函数代码示例发布时间: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