diff options
Diffstat (limited to 'libs/binder/ProcessState.cpp')
-rw-r--r-- | libs/binder/ProcessState.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 860612983f..6e7c427b12 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -68,7 +68,7 @@ protected: sp<ProcessState> ProcessState::self() { Mutex::Autolock _l(gProcessMutex); - if (gProcess != NULL) { + if (gProcess != nullptr) { return gProcess; } gProcess = new ProcessState("/dev/binder"); @@ -78,7 +78,7 @@ sp<ProcessState> ProcessState::self() sp<ProcessState> ProcessState::initWithDriver(const char* driver) { Mutex::Autolock _l(gProcessMutex); - if (gProcess != NULL) { + if (gProcess != nullptr) { // Allow for initWithDriver to be called repeatedly with the same // driver. if (!strcmp(gProcess->getDriverName().c_str(), driver)) { @@ -122,18 +122,18 @@ sp<IBinder> ProcessState::getContextObject(const String16& name, const sp<IBinde { mLock.lock(); sp<IBinder> object( - mContexts.indexOfKey(name) >= 0 ? mContexts.valueFor(name) : NULL); + mContexts.indexOfKey(name) >= 0 ? mContexts.valueFor(name) : nullptr); mLock.unlock(); //printf("Getting context object %s for %p\n", String8(name).string(), caller.get()); - if (object != NULL) return object; + if (object != nullptr) return object; // Don't attempt to retrieve contexts if we manage them if (mManagesContexts) { ALOGE("getContextObject(%s) failed, but we manage the contexts!\n", String8(name).string()); - return NULL; + return nullptr; } IPCThreadState* ipc = IPCThreadState::self(); @@ -150,7 +150,7 @@ sp<IBinder> ProcessState::getContextObject(const String16& name, const sp<IBinde ipc->flushCommands(); - if (object != NULL) setContextObject(object, name); + if (object != nullptr) setContextObject(object, name); return object; } @@ -180,8 +180,8 @@ bool ProcessState::becomeContextManager(context_check_func checkFunc, void* user if (result == 0) { mManagesContexts = true; } else if (result == -1) { - mBinderContextCheckFunc = NULL; - mBinderContextUserData = NULL; + mBinderContextCheckFunc = nullptr; + mBinderContextUserData = nullptr; ALOGE("Binder ioctl to become context manager failed: %s\n", strerror(errno)); } } @@ -207,7 +207,7 @@ ssize_t ProcessState::getKernelReferences(size_t buf_count, uintptr_t* buf) binder_node_debug_info info = {}; - uintptr_t* end = buf ? buf + buf_count : NULL; + uintptr_t* end = buf ? buf + buf_count : nullptr; size_t count = 0; do { @@ -233,10 +233,10 @@ ProcessState::handle_entry* ProcessState::lookupHandleLocked(int32_t handle) const size_t N=mHandleToObject.size(); if (N <= (size_t)handle) { handle_entry e; - e.binder = NULL; - e.refs = NULL; + e.binder = nullptr; + e.refs = nullptr; status_t err = mHandleToObject.insertAt(e, N, handle+1-N); - if (err < NO_ERROR) return NULL; + if (err < NO_ERROR) return nullptr; } return &mHandleToObject.editItemAt(handle); } @@ -249,12 +249,12 @@ sp<IBinder> ProcessState::getStrongProxyForHandle(int32_t handle) handle_entry* e = lookupHandleLocked(handle); - if (e != NULL) { + if (e != nullptr) { // We need to create a new BpBinder if there isn't currently one, OR we // are unable to acquire a weak reference on this current one. See comment // in getWeakProxyForHandle() for more info about this. IBinder* b = e->binder; - if (b == NULL || !e->refs->attemptIncWeak(this)) { + if (b == nullptr || !e->refs->attemptIncWeak(this)) { if (handle == 0) { // Special case for context manager... // The context manager is the only object for which we create @@ -277,9 +277,9 @@ sp<IBinder> ProcessState::getStrongProxyForHandle(int32_t handle) Parcel data; status_t status = IPCThreadState::self()->transact( - 0, IBinder::PING_TRANSACTION, data, NULL, 0); + 0, IBinder::PING_TRANSACTION, data, nullptr, 0); if (status == DEAD_OBJECT) - return NULL; + return nullptr; } b = new BpBinder(handle); @@ -306,7 +306,7 @@ wp<IBinder> ProcessState::getWeakProxyForHandle(int32_t handle) handle_entry* e = lookupHandleLocked(handle); - if (e != NULL) { + if (e != nullptr) { // We need to create a new BpBinder if there isn't currently one, OR we // are unable to acquire a weak reference on this current one. The // attemptIncWeak() is safe because we know the BpBinder destructor will always @@ -315,7 +315,7 @@ wp<IBinder> ProcessState::getWeakProxyForHandle(int32_t handle) // releasing a reference on this BpBinder, and a new reference on its handle // arriving from the driver. IBinder* b = e->binder; - if (b == NULL || !e->refs->attemptIncWeak(this)) { + if (b == nullptr || !e->refs->attemptIncWeak(this)) { b = new BpBinder(handle); result = b; e->binder = b; @@ -338,7 +338,7 @@ void ProcessState::expungeHandle(int32_t handle, IBinder* binder) // This handle may have already been replaced with a new BpBinder // (if someone failed the AttemptIncWeak() above); we don't want // to overwrite it. - if (e && e->binder == binder) e->binder = NULL; + if (e && e->binder == binder) e->binder = nullptr; } String8 ProcessState::makeBinderThreadName() { @@ -416,14 +416,14 @@ ProcessState::ProcessState(const char *driver) , mMaxThreads(DEFAULT_MAX_BINDER_THREADS) , mStarvationStartTimeMs(0) , mManagesContexts(false) - , mBinderContextCheckFunc(NULL) - , mBinderContextUserData(NULL) + , mBinderContextCheckFunc(nullptr) + , mBinderContextUserData(nullptr) , mThreadPoolStarted(false) , mThreadPoolSeq(1) { if (mDriverFD >= 0) { // 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); + mVMStart = mmap(nullptr, BINDER_VM_SIZE, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0); if (mVMStart == MAP_FAILED) { // *sigh* ALOGE("Using %s failed: unable to mmap transaction memory.\n", mDriverName.c_str()); |