libgui: Remove RefBase from BitTube

Removes RefBase from BitTube, since because it is not a Binder object,
it doesn't need to be reference-counted in this way.

In the process, we rename IDisplayEventConnection::getDataChannel to
IDEC::stealReceiveChannel to make it clearer that this is a non-const
operation on the remote end that removes its access to the receive
channel.

This also adds a couple of methods for moving the receive file
descriptor out of one BitTube and into another, since this is the
essence of the IDisplayEventConnection::stealReceiveChannel method,
and now with C++11 move semantics, we can do this without needing to
return an sp<> from EventThread's implementation of stealReceiveChannel.

Test: m -j + manual testing
Change-Id: Ibaaca2a14fb6155052fe5434c14bc3e671b43743
diff --git a/services/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp
index 6ef26fe..bca3430 100644
--- a/services/surfaceflinger/MessageQueue.cpp
+++ b/services/surfaceflinger/MessageQueue.cpp
@@ -25,7 +25,6 @@
 #include <utils/Log.h>
 
 #include <gui/IDisplayEventConnection.h>
-#include <private/gui/BitTube.h>
 
 #include "MessageQueue.h"
 #include "EventThread.h"
@@ -94,8 +93,8 @@
 {
     mEventThread = eventThread;
     mEvents = eventThread->createEventConnection();
-    mEvents->getDataChannel(&mEventTube);
-    mLooper->addFd(mEventTube->getFd(), 0, Looper::EVENT_INPUT,
+    mEvents->stealReceiveChannel(&mEventTube);
+    mLooper->addFd(mEventTube.getFd(), 0, Looper::EVENT_INPUT,
             MessageQueue::cb_eventReceiver, this);
 }
 
@@ -150,7 +149,7 @@
 int MessageQueue::eventReceiver(int /*fd*/, int /*events*/) {
     ssize_t n;
     DisplayEventReceiver::Event buffer[8];
-    while ((n = DisplayEventReceiver::getEvents(mEventTube, buffer, 8)) > 0) {
+    while ((n = DisplayEventReceiver::getEvents(&mEventTube, buffer, 8)) > 0) {
         for (int i=0 ; i<n ; i++) {
             if (buffer[i].header.type == DisplayEventReceiver::DISPLAY_EVENT_VSYNC) {
                 mHandler->dispatchInvalidate();