Lines Matching defs:nanoapp
21 #include "chre/core/nanoapp.h"
64 for (const UniquePtr<Nanoapp>& nanoapp : mNanoapps) {
65 callback(nanoapp.get(), data);
97 // callback and are not expected to be delivered to any nanoapp, so no
129 bool EventLoop::startNanoapp(UniquePtr<Nanoapp>& nanoapp) {
130 CHRE_ASSERT(!nanoapp.isNull());
135 if (nanoapp.isNull()) {
137 } else if (eventLoopManager->findNanoappInstanceIdByAppId(nanoapp->getAppId(),
141 PRIx32, nanoapp->getAppId(), existingInstanceId);
143 LOGE("Failed to allocate space for new nanoapp");
145 nanoapp->setInstanceId(eventLoopManager->getNextInstanceId());
146 mCurrentApp = nanoapp.get();
147 success = nanoapp->start();
150 LOGE("Nanoapp %" PRIu32 " failed to start", nanoapp->getInstanceId());
153 mNanoapps.push_back(std::move(nanoapp));
160 void EventLoop::stopNanoapp(Nanoapp *nanoapp) {
162 if (nanoapp == mNanoapps[i].get()) {
169 "Attempted to stop a nanoapp that is not already running");
216 Nanoapp *nanoapp = lookupAppByInstanceId(instanceId);
222 return nanoapp;
251 // skip iterating through the nanoapp list for that case
264 const UniquePtr<Nanoapp>& nanoapp = mNanoapps[index];
268 // this nanoapp's event queue while we're doing this, so once it's empty, we
270 while (nanoapp->hasPendingEvent()) {
271 deliverNextEvent(nanoapp);
274 // TODO: to safely stop a nanoapp while the EventLoop is still running, we
275 // need to deliver/purge any events that the nanoapp sent itself prior to
277 // unloading the nanoapp where that callback resides. Likewise, we need to
278 // make sure any messages to the host from this nanoapp are flushed as well.
281 mCurrentApp = nanoapp.get();
282 nanoapp->end();