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


C++ LOG_ALWAYS_FATAL_IF函数代码示例

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


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

示例1: mAllowNonCallbacks

Looper::Looper(bool allowNonCallbacks) :
        mAllowNonCallbacks(allowNonCallbacks), mSendingMessage(false),
        mResponseIndex(0), mNextMessageUptime(LLONG_MAX) {
    int wakeFds[2];
    int result = pipe(wakeFds);
    LOG_ALWAYS_FATAL_IF(result != 0, "Could not create wake pipe.  errno=%d", errno);

    mWakeReadPipeFd = wakeFds[0];
    mWakeWritePipeFd = wakeFds[1];

    result = fcntl(mWakeReadPipeFd, F_SETFL, O_NONBLOCK);
    LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake read pipe non-blocking.  errno=%d",
            errno);

    result = fcntl(mWakeWritePipeFd, F_SETFL, O_NONBLOCK);
    LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake write pipe non-blocking.  errno=%d",
            errno);

    mIdling = false;

    // Allocate the epoll instance and register the wake pipe.
    mEpollFd = epoll_create(EPOLL_SIZE_HINT);
    LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance.  errno=%d", errno);

    struct epoll_event eventItem;
    memset(& eventItem, 0, sizeof(epoll_event)); // zero out unused members of data field union
    eventItem.events = EPOLLIN;
    eventItem.data.fd = mWakeReadPipeFd;
    result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mWakeReadPipeFd, & eventItem);
    LOG_ALWAYS_FATAL_IF(result != 0, "Could not add wake read pipe to epoll instance.  errno=%d",
            errno);
}
开发者ID:00zhengfu00,项目名称:platform_system_core,代码行数:32,代码来源:Looper.cpp

示例2: ALOGD

void Looper::rebuildEpollLocked() {
    // Close old epoll instance if we have one.
    if (mEpollFd >= 0) {
#if DEBUG_CALLBACKS
        ALOGD("%p ~ rebuildEpollLocked - rebuilding epoll set", this);
#endif
        close(mEpollFd);
    }

    // Allocate the new epoll instance and register the wake pipe.
    mEpollFd = epoll_create(EPOLL_SIZE_HINT);
    LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance.  errno=%d", errno);

    struct epoll_event eventItem;
    memset(& eventItem, 0, sizeof(epoll_event)); // zero out unused members of data field union
    eventItem.events = EPOLLIN;
    eventItem.data.fd = mWakeEventFd;
    int result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mWakeEventFd, & eventItem);
    LOG_ALWAYS_FATAL_IF(result != 0, "Could not add wake event fd to epoll instance.  errno=%d",
            errno);

    for (size_t i = 0; i < mRequests.size(); i++) {
        const Request& request = mRequests.valueAt(i);
        struct epoll_event eventItem;
        request.initEventItem(&eventItem);

        int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, request.fd, & eventItem);
        if (epollResult < 0) {
            ALOGE("Error adding epoll events for fd %d while rebuilding epoll set, errno=%d",
                    request.fd, errno);
        }
    }
}
开发者ID:Bliss-Elite,项目名称:platform_system_core,代码行数:33,代码来源:Looper.cpp

示例3: javaResponse

