1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_MEMORY_POLICY_H
16 #define FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_MEMORY_POLICY_H
17 
18 #include <memory>
19 
20 #include "ipolicy_filter.h"
21 #include "work_policy_manager.h"
22 
23 namespace OHOS {
24 namespace WorkScheduler {
25 class MemoryPolicy : public IPolicyFilter {
26 public:
27     explicit MemoryPolicy(std::shared_ptr<WorkPolicyManager> workPolicyManager);
28     ~MemoryPolicy() override;
29     /**
30      * @brief Get policy max running.
31      *
32      * @return Res.
33      */
34     int32_t GetPolicyMaxRunning() override;
35 
36     /**
37      * @brief Get policyName.
38      *
39      * @return PolicyName.
40      */
41     std::string GetPolicyName() override;
42 private:
43     int32_t GetMemAvailable();
44     std::shared_ptr<WorkPolicyManager> workPolicyManager_;
45 };
46 } // namespace WorkScheduler
47 } // namespace OHOS
48 #endif // FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_MEMORY_POLICY_H