diff options
| author | 2017-04-03 13:09:08 -0700 | |
|---|---|---|
| committer | 2017-04-06 11:52:11 -0700 | |
| commit | 6b698e4fe4ff50dcef818452283637f9870ae770 (patch) | |
| tree | dacce20234785575e8df1446f3ef0f7adc5bad99 /services/surfaceflinger/EventThread.cpp | |
| parent | 7d290174b08a56ae6bc6719bec58805ca38b348b (diff) | |
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
Diffstat (limited to 'services/surfaceflinger/EventThread.cpp')
| -rw-r--r-- | services/surfaceflinger/EventThread.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp index 2d3515e8e6..a9bb2ba0e1 100644 --- a/services/surfaceflinger/EventThread.cpp +++ b/services/surfaceflinger/EventThread.cpp @@ -21,7 +21,6 @@ #include <cutils/compiler.h> -#include <private/gui/BitTube.h> #include <gui/IDisplayEventConnection.h> #include <gui/DisplayEventReceiver.h> @@ -389,7 +388,7 @@ void EventThread::dump(String8& result) const { EventThread::Connection::Connection( const sp<EventThread>& eventThread) - : count(-1), mEventThread(eventThread), mChannel(new gui::BitTube(gui::BitTube::DefaultSize)) + : count(-1), mEventThread(eventThread), mChannel(gui::BitTube::DefaultSize) { } @@ -403,8 +402,8 @@ void EventThread::Connection::onFirstRef() { mEventThread->registerDisplayEventConnection(this); } -status_t EventThread::Connection::getDataChannel(sp<gui::BitTube>* outChannel) const { - *outChannel = mChannel; +status_t EventThread::Connection::stealReceiveChannel(gui::BitTube* outChannel) { + outChannel->setReceiveFd(mChannel.moveReceiveFd()); return NO_ERROR; } @@ -419,7 +418,7 @@ void EventThread::Connection::requestNextVsync() { status_t EventThread::Connection::postEvent( const DisplayEventReceiver::Event& event) { - ssize_t size = DisplayEventReceiver::sendEvents(mChannel, &event, 1); + ssize_t size = DisplayEventReceiver::sendEvents(&mChannel, &event, 1); return size < 0 ? status_t(size) : status_t(NO_ERROR); } |