1 /* 2 * Copyright (c) 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 ECMASCRIPT_TOOLING_AGENT_OVERLAY_IMPL_H 17 #define ECMASCRIPT_TOOLING_AGENT_OVERLAY_IMPL_H 18 19 #include "base/pt_params.h" 20 #include "base/pt_returns.h" 21 #include "dispatcher.h" 22 23 #include "libpandabase/macros.h" 24 25 namespace panda::ecmascript::tooling { 26 class OverlayImpl final { 27 public: 28 OverlayImpl() = default; 29 ~OverlayImpl() = default; 30 31 class DispatcherImpl final : public DispatcherBase { 32 public: DispatcherImpl(ProtocolChannel * channel,std::unique_ptr<OverlayImpl> overlay)33 DispatcherImpl(ProtocolChannel *channel, std::unique_ptr<OverlayImpl> overlay) 34 : DispatcherBase(channel), overlay_(std::move(overlay)) {} 35 ~DispatcherImpl() override = default; 36 void Disable(const DispatchRequest &request); 37 void Dispatch(const DispatchRequest &request) override; 38 39 private: 40 NO_COPY_SEMANTIC(DispatcherImpl); 41 NO_MOVE_SEMANTIC(DispatcherImpl); 42 43 using AgentHandler = void (OverlayImpl::DispatcherImpl::*)(const DispatchRequest &request); 44 std::unique_ptr<OverlayImpl> overlay_ {}; 45 }; 46 47 private: 48 NO_COPY_SEMANTIC(OverlayImpl); 49 NO_MOVE_SEMANTIC(OverlayImpl); 50 }; 51 } // namespace panda::ecmascript::tooling 52 #endif