summaryrefslogtreecommitdiff
path: root/libs/gui/IDisplayEventConnection.cpp
diff options
context:
space:
mode:
author Dan Stoza <stoza@google.com> 2017-04-03 13:09:08 -0700
committer Dan Stoza <stoza@google.com> 2017-04-06 11:52:11 -0700
commit6b698e4fe4ff50dcef818452283637f9870ae770 (patch)
treedacce20234785575e8df1446f3ef0f7adc5bad99 /libs/gui/IDisplayEventConnection.cpp
parent7d290174b08a56ae6bc6719bec58805ca38b348b (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 'libs/gui/IDisplayEventConnection.cpp')
-rw-r--r--libs/gui/IDisplayEventConnection.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/libs/gui/IDisplayEventConnection.cpp b/libs/gui/IDisplayEventConnection.cpp
index d3ee39c16f..a1974264cd 100644
--- a/libs/gui/IDisplayEventConnection.cpp
+++ b/libs/gui/IDisplayEventConnection.cpp
@@ -22,7 +22,11 @@
namespace android {
-enum { GET_DATA_CHANNEL = IBinder::FIRST_CALL_TRANSACTION, SET_VSYNC_RATE, REQUEST_NEXT_VSYNC };
+enum {
+ STEAL_RECEIVE_CHANNEL = IBinder::FIRST_CALL_TRANSACTION,
+ SET_VSYNC_RATE,
+ REQUEST_NEXT_VSYNC
+};
class BpDisplayEventConnection : public BpInterface<IDisplayEventConnection> {
public:
@@ -31,11 +35,11 @@ public:
~BpDisplayEventConnection() override;
- status_t getDataChannel(sp<gui::BitTube>* outChannel) const override {
+ status_t stealReceiveChannel(gui::BitTube* outChannel) override {
Parcel data, reply;
data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
- remote()->transact(GET_DATA_CHANNEL, data, &reply);
- *outChannel = new gui::BitTube(reply);
+ remote()->transact(STEAL_RECEIVE_CHANNEL, data, &reply);
+ outChannel->readFromParcel(&reply);
return NO_ERROR;
}
@@ -63,11 +67,11 @@ IMPLEMENT_META_INTERFACE(DisplayEventConnection, "android.gui.DisplayEventConnec
status_t BnDisplayEventConnection::onTransact(uint32_t code, const Parcel& data, Parcel* reply,
uint32_t flags) {
switch (code) {
- case GET_DATA_CHANNEL: {
+ case STEAL_RECEIVE_CHANNEL: {
CHECK_INTERFACE(IDisplayEventConnection, data, reply);
- sp<gui::BitTube> channel;
- getDataChannel(&channel);
- channel->writeToParcel(reply);
+ gui::BitTube channel;
+ stealReceiveChannel(&channel);
+ channel.writeToParcel(reply);
return NO_ERROR;
}
case SET_VSYNC_RATE: {