本文整理汇总了C++中PROFILER_LABEL函数的典型用法代码示例。如果您正苦于以下问题:C++ PROFILER_LABEL函数的具体用法?C++ PROFILER_LABEL怎么用?C++ PROFILER_LABEL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PROFILER_LABEL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PR_IntervalNow
void
SimpleTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
const nsIntRegion& aPaintRegion,
LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData)
{
mCallback = aCallback;
mCallbackData = aCallbackData;
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
long start = PR_IntervalNow();
#endif
// If this region is empty XMost() - 1 will give us a negative value.
NS_ASSERTION(!aPaintRegion.GetBounds().IsEmpty(), "Empty paint region\n");
PROFILER_LABEL("SimpleTiledLayerBuffer", "PaintThebesUpdate");
Update(aNewValidRegion, aPaintRegion);
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
if (PR_IntervalNow() - start > 10) {
const nsIntRect bounds = aPaintRegion.GetBounds();
printf_stderr("Time to tile [%i, %i, %i, %i] -> %i\n", bounds.x, bounds.y, bounds.width, bounds.height, PR_IntervalNow() - start);
}
#endif
mLastPaintOpaque = mThebesLayer->CanUseOpaqueSurface();
mCallback = nullptr;
mCallbackData = nullptr;
}
示例2: MOZ_ASSERT
nsresult
WebMWriter::SetMetadata(TrackMetadataBase* aMetadata)
{
MOZ_ASSERT(aMetadata);
PROFILER_LABEL("WebMWriter", "SetMetadata",
js::ProfileEntry::Category::OTHER);
if (aMetadata->GetKind() == TrackMetadataBase::METADATA_VP8) {
VP8Metadata* meta = static_cast<VP8Metadata*>(aMetadata);
MOZ_ASSERT(meta, "Cannot find vp8 encoder metadata");
mEbmlComposer->SetVideoConfig(meta->mWidth, meta->mHeight,
meta->mDisplayWidth, meta->mDisplayHeight,
meta->mEncodedFrameRate);
mMetadataRequiredFlag = mMetadataRequiredFlag & ~ContainerWriter::CREATE_VIDEO_TRACK;
}
if (aMetadata->GetKind() == TrackMetadataBase::METADATA_VORBIS) {
VorbisMetadata* meta = static_cast<VorbisMetadata*>(aMetadata);
MOZ_ASSERT(meta, "Cannot find vorbis encoder metadata");
mEbmlComposer->SetAudioConfig(meta->mSamplingFrequency, meta->mChannels, meta->mBitDepth);
mEbmlComposer->SetAudioCodecPrivateData(meta->mData);
mMetadataRequiredFlag = mMetadataRequiredFlag & ~ContainerWriter::CREATE_AUDIO_TRACK;
}
if (!mMetadataRequiredFlag) {
mEbmlComposer->GenerateHeader();
}
return NS_OK;
}
示例3: PROFILER_LABEL
uint32_t
nsInputStreamPump::OnStateStart()
{
PROFILER_LABEL("nsInputStreamPump", "OnStateStart");
LOG((" OnStateStart [this=%p]\n", this));
nsresult rv;
// need to check the reason why the stream is ready. this is required
// so our listener can check our status from OnStartRequest.
// XXX async streams should have a GetStatus method!
if (NS_SUCCEEDED(mStatus)) {
uint64_t avail;
rv = mAsyncStream->Available(&avail);
if (NS_FAILED(rv) && rv != NS_BASE_STREAM_CLOSED)
mStatus = rv;
}
rv = mListener->OnStartRequest(this, mListenerContext);
// an error returned from OnStartRequest should cause us to abort; however,
// we must not stomp on mStatus if already canceled.
if (NS_FAILED(rv) && NS_SUCCEEDED(mStatus))
mStatus = rv;
return NS_SUCCEEDED(mStatus) ? STATE_TRANSFER : STATE_STOP;
}
示例4: PROFILER_LABEL
NS_IMETHODIMP
nsIncrementalStreamLoader::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
nsresult aStatus)
{
PROFILER_LABEL("nsIncrementalStreamLoader", "OnStopRequest",
js::ProfileEntry::Category::NETWORK);
if (mObserver) {
// provide nsIIncrementalStreamLoader::request during call to OnStreamComplete
mRequest = request;
size_t length = mData.length();
uint8_t* elems = mData.extractOrCopyRawBuffer();
nsresult rv = mObserver->OnStreamComplete(this, mContext, aStatus,
length, elems);
if (rv != NS_SUCCESS_ADOPTED_DATA) {
// The observer didn't take ownership of the extracted data buffer, so
// put it back into mData.
mData.replaceRawBuffer(elems, length);
}
// done.. cleanup
ReleaseData();
mRequest = 0;
mObserver = 0;
mContext = 0;
}
return NS_OK;
}
示例5: PROFILER_LABEL
already_AddRefed<TrackMetadataBase>
OmxVideoTrackEncoder::GetMetadata()
{
PROFILER_LABEL("OmxVideoTrackEncoder", "GetMetadata",
js::ProfileEntry::Category::OTHER);
{
// Wait if mEncoder is not initialized nor is being canceled.
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
while (!mCanceled && !mInitialized) {
mReentrantMonitor.Wait();
}
}
if (mCanceled || mEncodingComplete) {
return nullptr;
}
nsRefPtr<AVCTrackMetadata> meta = new AVCTrackMetadata();
meta->mWidth = mFrameWidth;
meta->mHeight = mFrameHeight;
meta->mDisplayWidth = mDisplayWidth;
meta->mDisplayHeight = mDisplayHeight;
meta->mFrameRate = ENCODER_CONFIG_FRAME_RATE;
return meta.forget();
}
示例6: PROFILER_LABEL
nsresult
MediaEncoder::WriteEncodedDataToMuxer(TrackEncoder *aTrackEncoder)
{
if (aTrackEncoder == nullptr) {
return NS_OK;
}
if (aTrackEncoder->IsEncodingComplete()) {
return NS_OK;
}
PROFILER_LABEL("MediaEncoder", "WriteEncodedDataToMuxer",
js::ProfileEntry::Category::OTHER);
EncodedFrameContainer encodedVideoData;
nsresult rv = aTrackEncoder->GetEncodedTrack(encodedVideoData);
if (NS_FAILED(rv)) {
// Encoding might be canceled.
LOG(PR_LOG_ERROR, ("Error! Fail to get encoded data from video encoder."));
mState = ENCODE_ERROR;
return rv;
}
rv = mWriter->WriteEncodedTrack(encodedVideoData,
aTrackEncoder->IsEncodingComplete() ?
ContainerWriter::END_OF_STREAM : 0);
if (NS_FAILED(rv)) {
LOG(PR_LOG_ERROR, ("Error! Fail to write encoded video track to the media container."));
mState = ENCODE_ERROR;
}
return rv;
}
示例7: PROFILER_LABEL
NS_IMETHODIMP
PluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
{
PROFILER_LABEL("PluginStreamListener", "OnStartRequest",
js::ProfileEntry::Category::NETWORK);
nsCOMPtr<nsIContent> embed = mPluginDoc->GetPluginContent();
nsCOMPtr<nsIObjectLoadingContent> objlc = do_QueryInterface(embed);
nsCOMPtr<nsIStreamListener> objListener = do_QueryInterface(objlc);
if (!objListener) {
NS_NOTREACHED("PluginStreamListener without appropriate content node");
return NS_BINDING_ABORTED;
}
SetStreamListener(objListener);
// Sets up the ObjectLoadingContent tag as if it is waiting for a
// channel, so it can proceed with a load normally once it gets OnStartRequest
nsresult rv = objlc->InitializeFromChannel(request);
if (NS_FAILED(rv)) {
NS_NOTREACHED("InitializeFromChannel failed");
return rv;
}
// Note that because we're now hooked up to a plugin listener, this will
// likely spawn a plugin, which may re-enter.
return MediaDocumentStreamListener::OnStartRequest(request, ctxt);
}
示例8: PROFILER_LABEL
void
Decoder::Write(const char* aBuffer, uint32_t aCount)
{
PROFILER_LABEL("ImageDecoder", "Write");
// We're strict about decoder errors
NS_ABORT_IF_FALSE(!HasDecoderError(),
"Not allowed to make more decoder calls after error!");
// If a data error occured, just ignore future data
if (HasDataError())
return;
if (IsSizeDecode() && HasSize()) {
// More data came in since we found the size. We have nothing to do here.
return;
}
// Pass the data along to the implementation
WriteInternal(aBuffer, aCount);
// If we're a synchronous decoder and we need a new frame to proceed, let's
// create one and call it again.
while (mSynchronous && NeedsNewFrame() && !HasDataError()) {
nsresult rv = AllocateFrame();
if (NS_SUCCEEDED(rv)) {
// Tell the decoder to use the data it saved when it asked for a new frame.
WriteInternal(nullptr, 0);
}
}
}
示例9: PROFILER_LABEL
void
ClientCanvasLayer::RenderLayer()
{
PROFILER_LABEL("ClientCanvasLayer", "RenderLayer",
js::ProfileEntry::Category::GRAPHICS);
RenderMaskLayers(this);
if (!mCanvasClient) {
TextureFlags flags = TextureFlags::IMMEDIATE_UPLOAD;
if (mOriginPos == gl::OriginPos::BottomLeft) {
flags |= TextureFlags::ORIGIN_BOTTOM_LEFT;
}
if (!mGLContext) {
// We don't support locking for buffer surfaces currently
flags |= TextureFlags::IMMEDIATE_UPLOAD;
}
if (!mIsAlphaPremultiplied) {
flags |= TextureFlags::NON_PREMULTIPLIED;
}
mCanvasClient = CanvasClient::CreateCanvasClient(GetCanvasClientType(),
ClientManager()->AsShadowForwarder(),
flags);
if (!mCanvasClient) {
return;
}
if (HasShadow()) {
if (mAsyncRenderer) {
static_cast<CanvasClientBridge*>(mCanvasClient.get())->SetLayer(this);
} else {
mCanvasClient->Connect();
ClientManager()->AsShadowForwarder()->Attach(mCanvasClient, this);
}
}
}
if (mCanvasClient && mAsyncRenderer) {
mCanvasClient->UpdateAsync(mAsyncRenderer);
}
if (!IsDirty()) {
return;
}
Painted();
FirePreTransactionCallback();
if (mBufferProvider && mBufferProvider->GetTextureClient()) {
mCanvasClient->UpdateFromTexture(mBufferProvider->GetTextureClient());
} else {
mCanvasClient->Update(gfx::IntSize(mBounds.width, mBounds.height), this);
}
FireDidTransactionCallback();
ClientManager()->Hold(this);
mCanvasClient->Updated();
}
示例10: NS_ENSURE_SUCCESS
nsresult
SVGIFrameElement::BindToTree(nsIDocument* aDocument,
nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
nsresult rv = nsSVGElement::BindToTree(aDocument, aParent,
aBindingParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
if (aDocument) {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"Missing a script blocker!");
PROFILER_LABEL("SVGIFrameElement", "BindToTree",
js::ProfileEntry::Category::OTHER);
// We're in a document now. Kick off the frame load.
LoadSrc();
if (HasAttr(kNameSpaceID_None, nsGkAtoms::sandbox)) {
if (mFrameLoader) {
mFrameLoader->ApplySandboxFlags(GetSandboxFlags());
}
}
}
// We're now in document and scripts may move us, so clear
// the mNetworkCreated flag.
mNetworkCreated = false;
return rv;
}
示例11: PROFILER_LABEL
SharedSurface*
SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory,
const gfxIntSize& size)
{
PROFILER_LABEL("SurfaceStream_TripleBuffer", "SwapProducer");
MonitorAutoLock lock(mMonitor);
if (mProducer) {
RecycleScraps(factory);
// If WaitForCompositor succeeds, mStaging has moved to mConsumer.
// If it failed, we might have to scrap it.
if (mStaging && !WaitForCompositor())
Scrap(mStaging);
MOZ_ASSERT(!mStaging);
Move(mProducer, mStaging);
mStaging->Fence();
}
MOZ_ASSERT(!mProducer);
New(factory, size, mProducer);
return mProducer;
}
示例12: MOZ_ASSERT
nsresult
OggWriter::SetMetadata(TrackMetadataBase* aMetadata)
{
MOZ_ASSERT(aMetadata);
PROFILER_LABEL("OggWriter", "SetMetadata",
js::ProfileEntry::Category::OTHER);
if (aMetadata->GetKind() != TrackMetadataBase::METADATA_OPUS) {
LOG("wrong meta data type!");
return NS_ERROR_FAILURE;
}
// Validate each field of METADATA
mMetadata = static_cast<OpusMetadata*>(aMetadata);
if (mMetadata->mIdHeader.Length() == 0) {
LOG("miss mIdHeader!");
return NS_ERROR_FAILURE;
}
if (mMetadata->mCommentHeader.Length() == 0) {
LOG("miss mCommentHeader!");
return NS_ERROR_FAILURE;
}
return NS_OK;
}
示例13: PROFILER_LABEL
/*static*/ already_AddRefed<gfxASurface>
ShadowLayerForwarder::PlatformOpenDescriptor(OpenMode aMode,
const SurfaceDescriptor& aSurface)
{
PROFILER_LABEL("ShadowLayerForwarder", "PlatformOpenDescriptor");
if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aSurface.type()) {
return nullptr;
}
sp<GraphicBuffer> buffer =
GrallocBufferActor::GetFrom(aSurface.get_SurfaceDescriptorGralloc());
uint32_t usage = GRALLOC_USAGE_SW_READ_OFTEN;
if (OPEN_READ_WRITE == aMode) {
usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;
}
void *vaddr;
DebugOnly<status_t> status = buffer->lock(usage, &vaddr);
// If we fail to lock, we'll just end up aborting anyway.
MOZ_ASSERT(status == OK);
gfxIntSize size = aSurface.get_SurfaceDescriptorGralloc().size();
gfxImageFormat format = ImageFormatForPixelFormat(buffer->getPixelFormat());
long pixelStride = buffer->getStride();
long byteStride = pixelStride * gfxASurface::BytePerPixelFromFormat(format);
nsRefPtr<gfxASurface> surf =
new gfxImageSurface((unsigned char*)vaddr, size, byteStride, format);
return surf->CairoStatus() ? nullptr : surf.forget();
}
示例14: MOZ_ASSERT
uint32_t
nsInputStreamPump::OnStateStop()
{
mMonitor.AssertCurrentThreadIn();
if (!NS_IsMainThread()) {
// Hopefully temporary hack: OnStateStop should only run on the main
// thread, but we're seeing some rare off-main-thread calls. For now
// just redispatch to the main thread in release builds, and crash in
// debug builds.
MOZ_ASSERT(NS_IsMainThread(),
"OnStateStop should only be called on the main thread.");
nsresult rv = NS_DispatchToMainThread(
NewRunnableMethod(this, &nsInputStreamPump::CallOnStateStop));
NS_ENSURE_SUCCESS(rv, STATE_IDLE);
return STATE_IDLE;
}
PROFILER_LABEL("nsInputStreamPump", "OnStateStop",
js::ProfileEntry::Category::NETWORK);
LOG((" OnStateStop [this=%p status=%x]\n", this, mStatus));
// if an error occurred, we must be sure to pass the error onto the async
// stream. in some cases, this is redundant, but since close is idempotent,
// this is OK. otherwise, be sure to honor the "close-when-done" option.
if (!mAsyncStream || !mListener) {
MOZ_ASSERT(mAsyncStream, "null mAsyncStream: OnStateStop called twice?");
MOZ_ASSERT(mListener, "null mListener: OnStateStop called twice?");
return STATE_IDLE;
}
if (NS_FAILED(mStatus))
mAsyncStream->CloseWithStatus(mStatus);
else if (mCloseWhenDone)
mAsyncStream->Close();
mAsyncStream = 0;
mTargetThread = 0;
mIsPending = false;
{
// Note: Must exit monitor for call to OnStartRequest to avoid
// deadlocks when calls to RetargetDeliveryTo for multiple
// nsInputStreamPumps are needed (e.g. nsHttpChannel).
mMonitor.Exit();
mListener->OnStopRequest(this, mListenerContext, mStatus);
mMonitor.Enter();
}
mListener = 0;
mListenerContext = 0;
if (mLoadGroup)
mLoadGroup->RemoveRequest(this, nullptr, mStatus);
return STATE_IDLE;
}
示例15: PROFILER_LABEL
void
ClientThebesLayer::PaintThebes()
{
PROFILER_LABEL("ClientThebesLayer", "PaintThebes");
NS_ASSERTION(ClientManager()->InDrawing(),
"Can only draw in drawing phase");
//TODO: This is going to copy back pixels that we might end up
// drawing over anyway. It would be nice if we could avoid
// this duplication.
mContentClient->SyncFrontBufferToBackBuffer();
bool canUseOpaqueSurface = CanUseOpaqueSurface();
ContentType contentType =
canUseOpaqueSurface ? GFX_CONTENT_COLOR :
GFX_CONTENT_COLOR_ALPHA;
{
uint32_t flags = 0;
#ifndef MOZ_WIDGET_ANDROID
if (ClientManager()->CompositorMightResample()) {
flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE;
}
if (!(flags & ThebesLayerBuffer::PAINT_WILL_RESAMPLE)) {
if (MayResample()) {
flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE;
}
}
#endif
PaintState state =
mContentClient->BeginPaintBuffer(this, contentType, flags);
mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate);
if (state.mContext) {
// The area that became invalid and is visible needs to be repainted
// (this could be the whole visible area if our buffer switched
// from RGB to RGBA, because we might need to repaint with
// subpixel AA)
state.mRegionToInvalidate.And(state.mRegionToInvalidate,
GetEffectiveVisibleRegion());
nsIntRegion extendedDrawRegion = state.mRegionToDraw;
SetAntialiasingFlags(this, state.mContext);
PaintBuffer(state.mContext,
state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate,
state.mDidSelfCopy, state.mClip);
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this));
Mutated();
} else {
// It's possible that state.mRegionToInvalidate is nonempty here,
// if we are shrinking the valid region to nothing. So use mRegionToDraw
// instead.
NS_WARN_IF_FALSE(state.mRegionToDraw.IsEmpty(),
"No context when we have something to draw, resource exhaustion?");
}
}
}