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 RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_H 17 #define RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_H 18 #include <map> 19 20 #include "screen_manager/rs_screen_manager.h" 21 #include "transaction/rs_render_service_stub.h" 22 #include "vsync_controller.h" 23 #include "vsync_distributor.h" 24 25 namespace OHOS { 26 namespace Rosen { 27 class RSMainThread; 28 class RSSyncTask; 29 class RSRenderServiceConnection; 30 31 class RSRenderService : public RSRenderServiceStub { 32 public: 33 RSRenderService(); 34 ~RSRenderService() noexcept; 35 36 RSRenderService(const RSRenderService&) = delete; 37 RSRenderService& operator=(const RSRenderService&) = delete; 38 39 bool Init(); 40 void Run(); 41 42 private: 43 int Dump(int fd, const std::vector<std::u16string>& args) override; 44 sptr<RSIRenderServiceConnection> CreateConnection(const sptr<RSIConnectionToken>& token) override; 45 void RemoveConnection(sptr<IRemoteObject> token); 46 47 RSMainThread* mainThread_ = nullptr; 48 sptr<RSScreenManager> screenManager_; 49 50 friend class RSRenderServiceConnection; 51 mutable std::mutex mutex_; 52 std::map<sptr<IRemoteObject>, sptr<RSIRenderServiceConnection>> connections_; 53 54 sptr<VSyncController> rsVSyncController_; 55 sptr<VSyncController> appVSyncController_; 56 57 sptr<VSyncDistributor> rsVSyncDistributor_; 58 sptr<VSyncDistributor> appVSyncDistributor_; 59 }; 60 } // Rosen 61 } // OHOS 62 63 #endif // RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_H 64