UrlInterceptResponse::UrlInterceptResponse(JNIEnv* env, jobject response) {
    ScopedLocalRef<jclass> javaResponse(env, env->FindClass("android/webkit/WebResourceResponse"));
    LOG_ALWAYS_FATAL_IF(!javaResponse.get());
    jfieldID mimeType = env->GetFieldID(javaResponse.get(), "mMimeType", "Ljava/lang/String;");
    LOG_ALWAYS_FATAL_IF(!mimeType);
    jfieldID encoding = env->GetFieldID(javaResponse.get(), "mEncoding", "Ljava/lang/String;");
    LOG_ALWAYS_FATAL_IF(!encoding);
    jfieldID inputStream = env->GetFieldID(javaResponse.get(), "mInputStream", "Ljava/io/InputStream;");
    LOG_ALWAYS_FATAL_IF(!inputStream);

    ScopedLocalRef<jobject> stream(env, env->GetObjectField(response, inputStream));
    if (stream.get())
        m_inputStream.set(new JavaInputStreamWrapper(env, stream.get()));

    ScopedLocalRef<jstring> mimeStr(env, static_cast<jstring>(env->GetObjectField(response, mimeType)));
    ScopedLocalRef<jstring> encodingStr(env, static_cast<jstring>(env->GetObjectField(response, encoding)));

    if (mimeStr.get()) {
        const char* s = env->GetStringUTFChars(mimeStr.get(), NULL);
        m_mimeType.assign(s, env->GetStringUTFLength(mimeStr.get()));
        env->ReleaseStringUTFChars(mimeStr.get(), s);
    }
    if (encodingStr.get()) {
        const char* s = env->GetStringUTFChars(encodingStr.get(), NULL);
        m_encoding.assign(s, env->GetStringUTFLength(encodingStr.get()));
        env->ReleaseStringUTFChars(encodingStr.get(), s);
    }
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:28,代码来源:UrlInterceptResponse.cpp

示例4: RegisterDrawGLFunctor

void RegisterDrawGLFunctor(JNIEnv* env) {
  jclass clazz = env->FindClass(kClassName);
  LOG_ALWAYS_FATAL_IF(!clazz, "Unable to find class '%s'", kClassName);

  int res = env->RegisterNatives(clazz, kJniMethods, NELEM(kJniMethods));
  LOG_ALWAYS_FATAL_IF(res < 0, "register native methods failed: res=%d", res);
}
开发者ID:MIPS,项目名称:frameworks-webview,代码行数:7,代码来源:draw_gl_functor.cpp

示例5: LOG_ALWAYS_FATAL_IF

void EglDisplayImpl::OnGraphicsContextsLost() {
  lock_.Lock();

  LOG_ALWAYS_FATAL_IF(invalidated_);
  invalidated_ = true;

  while (color_buffers_locked_) {
    cond_no_locked_buffers_.Wait(lock_);
  }

  BindLocked();

  LOG_ALWAYS_FATAL_IF(!invalidated_);

  // color_buffers_ is not locked by display lock.
  ColorBufferRegistry::ObjectList color_buffers =
      color_buffers_.GetAllObjects();
  for (ColorBufferRegistry::ObjectList::const_iterator iter =
      color_buffers.begin(); iter != color_buffers.end(); ++iter) {
    (*iter)->DeleteTextureLocked();
  }

  ContextRegistry::ObjectList contexts = contexts_.GetAllObjects();
  for (ContextRegistry::ObjectList::const_iterator iter_context =
       contexts.begin(); iter_context != contexts.end(); ++iter_context) {
    (*iter_context)->GetGlesContext()->Invalidate();
  }

  UnbindLocked();
  lock_.Unlock();
}
开发者ID:epowers,项目名称:arc,代码行数:31,代码来源:egl_display_impl.cpp

示例6: load_driver

void* Loader::open(egl_connection_t* cnx)
{
    void* dso;
    driver_t* hnd = 0;

    dso = load_driver("GLES", cnx, EGL | GLESv1_CM | GLESv2);
    if (dso) {
        hnd = new driver_t(dso);
    } else {
        // Always load EGL first
        dso = load_driver("EGL", cnx, EGL);
        if (dso) {
            hnd = new driver_t(dso);
            hnd->set( load_driver("GLESv1_CM", cnx, GLESv1_CM), GLESv1_CM );
            hnd->set( load_driver("GLESv2",    cnx, GLESv2),    GLESv2 );
        }
    }

    LOG_ALWAYS_FATAL_IF(!hnd, "couldn't find an OpenGL ES implementation");

    cnx->libGles2 = load_wrapper("/system/lib/libGLESv2.so");
    cnx->libGles1 = load_wrapper("/system/lib/libGLESv1_CM.so");
    LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1,
            "couldn't load system OpenGL ES wrapper libraries");

    return (void*)hnd;
}
开发者ID:artemrudoj,项目名称:ll,代码行数:27,代码来源:Loader.cpp

示例7: name

