当前位置: 首页>>代码示例>>C++>>正文


C++ MOZ_LOG函数代码示例

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


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


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