• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 FOUNDATION_ACE_FRAMEWORKS_COMMON_FLUTTER_FLUTTER_WINDOW_H
17 #define FOUNDATION_ACE_FRAMEWORKS_COMMON_FLUTTER_FLUTTER_WINDOW_H
18 
19 #include <vector>
20 
21 #include "base/utils/noncopyable.h"
22 #include "core/common/platform_window.h"
23 
24 namespace OHOS::Ace::Platform {
25 
26 class FlutterWindow final : public PlatformWindow {
27 public:
28     explicit FlutterWindow(int32_t instanceId);
29     ~FlutterWindow() override;
30     void Destroy() override;
31     // Platform window interface
32     void RequestFrame() override;
33     void RegisterVsyncCallback(AceVsyncCallback&& callback) override;
34     void SetRootRenderNode(const RefPtr<RenderNode>& root) override;
35 
36     // Vsync callback
37     void OnVsyncCallback(uint64_t timeStampNanos);
38 
39 private:
40     std::vector<AceVsyncCallback> vsyncCallbacks_;
41     int32_t instanceId_;
42 
43     ACE_DISALLOW_COPY_AND_MOVE(FlutterWindow);
44 };
45 
46 } // namespace OHOS::Ace::Platform
47 
48 #endif // FOUNDATION_ACE_FRAMEWORKS_COMMON_FLUTTER_FLUTTER_WINDOW_H
49