summaryrefslogtreecommitdiff
path: root/gnss/GnssAdapter.cpp
diff options
context:
space:
mode:
authorWei Chen <weic@codeaurora.org>2018-11-15 09:41:26 -0800
committerWei Chen <weic@codeaurora.org>2018-11-27 17:07:19 -0800
commite232986d84deb7178d1a57cc7f1e4d24cbaeeb3c (patch)
tree882a2a704ea4d27c8a40f0f1b2d661e5c96b5087 /gnss/GnssAdapter.cpp
parent9b0abcc59d3ea840c38b131d2c4d1c14028f29e1 (diff)
downloadgps-e232986d84deb7178d1a57cc7f1e4d24cbaeeb3c.tar.gz
GPS location API: support destroy with callback for completion
Support Location API destroy function with callback. Location API client that passes callback to Location API need to wait for the destroy complete callback to be invoked before releasing the memory that holds the callback Change-Id: I29b1c6d46feb79c789e6f1ec1500c941b022a3ac CRs-fixed: 2349398
Diffstat (limited to 'gnss/GnssAdapter.cpp')
-rw-r--r--gnss/GnssAdapter.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index fc59c22..f7297d0 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -1859,25 +1859,32 @@ GnssAdapter::addClientCommand(LocationAPI* client, const LocationCallbacks& call
}
void
-GnssAdapter::removeClientCommand(LocationAPI* client)
+GnssAdapter::removeClientCommand(LocationAPI* client,
+ removeClientCompleteCallback rmClientCb)
{
LOC_LOGD("%s]: client %p", __func__, client);
struct MsgRemoveClient : public LocMsg {
GnssAdapter& mAdapter;
LocationAPI* mClient;
+ removeClientCompleteCallback mRmClientCb;
inline MsgRemoveClient(GnssAdapter& adapter,
- LocationAPI* client) :
+ LocationAPI* client,
+ removeClientCompleteCallback rmCb) :
LocMsg(),
mAdapter(adapter),
- mClient(client) {}
+ mClient(client),
+ mRmClientCb(rmCb){}
inline virtual void proc() const {
mAdapter.stopClientSessions(mClient);
mAdapter.eraseClient(mClient);
+ if (nullptr != mRmClientCb) {
+ mRmClientCb(mClient);
+ }
}
};
- sendMsg(new MsgRemoveClient(*this, client));
+ sendMsg(new MsgRemoveClient(*this, client, rmClientCb));
}
void