SF: Cleanup EventThread Part 2

De-refbase EventThread and a bunch of related classes. Convert from
usign StrongPointer to std::unique_ptr to hold owned references, or bare
pointers for unowned references.

I did not see any need for using std::shared_ptr, or anything else, as
SurfaceFlinger appeared to own all the objects, and they were created
once and not really destroyed afterwards.

Test: Things seem to still work on a Pixel XL
Bug: None

Change-Id: Ifff32118d31bc1bb51e38df695ebe5cf86d2bb6d
diff --git a/services/surfaceflinger/EventThread.h b/services/surfaceflinger/EventThread.h
index 63cdb54..9ae8fb2 100644
--- a/services/surfaceflinger/EventThread.h
+++ b/services/surfaceflinger/EventThread.h
@@ -29,7 +29,6 @@
 #include <private/gui/BitTube.h>
 
 #include <utils/Errors.h>
-#include <utils/RefBase.h>
 #include <utils/SortedVector.h>
 
 #include "DisplayDevice.h"
@@ -43,9 +42,9 @@
 
 // ---------------------------------------------------------------------------
 
-class VSyncSource : public virtual RefBase {
+class VSyncSource {
 public:
-    class Callback : public virtual RefBase {
+    class Callback {
     public:
         virtual ~Callback() {}
         virtual void onVSyncEvent(nsecs_t when) = 0;
@@ -53,14 +52,14 @@
 
     virtual ~VSyncSource() {}
     virtual void setVSyncEnabled(bool enable) = 0;
-    virtual void setCallback(const sp<Callback>& callback) = 0;
+    virtual void setCallback(Callback* callback) = 0;
     virtual void setPhaseOffset(nsecs_t phaseOffset) = 0;
 };
 
-class EventThread : public virtual RefBase, private VSyncSource::Callback {
+class EventThread : private VSyncSource::Callback {
     class Connection : public BnDisplayEventConnection {
     public:
-        explicit Connection(const sp<EventThread>& eventThread);
+        explicit Connection(EventThread* eventThread);
         status_t postEvent(const DisplayEventReceiver::Event& event);
 
         // count >= 1 : continuous event. count is the vsync rate
@@ -74,12 +73,12 @@
         status_t stealReceiveChannel(gui::BitTube* outChannel) override;
         status_t setVsyncRate(uint32_t count) override;
         void requestNextVsync() override; // asynchronous
-        sp<EventThread> const mEventThread;
+        EventThread* const mEventThread;
         gui::BitTube mChannel;
     };
 
 public:
-    EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger, bool interceptVSyncs,
+    EventThread(VSyncSource* src, SurfaceFlinger& flinger, bool interceptVSyncs,
                 const char* threadName);
     ~EventThread();
 
@@ -116,7 +115,7 @@
     void onVSyncEvent(nsecs_t timestamp) override;
 
     // constants
-    sp<VSyncSource> mVSyncSource GUARDED_BY(mMutex);
+    VSyncSource* mVSyncSource GUARDED_BY(mMutex) = nullptr;
     SurfaceFlinger& mFlinger;
 
     std::thread mThread;