SurfaceFlinger: Emit TransactionCompleted callbacks directly.

Transaction complete callbacks (BLAST Buffer release callbacks), are
emitted from a TransactionCompletedThread. There's no clear reason
for this behavior, as the actual runtime is exceedingly minimal. This
opens us to scheduling delays when we call
TransactionCompletedThread.sendCallbacks. In this CL we both remove the
threaded nature of TransactionCompletedThread, and also take advantage
of it running on the main thread to reduce some unnecessary copying and
further reduce its runtime.

Bug: 176691195
Test: Existing tests pass
Change-Id: Ib1661df24c4a2ee39fc28c29a395158ce0ee7b7f
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 66fc4f0..b3bb9a6 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -64,7 +64,7 @@
 #include "SurfaceFlingerFactory.h"
 #include "SurfaceTracing.h"
 #include "TracedOrdinal.h"
-#include "TransactionCompletedThread.h"
+#include "TransactionCallbackInvoker.h"
 
 #include <atomic>
 #include <cstdint>
@@ -319,8 +319,8 @@
 
     void removeFromOffscreenLayers(Layer* layer);
 
-    TransactionCompletedThread& getTransactionCompletedThread() {
-        return mTransactionCompletedThread;
+    TransactionCallbackInvoker& getTransactionCallbackInvoker() {
+        return mTransactionCallbackInvoker;
     }
 
     // Converts from a binder handle to a Layer
@@ -1159,7 +1159,7 @@
     std::atomic<uint32_t> mHwcFrameMissedCount = 0;
     std::atomic<uint32_t> mGpuFrameMissedCount = 0;
 
-    TransactionCompletedThread mTransactionCompletedThread;
+    TransactionCallbackInvoker mTransactionCallbackInvoker;
 
     // Restrict layers to use two buffers in their bufferqueues.
     bool mLayerTripleBufferingDisabled = false;