1/*
2 * Copyright (c) 2024 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 FLOWBUFFER_ADAPTER_H
17#define FLOWBUFFER_ADAPTER_H
18
19#include <cstdint>
20#include <cstdio>
21
22namespace OHOS::NWeb {
23
24class FlowbufferAdapter {
25public:
26    /**
27     * @brief Construct a new FlowbufferAdapter object
28     */
29    FlowbufferAdapter() = default;
30
31    /**
32     * @brief Destroy the FlowbufferAdapter object
33     */
34    virtual ~FlowbufferAdapter() = default;
35
36    /**
37     * @brief Start temporary performance boost when some key tasks are running
38     */
39    virtual void StartPerformanceBoost() = 0;
40
41    /**
42     * @brief Create ashmem
43     *
44     * @param size size of the ashmem to be created
45     * @param mapType mapType of the ashmem to be created
46     * @param fd fd of the ashmem to be created
47     * @return the address of the created ashmem
48     */
49    virtual void* CreateAshmem(size_t size, int mapType, int& fd) = 0;
50
51    /**
52     * @brief Create ashmem with fd
53     *
54     * @param fd fd of the ashmem to be created
55     * @param size size of the ashmem to be created
56     * @param mapType mapType of the ashmem to be created
57     * @return the address of the created ashmem
58     */
59    virtual void* CreateAshmemWithFd(const int fd, size_t size, int mapType) = 0;
60};
61
62} // namespace OHOS::NWeb
63
64#endif // FLOWBUFFER_ADAPTER_H
65