• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 /* Interface for JSVM inspector */
17 
18 #ifndef JSVM_INSPECTOR_AGENT_H
19 #define JSVM_INSPECTOR_AGENT_H
20 #include <string>
21 
22 #include "jsvm_types.h"
23 
24 namespace jsvm {
25 class InspectorAgent {
26 public:
27     static InspectorAgent* New(JSVM_Env);
28     virtual ~InspectorAgent() = default;
29 
30 public:
31     virtual bool Start(const std::string& path, const std::string& hostName, int port, int pid = -1) = 0;
32 
33     // Find avaliable port and open inspector.
34     virtual bool Start(const std::string& path, int pid) = 0;
35 
36     virtual void Stop() = 0;
37 
38     virtual bool IsActive() = 0;
39 
40     virtual void WaitForConnect() = 0;
41 
42     virtual void WaitForDisconnect() = 0;
43 
44     virtual void PauseOnNextJavascriptStatement(const std::string& reason) = 0;
45 };
46 } // namespace jsvm
47 
48 #endif