status_t SensorManager::assertStateLocked() const {
    bool initSensorManager = false;
    if (mSensorServer == NULL) {
        initSensorManager = true;
    } else {
        // Ping binder to check if sensorservice is alive.
        status_t err = IInterface::asBinder(mSensorServer)->pingBinder();
        if (err != NO_ERROR) {
            initSensorManager = true;
        }
    }
    if (initSensorManager) {
        // try for 300 seconds (60*5(getService() tries for 5 seconds)) before giving up ...
        const String16 name("sensorservice");
        for (int i = 0; i < 60; i++) {
            status_t err = getService(name, &mSensorServer);
            if (err == NAME_NOT_FOUND) {
                sleep(1);
                continue;
            }
            if (err != NO_ERROR) {
                return err;
            }
            break;
        }

        class DeathObserver : public IBinder::DeathRecipient {
            SensorManager& mSensorManger;
            virtual void binderDied(const wp<IBinder>& who) {
                ALOGW("sensorservice died [%p]", who.unsafe_get());
                mSensorManger.sensorManagerDied();
            }
        public:
            explicit DeathObserver(SensorManager& mgr) : mSensorManger(mgr) { }
        };

        LOG_ALWAYS_FATAL_IF(mSensorServer.get() == NULL, "getService(SensorService) NULL");

        mDeathObserver = new DeathObserver(*const_cast<SensorManager *>(this));
        IInterface::asBinder(mSensorServer)->linkToDeath(mDeathObserver);

        mSensors = mSensorServer->getSensorList(mOpPackageName);
        size_t count = mSensors.size();
        mSensorList =
                static_cast<Sensor const**>(malloc(count * sizeof(Sensor*)));
        LOG_ALWAYS_FATAL_IF(mSensorList == NULL, "mSensorList NULL");

        for (size_t i=0 ; i<count ; i++) {
            mSensorList[i] = mSensors.array() + i;
        }
    }

    return NO_ERROR;
}
开发者ID:TeamEOS,项目名称:frameworks_native,代码行数:54,代码来源:SensorManager.cpp

示例8: LOG_ALWAYS_FATAL_IF

void RenderThread::initializeDisplayEventReceiver() {
    LOG_ALWAYS_FATAL_IF(mDisplayEventReceiver, "Initializing a second DisplayEventReceiver?");
    mDisplayEventReceiver = new DisplayEventReceiver();
    status_t status = mDisplayEventReceiver->initCheck();
    LOG_ALWAYS_FATAL_IF(status != NO_ERROR, "Initialization of DisplayEventReceiver "
            "failed with status: %d", status);

    // Register the FD
    mLooper->addFd(mDisplayEventReceiver->getFd(), 0,
            Looper::EVENT_INPUT, RenderThread::displayEventReceiverCallback, this);
}
开发者ID:debian-pkg-android-tools,项目名称:android-platform-frameworks-base,代码行数:11,代码来源:RenderThread.cpp

示例9: JavaInputStreamWrapper

 JavaInputStreamWrapper(JNIEnv* env, jobject inputStream)
         : m_inputStream(env->NewGlobalRef(inputStream))
         , m_buffer(NULL) {
     LOG_ALWAYS_FATAL_IF(!m_inputStream);
     ScopedLocalRef<jclass> inputStreamClass(env, env->FindClass("java/io/InputStream"));
     LOG_ALWAYS_FATAL_IF(!inputStreamClass.get());
     m_read = env->GetMethodID(inputStreamClass.get(), "read", "([B)I");
     LOG_ALWAYS_FATAL_IF(!m_read);
     m_close = env->GetMethodID(inputStreamClass.get(), "close", "()V");
     LOG_ALWAYS_FATAL_IF(!m_close);
 }
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:11,代码来源:UrlInterceptResponse.cpp

示例10: JavaInputStreamWrapper

 JavaInputStreamWrapper(JNIEnv* env, jobject inputStream)
         : m_inputStream(env->NewGlobalRef(inputStream))
         , m_buffer(0) {
     LOG_ALWAYS_FATAL_IF(!inputStream);
     jclass inputStreamClass = env->FindClass("java/io/InputStream");
     LOG_ALWAYS_FATAL_IF(!inputStreamClass);
     m_read = env->GetMethodID(inputStreamClass, "read", "([B)I");
     LOG_ALWAYS_FATAL_IF(!m_read);
     m_close = env->GetMethodID(inputStreamClass, "close", "()V");
     LOG_ALWAYS_FATAL_IF(!m_close);
     env->DeleteLocalRef(inputStreamClass);
 }
