{ PadCmd::Launch,
std::bind(&Launchpad::HandleLaunchRequest, this,
std::placeholders::_1) },
+ { PadCmd::KillLoader,
+ std::bind(&Launchpad::HandleKillLoaderRequest, this,
+ std::placeholders::_1) },
};
CPUBoostController::DoBoost(getpid(), CPUBoostController::Level::Strong,
request->GetAppInfo()->GetAppId().c_str(), request->GetPid());
}
+void Launchpad::HandleKillLoaderRequest(std::shared_ptr<Request> request) {
+ auto& b = request->GetBundle();
+ auto loader_name = b.GetString(kAulLoaderName);
+ auto loader_context =
+ LoaderManager::GetInst().FindLoaderContextFromName(loader_name);
+ if (loader_context == nullptr) {
+ _E("Failed to find loader context. loader_name(%s)", loader_name.c_str());
+ return;
+ }
+
+ if (loader_context->RefCount() == 0)
+ loader_context->Dispose();
+
+ _D("[PAD_CMD_KILL_LOADER] loader_name: %s", loader_name.c_str());
+}
+
void Launchpad::OnIOEventReceived(int fd, int condition) {
auto client_socket = socket_->Accept();
if (!client_socket) {
void HandleUpdateAppTypeRequest(std::shared_ptr<Request> request);
void HandleConnectRequest(std::shared_ptr<Request> request);
void HandleLaunchRequest(std::shared_ptr<Request> request);
+ void HandleKillLoaderRequest(std::shared_ptr<Request> request);
bool CanUseLoaderContext(const std::shared_ptr<LoaderContext>& context);
LaunchResult ForkProcessing(std::shared_ptr<Request> request);
const std::string& loader_name);
std::shared_ptr<LoaderContext> FindAlternativeLoaderContext(LoaderType type);
void RemoveLoaderContext(LoaderType type, int loader_id);
+ std::shared_ptr<LoaderContext> FindLoaderContextFromName(
+ const std::string& loader_name);
private:
LoaderManager();
void Init();
std::shared_ptr<LoaderContext> FindLoaderContextFromPid(pid_t pid);
std::shared_ptr<HydraLoaderContext> FindHydraLoaderContextFromPid(pid_t pid);
- std::shared_ptr<LoaderContext> FindLoaderContextFromName(
- const std::string& loader_name);
std::shared_ptr<LoaderContext> FindLoaderContextFromLoaderId(int loader_id);
std::shared_ptr<LoaderContext> FindLoaderContextFromType(LoaderType type);
void RemoveLoaderContextsByCallerPid(pid_t caller_pid);