1 /*
2  * Copyright (c) 2021-2023 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 WEBGL_SYNC_H
17 #define WEBGL_SYNC_H
18 
19 #include "napi/n_exporter.h"
20 #include "webgl_object.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 class WebGLSync final : public NExporter, public WebGLObject {
25 public:
26     inline static const std::string className = "WebGLSync";
27     inline static const int objectType = WEBGL_OBJECT_SYNC;
28 
29     bool Export(napi_env env, napi_value exports) override;
30 
31     std::string GetClassName() override;
32 
33     static napi_value Constructor(napi_env env, napi_callback_info info);
CreateObjectInstance(napi_env env,WebGLSync ** instance)34     static NVal CreateObjectInstance(napi_env env, WebGLSync **instance)
35     {
36         return WebGLObject::CreateObjectInstance<WebGLSync>(env, instance);
37     }
38 
SetSync(int64_t sync)39     void SetSync(int64_t sync)
40     {
41         sync_ = sync;
42     }
43 
GetSync()44     int64_t GetSync() const
45     {
46         return sync_;
47     }
48 
WebGLSync()49     explicit WebGLSync() : sync_(0) {};
WebGLSync(napi_env env,napi_value exports)50     WebGLSync(napi_env env, napi_value exports) : NExporter(env, exports), sync_(0) {};
~WebGLSync()51     ~WebGLSync() {};
52 private:
53     int64_t sync_;
54 };
55 } // namespace Rosen
56 } // namespace OHOS
57 #endif // WEBGL_SYNC_H
58