开发者ID:ACSOP,项目名称:android_external_webkit,代码行数:12,代码来源:UrlInterceptResponse.cpp

示例11: capturePixels

    bool capturePixels(SkBitmap* bmp) {
        sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeSRGB();
        SkImageInfo destinationConfig =
                SkImageInfo::Make(mSize.width(), mSize.height(), kRGBA_8888_SkColorType,
                                  kPremul_SkAlphaType, colorSpace);
        bmp->allocPixels(destinationConfig);
        android_memset32((uint32_t*)bmp->getPixels(), SK_ColorRED,
                         mSize.width() * mSize.height() * 4);

        android::CpuConsumer::LockedBuffer nativeBuffer;
        android::status_t retval = mCpuConsumer->lockNextBuffer(&nativeBuffer);
        if (retval == android::BAD_VALUE) {
            SkDebugf("write_canvas_png() got no buffer; returning transparent");
            // No buffer ready to read - commonly triggered by dm sending us
            // a no-op source, or calling code that doesn't do anything on this
            // backend.
            bmp->eraseColor(SK_ColorTRANSPARENT);
            return false;
        } else if (retval) {
            SkDebugf("Failed to lock buffer to read pixels: %d.", retval);
            return false;
        }

        // Move the pixels into the destination SkBitmap

        LOG_ALWAYS_FATAL_IF(nativeBuffer.format != android::PIXEL_FORMAT_RGBA_8888,
                            "Native buffer not RGBA!");
        SkImageInfo nativeConfig = SkImageInfo::Make(nativeBuffer.width, nativeBuffer.height,
                                                     kRGBA_8888_SkColorType, kPremul_SkAlphaType);

        // Android stride is in pixels, Skia stride is in bytes
        SkBitmap nativeWrapper;
        bool success = nativeWrapper.installPixels(nativeConfig, nativeBuffer.data,
                                                   nativeBuffer.stride * 4);
        if (!success) {
            SkDebugf("Failed to wrap HWUI buffer in a SkBitmap");
            return false;
        }

        LOG_ALWAYS_FATAL_IF(bmp->colorType() != kRGBA_8888_SkColorType,
                            "Destination buffer not RGBA!");
        success = nativeWrapper.readPixels(destinationConfig, bmp->getPixels(), bmp->rowBytes(), 0,
                                           0);
        if (!success) {
            SkDebugf("Failed to extract pixels from HWUI buffer");
            return false;
        }

        mCpuConsumer->unlockBuffer(nativeBuffer);

        return true;
    }
开发者ID:AlanCheen,项目名称:platform_frameworks_base,代码行数:52,代码来源:TestWindowContext.cpp

示例12: LOG_ALWAYS_FATAL_IF

