Add overrides and switch to nullptr keyword for all files
Adds remaining missing overrides and nullptr usages, missed due to
an extreme failure in tool usage.
Change-Id: I56abd72975a3999ad13330003c348db40f59aebf
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 0e54169..71ecba5 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -45,7 +45,7 @@
, mBufferPreserved(false)
, mSwapBehavior(kSwap_default)
, mOpaque(!translucent)
- , mCanvas(NULL)
+ , mCanvas(nullptr)
, mHaveNewSurface(false)
, mAnimationContext(contextFactory->createAnimationContext(mRenderThread.timeLord()))
, mRootRenderNode(rootRenderNode) {
@@ -59,13 +59,13 @@
void CanvasContext::destroy() {
stopDrawing();
- setSurface(NULL);
+ setSurface(nullptr);
freePrefetechedLayers();
destroyHardwareResources();
mAnimationContext->destroy();
if (mCanvas) {
delete mCanvas;
- mCanvas = 0;
+ mCanvas = nullptr;
}
}
@@ -95,7 +95,7 @@
void CanvasContext::swapBuffers() {
if (CC_UNLIKELY(!mEglManager.swapBuffers(mEglSurface))) {
- setSurface(NULL);
+ setSurface(nullptr);
}
mHaveNewSurface = false;
}
@@ -273,19 +273,19 @@
mode = DrawGlInfo::kModeProcess;
}
- thread.renderState().invokeFunctor(functor, mode, NULL);
+ thread.renderState().invokeFunctor(functor, mode, nullptr);
}
void CanvasContext::markLayerInUse(RenderNode* node) {
if (mPrefetechedLayers.erase(node)) {
- node->decStrong(0);
+ node->decStrong(nullptr);
}
}
static void destroyPrefetechedNode(RenderNode* node) {
ALOGW("Incorrectly called buildLayer on View: %s, destroying layer...", node->getName());
node->destroyHardwareResources();
- node->decStrong(0);
+ node->decStrong(nullptr);
}
void CanvasContext::freePrefetechedLayers() {
@@ -319,7 +319,7 @@
mCanvas->markLayersAsBuildLayers();
mCanvas->flushLayerUpdates();
- node->incStrong(0);
+ node->incStrong(nullptr);
mPrefetechedLayers.insert(node);
}
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index d7f2ebd..d3fbde8 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -80,7 +80,7 @@
void destroy();
// IFrameCallback, Chroreographer-driven frame callback entry point
- virtual void doFrame();
+ virtual void doFrame() override;
void buildLayer(RenderNode* node);
bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap);
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp
index 97b31a9..4d8a469 100644
--- a/libs/hwui/renderthread/DrawFrameTask.cpp
+++ b/libs/hwui/renderthread/DrawFrameTask.cpp
@@ -32,8 +32,8 @@
namespace renderthread {
DrawFrameTask::DrawFrameTask()
- : mRenderThread(NULL)
- , mContext(NULL)
+ : mRenderThread(nullptr)
+ , mContext(nullptr)
, mFrameTimeNanos(0)
, mRecordDurationNanos(0)
, mDensity(1.0f) // safe enough default
diff --git a/libs/hwui/renderthread/DrawFrameTask.h b/libs/hwui/renderthread/DrawFrameTask.h
index 28f6cb2..953f012 100644
--- a/libs/hwui/renderthread/DrawFrameTask.h
+++ b/libs/hwui/renderthread/DrawFrameTask.h
@@ -64,7 +64,7 @@
void setDensity(float density) { mDensity = density; }
int drawFrame(nsecs_t frameTimeNanos, nsecs_t recordDurationNanos);
- virtual void run();
+ virtual void run() override;
private:
void postAndWait();
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index 9b8bc6c..0aa0439 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -68,12 +68,12 @@
EglManager::EglManager(RenderThread& thread)
: mRenderThread(thread)
, mEglDisplay(EGL_NO_DISPLAY)
- , mEglConfig(0)
+ , mEglConfig(nullptr)
, mEglContext(EGL_NO_CONTEXT)
, mPBufferSurface(EGL_NO_SURFACE)
, mAllowPreserveBuffer(load_dirty_regions_property())
, mCurrentSurface(EGL_NO_SURFACE)
- , mAtlasMap(NULL)
+ , mAtlasMap(nullptr)
, mAtlasMapSize(0)
, mInFrame(false) {
mCanSetPreserveBuffer = mAllowPreserveBuffer;
@@ -194,7 +194,7 @@
EGLSurface EglManager::createSurface(EGLNativeWindowType window) {
initialize();
- EGLSurface surface = eglCreateWindowSurface(mEglDisplay, mEglConfig, window, NULL);
+ EGLSurface surface = eglCreateWindowSurface(mEglDisplay, mEglConfig, window, nullptr);
LOG_ALWAYS_FATAL_IF(surface == EGL_NO_SURFACE,
"Failed to create EGLSurface for window %p, eglErr = %s",
(void*) window, egl_error_str());
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 4ad1c40..35f5512 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -60,7 +60,7 @@
RenderProxy::RenderProxy(bool translucent, RenderNode* rootRenderNode, IContextFactory* contextFactory)
: mRenderThread(RenderThread::getInstance())
- , mContext(0) {
+ , mContext(nullptr) {
SETUP_TASK(createContext);
args->translucent = translucent;
args->rootRenderNode = rootRenderNode;
@@ -76,15 +76,15 @@
CREATE_BRIDGE1(destroyContext, CanvasContext* context) {
delete args->context;
- return NULL;
+ return nullptr;
}
void RenderProxy::destroyContext() {
if (mContext) {
SETUP_TASK(destroyContext);
args->context = mContext;
- mContext = 0;
- mDrawFrameTask.setContext(NULL, NULL);
+ mContext = nullptr;
+ mDrawFrameTask.setContext(nullptr, nullptr);
// This is also a fence as we need to be certain that there are no
// outstanding mDrawFrame tasks posted before it is destroyed
postAndWait(task);
@@ -93,7 +93,7 @@
CREATE_BRIDGE2(setFrameInterval, RenderThread* thread, nsecs_t frameIntervalNanos) {
args->thread->timeLord().setFrameInterval(args->frameIntervalNanos);
- return NULL;
+ return nullptr;
}
void RenderProxy::setFrameInterval(nsecs_t frameIntervalNanos) {
@@ -105,7 +105,7 @@
CREATE_BRIDGE2(setSwapBehavior, CanvasContext* context, SwapBehavior swapBehavior) {
args->context->setSwapBehavior(args->swapBehavior);
- return NULL;
+ return nullptr;
}
void RenderProxy::setSwapBehavior(SwapBehavior swapBehavior) {
@@ -145,7 +145,7 @@
CREATE_BRIDGE2(updateSurface, CanvasContext* context, ANativeWindow* window) {
args->context->updateSurface(args->window);
- return NULL;
+ return nullptr;
}
void RenderProxy::updateSurface(const sp<ANativeWindow>& window) {
@@ -171,7 +171,7 @@
uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) {
args->context->setup(args->width, args->height, args->lightCenter, args->lightRadius,
args->ambientShadowAlpha, args->spotShadowAlpha);
- return NULL;
+ return nullptr;
}
void RenderProxy::setup(int width, int height, const Vector3& lightCenter, float lightRadius,
@@ -189,7 +189,7 @@
CREATE_BRIDGE2(setOpaque, CanvasContext* context, bool opaque) {
args->context->setOpaque(args->opaque);
- return NULL;
+ return nullptr;
}
void RenderProxy::setOpaque(bool opaque) {
@@ -207,7 +207,7 @@
CREATE_BRIDGE1(destroy, CanvasContext* context) {
args->context->destroy();
- return NULL;
+ return nullptr;
}
void RenderProxy::destroy() {
@@ -221,7 +221,7 @@
CREATE_BRIDGE2(invokeFunctor, RenderThread* thread, Functor* functor) {
CanvasContext::invokeFunctor(*args->thread, args->functor);
- return NULL;
+ return nullptr;
}
void RenderProxy::invokeFunctor(Functor* functor, bool waitForCompletion) {
@@ -242,7 +242,7 @@
CREATE_BRIDGE2(runWithGlContext, CanvasContext* context, RenderTask* task) {
args->context->runWithGlContext(args->task);
- return NULL;
+ return nullptr;
}
void RenderProxy::runWithGlContext(RenderTask* gltask) {
@@ -254,7 +254,7 @@
CREATE_BRIDGE2(createTextureLayer, RenderThread* thread, CanvasContext* context) {
Layer* layer = args->context->createTextureLayer();
- if (!layer) return 0;
+ if (!layer) return nullptr;
return new DeferredLayerUpdater(*args->thread, layer);
}
@@ -269,7 +269,7 @@
CREATE_BRIDGE2(buildLayer, CanvasContext* context, RenderNode* node) {
args->context->buildLayer(args->node);
- return NULL;
+ return nullptr;
}
void RenderProxy::buildLayer(RenderNode* node) {
@@ -303,7 +303,7 @@
CREATE_BRIDGE1(detachSurfaceTexture, DeferredLayerUpdater* layer) {
args->layer->detachSurfaceTexture();
- return NULL;
+ return nullptr;
}
void RenderProxy::detachSurfaceTexture(DeferredLayerUpdater* layer) {
@@ -314,7 +314,7 @@
CREATE_BRIDGE1(destroyHardwareResources, CanvasContext* context) {
args->context->destroyHardwareResources();
- return NULL;
+ return nullptr;
}
void RenderProxy::destroyHardwareResources() {
@@ -325,7 +325,7 @@
CREATE_BRIDGE2(timMemory, RenderThread* thread, int level) {
CanvasContext::trimMemory(*args->thread, args->level);
- return NULL;
+ return nullptr;
}
void RenderProxy::trimMemory(int level) {
@@ -341,7 +341,7 @@
CREATE_BRIDGE0(fence) {
// Intentionally empty
- return NULL;
+ return nullptr;
}
template <typename T>
@@ -355,7 +355,7 @@
CREATE_BRIDGE1(stopDrawing, CanvasContext* context) {
args->context->stopDrawing();
- return NULL;
+ return nullptr;
}
void RenderProxy::stopDrawing() {
@@ -366,7 +366,7 @@
CREATE_BRIDGE1(notifyFramePending, CanvasContext* context) {
args->context->notifyFramePending();
- return NULL;
+ return nullptr;
}
void RenderProxy::notifyFramePending() {
@@ -377,7 +377,7 @@
CREATE_BRIDGE2(dumpProfileInfo, CanvasContext* context, int fd) {
args->context->profiler().dumpData(args->fd);
- return NULL;
+ return nullptr;
}
void RenderProxy::dumpProfileInfo(int fd) {
@@ -389,7 +389,7 @@
CREATE_BRIDGE1(outputLogBuffer, int fd) {
RenderNode::outputLogBuffer(args->fd);
- return NULL;
+ return nullptr;
}
void RenderProxy::outputLogBuffer(int fd) {
@@ -400,15 +400,15 @@
CREATE_BRIDGE4(setTextureAtlas, RenderThread* thread, GraphicBuffer* buffer, int64_t* map, size_t size) {
CanvasContext::setTextureAtlas(*args->thread, args->buffer, args->map, args->size);
- args->buffer->decStrong(0);
- return NULL;
+ args->buffer->decStrong(nullptr);
+ return nullptr;
}
void RenderProxy::setTextureAtlas(const sp<GraphicBuffer>& buffer, int64_t* map, size_t size) {
SETUP_TASK(setTextureAtlas);
args->thread = &mRenderThread;
args->buffer = buffer.get();
- args->buffer->incStrong(0);
+ args->buffer->incStrong(nullptr);
args->map = map;
args->size = size;
post(task);
diff --git a/libs/hwui/renderthread/RenderTask.h b/libs/hwui/renderthread/RenderTask.h
index 1554a16..89c3a7d 100644
--- a/libs/hwui/renderthread/RenderTask.h
+++ b/libs/hwui/renderthread/RenderTask.h
@@ -47,7 +47,7 @@
class ANDROID_API RenderTask {
public:
- ANDROID_API RenderTask() : mNext(0), mRunAt(0) {}
+ ANDROID_API RenderTask() : mNext(nullptr), mRunAt(0) {}
ANDROID_API virtual ~RenderTask() {}
ANDROID_API virtual void run() = 0;
@@ -61,7 +61,7 @@
// Takes ownership of task, caller owns lock and signal
SignalingRenderTask(RenderTask* task, Mutex* lock, Condition* signal)
: mTask(task), mLock(lock), mSignal(signal) {}
- virtual void run();
+ virtual void run() override;
private:
RenderTask* mTask;
@@ -74,12 +74,12 @@
class MethodInvokeRenderTask : public RenderTask {
public:
MethodInvokeRenderTask(RunnableMethod method)
- : mMethod(method), mReturnPtr(0) {}
+ : mMethod(method), mReturnPtr(nullptr) {}
void* payload() { return mData; }
void setReturnPtr(void** retptr) { mReturnPtr = retptr; }
- virtual void run() {
+ virtual void run() override {
void* retval = mMethod(mData);
if (mReturnPtr) {
*mReturnPtr = retval;
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 3e4e965..361a440 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -42,16 +42,16 @@
// Slight delay to give the UI time to push us a new frame before we replay
static const nsecs_t DISPATCH_FRAME_CALLBACKS_DELAY = milliseconds_to_nanoseconds(4);
-TaskQueue::TaskQueue() : mHead(0), mTail(0) {}
+TaskQueue::TaskQueue() : mHead(nullptr), mTail(nullptr) {}
RenderTask* TaskQueue::next() {
RenderTask* ret = mHead;
if (ret) {
mHead = ret->mNext;
if (!mHead) {
- mTail = 0;
+ mTail = nullptr;
}
- ret->mNext = 0;
+ ret->mNext = nullptr;
}
return ret;
}
@@ -71,7 +71,7 @@
mTail = task;
} else {
// Need to find the proper insertion point
- RenderTask* previous = 0;
+ RenderTask* previous = nullptr;
RenderTask* next = mHead;
while (next && next->mRunAt <= task->mRunAt) {
previous = next;
@@ -131,19 +131,19 @@
public:
DispatchFrameCallbacks(RenderThread* rt) : mRenderThread(rt) {}
- virtual void run() {
+ virtual void run() override {
mRenderThread->dispatchFrameCallbacks();
}
};
RenderThread::RenderThread() : Thread(true), Singleton<RenderThread>()
, mNextWakeup(LLONG_MAX)
- , mDisplayEventReceiver(0)
+ , mDisplayEventReceiver(nullptr)
, mVsyncRequested(false)
, mFrameCallbackTaskPending(false)
- , mFrameCallbackTask(0)
- , mRenderState(NULL)
- , mEglManager(NULL) {
+ , mFrameCallbackTask(nullptr)
+ , mRenderState(nullptr)
+ , mEglManager(nullptr) {
mFrameCallbackTask = new DispatchFrameCallbacks(this);
mLooper = new Looper(false);
run("RenderThread");
@@ -342,7 +342,7 @@
if (next->mRunAt <= 0 || next->mRunAt <= systemTime(SYSTEM_TIME_MONOTONIC)) {
next = mQueue.next();
} else {
- next = 0;
+ next = nullptr;
}
}
if (nextWakeup) {
diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h
index 99c2e15..8fc8ca5 100644
--- a/libs/hwui/renderthread/RenderThread.h
+++ b/libs/hwui/renderthread/RenderThread.h
@@ -90,7 +90,7 @@
EglManager& eglManager() { return *mEglManager; }
protected:
- virtual bool threadLoop();
+ virtual bool threadLoop() override;
private:
friend class Singleton<RenderThread>;