• 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 /**
17 * @file rs_application_agent_impl.h
18 * @brief Agent that the application registers with the RenderService
19 */
20 
21 #ifndef RENDER_SERVICE_CLIENT_CORE_TRANSACTION_RS_APPLICATION_AGENT_IMPL_H
22 #define RENDER_SERVICE_CLIENT_CORE_TRANSACTION_RS_APPLICATION_AGENT_IMPL_H
23 
24 #include <mutex>
25 
26 #ifdef ROSEN_OHOS
27 #include "ipc_callbacks/rs_application_agent_stub.h"
28 #endif
29 
30 namespace OHOS {
31 namespace Rosen {
32 #ifdef ROSEN_OHOS
33 class RSC_EXPORT RSApplicationAgentImpl final : public RSApplicationAgentStub {
34 #else
35 class RSApplicationAgentImpl final {
36 #endif
37 public:
38     /**
39      * @brief singletion constructor for application agent
40      * @return application agent pointer
41      */
42     static RSApplicationAgentImpl* Instance();
43     /**
44      * @brief register application agent to renderService
45      */
46     void RegisterRSApplicationAgent();
47 
48     RSApplicationAgentImpl() = default;
49     virtual ~RSApplicationAgentImpl() = default;
50 
51 private:
52     RSApplicationAgentImpl(const RSApplicationAgentImpl&) = delete;
53     RSApplicationAgentImpl(const RSApplicationAgentImpl&&) = delete;
54     RSApplicationAgentImpl& operator=(const RSApplicationAgentImpl&) = delete;
55     RSApplicationAgentImpl& operator=(const RSApplicationAgentImpl&&) = delete;
56 
57 #ifdef ROSEN_OHOS
58     /**
59      * @brief register application agent to renderService
60      * @param transactionData Transactions that the RenderService needs to send to the application
61      */
62     void OnTransaction(std::shared_ptr<RSTransactionData> transactionData) override;
63 #endif
64 
65     static inline std::mutex mutex_;
66 };
67 }
68 }
69 #endif // RENDER_SERVICE_CLIENT_CORE_TRANSACTION_RS_APPLICATION_AGENT_IMPL_H
70