2 * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef LAUNCHPAD_PROCESS_POOL_LOADER_EXECUTOR_HH_
18 #define LAUNCHPAD_PROCESS_POOL_LOADER_EXECUTOR_HH_
24 #include "launchpad-process-pool/executor.hh"
25 #include "launchpad-process-pool/loader_context.hh"
26 #include "launchpad-process-pool/process_pool.hh"
30 class LoaderExecutor : public Executor::Delegator,
32 public ProcessPool::IEvent {
34 LoaderExecutor(const LoaderExecutor&) = delete;
35 LoaderExecutor& operator=(const LoaderExecutor&) = delete;
36 LoaderExecutor(LoaderExecutor&&) = delete;
37 LoaderExecutor& operator=(LoaderExecutor&&) = delete;
39 static LoaderExecutor& GetInst();
41 pid_t Execute(const LoaderContext* loader_context, int priority);
42 bool HasCandidateProcess() const;
46 ~LoaderExecutor() = default;
48 void OnExecution() override;
49 void OnRequestReceived(std::shared_ptr<AppPacket> app_packet) override;
50 std::vector<std::string> CreateLoaderArgv(
51 const LoaderContext* loader_context);
54 std::unique_ptr<ProcessPool> process_pool_;
55 std::vector<std::string> loader_argv_;
58 } // namespace launchpad
60 #endif // LAUNCHPAD_PROCESS_POOL_LOADER_EXECUTOR_HH_