• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef OHOS_FORM_FWK_FORM_ASHMEM_H
17 #define OHOS_FORM_FWK_FORM_ASHMEM_H
18 
19 #include "ashmem.h"
20 
21 namespace OHOS {
22 namespace AppExecFwk {
23 
24 enum class TestNum {
25     Num1 = 1, Num2, Num3, Num4, Num5,
26     Num6, Num7, Num8, Num9, Num10,
27     Num11, Num12, Num13, Num14, Num15,
28     Num16, Num17, Num18, Num19, Num20,
29     Num21, Num22, Num23, Num24, Num25,
30     Num26, Num27, Num28, Num29, Num30,
31     Num31, Num32, Num33, Num34, Num35,
32     Num36, Num37, Num38, Num39, Num40,
33 };
34 
35 /**
36  * @class FormAshmem
37  * Defines form ashmem.
38  */
39 class FormAshmem : public Parcelable {
40 public:
41     FormAshmem() = default;
42     ~FormAshmem();
43 
44     bool WriteToAshmem(std::string name, char *data, int32_t size);
45     int32_t GetAshmemSize();
46     int32_t GetAshmemFd();
47 
48     virtual bool Marshalling(Parcel &parcel) const override;
49     static FormAshmem* Unmarshalling(Parcel &parcel);
50 
51     sptr<Ashmem> GetAshmem() const;
52     static int TestFormId1(int &formId);
53     static int TestFormId2(int &formId);
54     static int TestFormId3(int &formId);
55     static int TestFormId4(int &formId);
56     static int TestFormId5(int &formId);
57     static int TestFormId6(int &formId);
58     static int TestFormId7(int &formId);
59     static int TestFormId8(int &formId);
60     static int TestFormId9(int &formId);
61     static int TestFormId10(int &formId);
62     static int TestFormId11(int &formId);
63     static int TestFormId12(int &formId);
64     static int TestFormId13(int &formId);
65     static int TestFormId14(int &formId);
66     static int TestFormId15(int &formId);
67     static int TestFormId16(int &formId);
68     static int TestFormId17(int &formId);
69     static int TestFormId18(int &formId);
70     static int TestFormId19(int &formId);
71     static int TestFormId20(int &formId);
72 private:
73     bool ReadFromParcel(Parcel &parcel);
74 
75     sptr<Ashmem> ashmem_;
76 };
77 }  // namespace AppExecFwk
78 }  // namespace OHOS
79 
80 #endif  // OHOS_FORM_FWK_FORM_ASHMEM_H
81