1 /*
2  * Copyright (c) 2021-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_ROSEN_SNAPSHOT_CONTROLLER_H
17 #define OHOS_ROSEN_SNAPSHOT_CONTROLLER_H
18 
19 #include <snapshot.h>
20 #include <transaction/rs_interfaces.h>
21 
22 #include "event_handler.h"
23 #include "future.h"
24 #include "snapshot_stub.h"
25 #include "wm_common_inner.h"
26 #include "window_root.h"
27 #include "window_manager_hilog.h"
28 #include "perform_reporter.h"
29 
30 namespace OHOS {
31 namespace Rosen {
32 class SnapshotController : public SnapshotStub {
33 public:
SnapshotController(sptr<WindowRoot> & root,std::shared_ptr<AppExecFwk::EventHandler> & handler)34     SnapshotController(sptr<WindowRoot>& root, std::shared_ptr<AppExecFwk::EventHandler>& handler)
35         : windowRoot_(root), handler_(handler),
36         performReport_(new PerformReporter("GET_SNAPSHOT_TIME", {25, 35, 50, 200})) {};
37     ~SnapshotController() = default;
38     int32_t GetSnapshot(const sptr<IRemoteObject> &token, AAFwk::Snapshot& snapshot) override;
39 
40 private:
41     sptr<WindowRoot> windowRoot_;
42     std::shared_ptr<AppExecFwk::EventHandler> handler_;
43     std::shared_ptr<PerformReporter> performReport_;
44 };
45 } // Rosen
46 } // OHOS
47 #endif // OHOS_ROSEN_SNAPSHOT_CONTROLLER_H
48