void StaticAudioTrackServerProxy::releaseBuffer(Buffer* buffer)
{
    size_t stepCount = buffer->mFrameCount;
    LOG_ALWAYS_FATAL_IF(!((int64_t) stepCount <= mFramesReady));
    LOG_ALWAYS_FATAL_IF(!(stepCount <= mUnreleased));
    if (stepCount == 0) {
        // prevent accidental re-use of buffer
        buffer->mRaw = NULL;
        buffer->mNonContig = 0;
        return;
    }
    mUnreleased -= stepCount;
    audio_track_cblk_t* cblk = mCblk;
    size_t position = mState.mPosition;
    size_t newPosition = position + stepCount;
    int32_t setFlags = 0;
    if (!(position <= newPosition && newPosition <= mFrameCount)) {
        ALOGW("%s newPosition %zu outside [%zu, %zu]", __func__, newPosition, position,
                mFrameCount);
        newPosition = mFrameCount;
    } else if (mState.mLoopCount != 0 && newPosition == mState.mLoopEnd) {
        newPosition = mState.mLoopStart;
        if (mState.mLoopCount == -1 || --mState.mLoopCount != 0) {
            setFlags = CBLK_LOOP_CYCLE;
        } else {
            setFlags = CBLK_LOOP_FINAL;
        }
    }
    if (newPosition == mFrameCount) {
        setFlags |= CBLK_BUFFER_END;
    }
    mState.mPosition = newPosition;
    if (mFramesReady != INT64_MAX) {
        mFramesReady -= stepCount;
    }
    mFramesReadySafe = clampToSize(mFramesReady);

    cblk->mServer += stepCount;
    // This may overflow, but client is not supposed to rely on it
    StaticAudioTrackPosLoop posLoop;
    posLoop.mBufferPosition = mState.mPosition;
    posLoop.mLoopCount = mState.mLoopCount;
    mPosLoopMutator.push(posLoop);
    if (setFlags != 0) {
        (void) android_atomic_or(setFlags, &cblk->mFlags);
        // this would be a good place to wake a futex
    }

    buffer->mFrameCount = 0;
    buffer->mRaw = NULL;
    buffer->mNonContig = 0;
}
开发者ID:mnemonyc,项目名称:platform_frameworks_av,代码行数:52,代码来源:AudioTrackShared.cpp

示例13: mDriverFD

ProcessState::ProcessState()
    : mDriverFD(open_driver())
    , mVMStart(MAP_FAILED)
    , mManagesContexts(false)
    , mBinderContextCheckFunc(NULL)
    , mBinderContextUserData(NULL)
    , mThreadPoolStarted(false)
    , mThreadPoolSeq(1)
{
    if (mDriverFD >= 0) {
        // XXX Ideally, there should be a specific define for whether we
        // have mmap (or whether we could possibly have the kernel module
        // availabla).
#if !defined(HAVE_WIN32_IPC)
        // mmap the binder, providing a chunk of virtual address space to receive transactions.
        mVMStart = mmap(0, BINDER_VM_SIZE, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0);
        if (mVMStart == MAP_FAILED) {
            // *sigh*
            ALOGE("Using /dev/binder failed: unable to mmap transaction memory.\n");
            close(mDriverFD);
            mDriverFD = -1;
        }
#else
        mDriverFD = -1;
#endif
    }

    LOG_ALWAYS_FATAL_IF(mDriverFD < 0, "Binder driver could not be opened.  Terminating.");
}
开发者ID:Proshivalskiy,项目名称:MT6582_kernel_source,代码行数:29,代码来源:ProcessState.cpp

示例14: blockOnPrecache

 void blockOnPrecache() {
     if (mTask != NULL) {
         mBuffer = mTask->getResult();
         LOG_ALWAYS_FATAL_IF(mBuffer == NULL, "Failed to precache");
         mTask.clear();
     }
 }
开发者ID:voidz777,项目名称:android_frameworks_base-zmod,代码行数:7,代码来源:TessellationCache.cpp

示例15: LOG_ALWAYS_FATAL_IF

status_t BpBinder::linkToDeath(
    const sp<DeathRecipient>& recipient, void* cookie, uint32_t flags)
{
    Obituary ob;
    ob.recipient = recipient;
    ob.cookie = cookie;
    ob.flags = flags;

    LOG_ALWAYS_FATAL_IF(recipient == NULL,
                        "linkToDeath(): recipient must be non-NULL");

    {
        AutoMutex _l(mLock);

        if (!mObitsSent) {
            if (!mObituaries) {
                mObituaries = new Vector<Obituary>;
                if (!mObituaries) {
                    return NO_MEMORY;
                }
                ALOGV("Requesting death notification: %p handle %d\n", this, mHandle);
                getWeakRefs()->incWeak(this);
                IPCThreadState* self = IPCThreadState::self();
                self->requestDeathNotification(mHandle, this);
                self->flushCommands();
            }
            ssize_t res = mObituaries->add(ob);
            return res >= (ssize_t)NO_ERROR ? (status_t)NO_ERROR : res;
        }
    }

    return DEAD_OBJECT;
}
开发者ID:3dsfr3ak,项目名称:android_frameworks_native,代码行数:33,代码来源:BpBinder.cpp


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