• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ECMASCRIPT_TOOLING_BASE_PT_PARAMS_H
17 #define ECMASCRIPT_TOOLING_BASE_PT_PARAMS_H
18 
19 #include "ecmascript/tooling/base/pt_types.h"
20 
21 namespace panda::ecmascript::tooling {
22 class PtBaseParams : public PtBaseTypes {
23 public:
24     PtBaseParams() = default;
25     ~PtBaseParams() override = default;
ToJson()26     std::unique_ptr<PtJson> ToJson() const override
27     {
28         UNREACHABLE();
29     }
30 
31 private:
32     NO_COPY_SEMANTIC(PtBaseParams);
33     NO_MOVE_SEMANTIC(PtBaseParams);
34 };
35 
36 class EnableParams : public PtBaseParams {
37 public:
38     EnableParams() = default;
39     ~EnableParams() override = default;
40 
41     static std::unique_ptr<EnableParams> Create(const PtJson &params);
42 
GetMaxScriptsCacheSize()43     double GetMaxScriptsCacheSize() const
44     {
45         return maxScriptsCacheSize_.value_or(0);
46     }
47 
HasMaxScriptsCacheSize()48     bool HasMaxScriptsCacheSize() const
49     {
50         return maxScriptsCacheSize_.has_value();
51     }
52 
53 private:
54     NO_COPY_SEMANTIC(EnableParams);
55     NO_MOVE_SEMANTIC(EnableParams);
56 
57     std::optional<double> maxScriptsCacheSize_ {};
58 };
59 
60 class EvaluateOnCallFrameParams : public PtBaseParams {
61 public:
62     EvaluateOnCallFrameParams() = default;
63     ~EvaluateOnCallFrameParams() override = default;
64 
65     static std::unique_ptr<EvaluateOnCallFrameParams> Create(const PtJson &params);
66 
GetCallFrameId()67     CallFrameId GetCallFrameId() const
68     {
69         return callFrameId_;
70     }
71 
GetExpression()72     const std::string &GetExpression() const
73     {
74         return expression_;
75     }
76 
77 private:
78     NO_COPY_SEMANTIC(EvaluateOnCallFrameParams);
79     NO_MOVE_SEMANTIC(EvaluateOnCallFrameParams);
80 
81     CallFrameId callFrameId_ {};
82     std::string expression_ {};
83     std::optional<std::string> objectGroup_ {};
84     std::optional<bool> includeCommandLineAPI_ {};
85     std::optional<bool> silent_ {};
86     std::optional<bool> returnByValue_ {};
87     std::optional<bool> generatePreview_ {};
88     std::optional<bool> throwOnSideEffect_ {};
89 };
90 
91 class GetPossibleBreakpointsParams : public PtBaseParams {
92 public:
93     GetPossibleBreakpointsParams() = default;
94     ~GetPossibleBreakpointsParams() override = default;
95 
96     static std::unique_ptr<GetPossibleBreakpointsParams> Create(const PtJson &params);
97 
GetStart()98     Location *GetStart() const
99     {
100         return start_.get();
101     }
102 
GetEnd()103     Location *GetEnd() const
104     {
105         if (end_) {
106             return end_->get();
107         }
108         return nullptr;
109     }
110 
HasEnd()111     bool HasEnd() const
112     {
113         return end_.has_value();
114     }
115 
GetRestrictToFunction()116     bool GetRestrictToFunction() const
117     {
118         return restrictToFunction_.value_or(false);
119     }
120 
HasRestrictToFunction()121     bool HasRestrictToFunction() const
122     {
123         return restrictToFunction_.has_value();
124     }
125 
126 private:
127     NO_COPY_SEMANTIC(GetPossibleBreakpointsParams);
128     NO_MOVE_SEMANTIC(GetPossibleBreakpointsParams);
129 
130     std::unique_ptr<Location> start_ {nullptr};
131     std::optional<std::unique_ptr<Location>> end_ {};
132     std::optional<bool> restrictToFunction_ {};
133 };
134 
135 class GetScriptSourceParams : public PtBaseParams {
136 public:
137     GetScriptSourceParams() = default;
138     ~GetScriptSourceParams() override = default;
139 
140     static std::unique_ptr<GetScriptSourceParams> Create(const PtJson &params);
141 
GetScriptId()142     ScriptId GetScriptId() const
143     {
144         return scriptId_;
145     }
146 
147 private:
148     NO_COPY_SEMANTIC(GetScriptSourceParams);
149     NO_MOVE_SEMANTIC(GetScriptSourceParams);
150 
151     ScriptId scriptId_ {0};
152 };
153 
154 class RemoveBreakpointParams : public PtBaseParams {
155 public:
156     RemoveBreakpointParams() = default;
157     ~RemoveBreakpointParams() override = default;
158 
159     static std::unique_ptr<RemoveBreakpointParams> Create(const PtJson &params);
160 
GetBreakpointId()161     BreakpointId GetBreakpointId() const
162     {
163         return breakpointId_;
164     }
165 
166 private:
167     NO_COPY_SEMANTIC(RemoveBreakpointParams);
168     NO_MOVE_SEMANTIC(RemoveBreakpointParams);
169 
170     BreakpointId breakpointId_ {};
171 };
172 
173 class ResumeParams : public PtBaseParams {
174 public:
175     ResumeParams() = default;
176     ~ResumeParams() override = default;
177 
178     static std::unique_ptr<ResumeParams> Create(const PtJson &params);
179 
GetTerminateOnResume()180     bool GetTerminateOnResume() const
181     {
182         return terminateOnResume_.value_or(false);
183     }
184 
HasTerminateOnResume()185     bool HasTerminateOnResume() const
186     {
187         return terminateOnResume_.has_value();
188     }
189 
190 private:
191     NO_COPY_SEMANTIC(ResumeParams);
192     NO_MOVE_SEMANTIC(ResumeParams);
193 
194     std::optional<bool> terminateOnResume_ {};
195 };
196 
197 class SetAsyncCallStackDepthParams : public PtBaseParams {
198 public:
199     SetAsyncCallStackDepthParams() = default;
200     ~SetAsyncCallStackDepthParams() override = default;
201 
202     static std::unique_ptr<SetAsyncCallStackDepthParams> Create(const PtJson &params);
203 
GetMaxDepth()204     int32_t GetMaxDepth() const
205     {
206         return maxDepth_;
207     }
208 
209 private:
210     NO_COPY_SEMANTIC(SetAsyncCallStackDepthParams);
211     NO_MOVE_SEMANTIC(SetAsyncCallStackDepthParams);
212 
213     int32_t maxDepth_ {0};
214 };
215 
216 class SetBlackboxPatternsParams : public PtBaseParams {
217 public:
218     SetBlackboxPatternsParams() = default;
219     ~SetBlackboxPatternsParams() override = default;
220     static std::unique_ptr<SetBlackboxPatternsParams> Create(const PtJson &params);
221 
GetPatterns()222     std::list<std::string> GetPatterns() const
223     {
224         return patterns_;
225     }
226 
227 private:
228     NO_COPY_SEMANTIC(SetBlackboxPatternsParams);
229     NO_MOVE_SEMANTIC(SetBlackboxPatternsParams);
230 
231     std::list<std::string> patterns_ {};
232 };
233 
234 class SetBreakpointByUrlParams : public PtBaseParams {
235 public:
236     SetBreakpointByUrlParams() = default;
237     ~SetBreakpointByUrlParams() override = default;
238 
239     static std::unique_ptr<SetBreakpointByUrlParams> Create(const PtJson &params);
240 
GetLine()241     int32_t GetLine() const
242     {
243         return lineNumber_;
244     }
245 
GetUrl()246     const std::string &GetUrl() const
247     {
248         ASSERT(HasUrl());
249         return url_.value();
250     }
251 
HasUrl()252     bool HasUrl() const
253     {
254         return url_.has_value();
255     }
256 
GetUrlRegex()257     const std::string &GetUrlRegex() const
258     {
259         ASSERT(HasUrlRegex());
260         return urlRegex_.value();
261     }
262 
HasUrlRegex()263     bool HasUrlRegex() const
264     {
265         return urlRegex_.has_value();
266     }
267 
GetScriptHash()268     const std::string &GetScriptHash() const
269     {
270         ASSERT(HasScriptHash());
271         return scriptHash_.value();
272     }
273 
HasScriptHash()274     bool HasScriptHash() const
275     {
276         return scriptHash_.has_value();
277     }
278 
GetColumn()279     int32_t GetColumn() const
280     {
281         return columnNumber_.value_or(0);
282     }
283 
HasColumn()284     bool HasColumn() const
285     {
286         return columnNumber_.has_value();
287     }
288 
GetCondition()289     const std::string &GetCondition() const
290     {
291         ASSERT(HasCondition());
292         return condition_.value();
293     }
294 
HasCondition()295     bool HasCondition() const
296     {
297         return condition_.has_value();
298     }
299 
300 private:
301     NO_COPY_SEMANTIC(SetBreakpointByUrlParams);
302     NO_MOVE_SEMANTIC(SetBreakpointByUrlParams);
303 
304     int32_t lineNumber_ {0};
305     std::optional<std::string> url_ {};
306     std::optional<std::string> urlRegex_ {};
307     std::optional<std::string> scriptHash_ {};
308     std::optional<int32_t> columnNumber_ {0};
309     std::optional<std::string> condition_ {};
310 };
311 
312 enum class PauseOnExceptionsState : uint8_t { NONE, UNCAUGHT, ALL };
313 
314 class SetPauseOnExceptionsParams : public PtBaseParams {
315 public:
316     SetPauseOnExceptionsParams() = default;
317     ~SetPauseOnExceptionsParams() override = default;
318     static std::unique_ptr<SetPauseOnExceptionsParams> Create(const PtJson &params);
319 
GetState()320     PauseOnExceptionsState GetState() const
321     {
322         return state_;
323     }
324 
StoreState(const std::string & state)325     bool StoreState(const std::string &state)
326     {
327         if (state == "none") {
328             state_ = PauseOnExceptionsState::NONE;
329             return true;
330         }
331         if (state == "uncaught") {
332             state_ = PauseOnExceptionsState::UNCAUGHT;
333             return true;
334         }
335         if (state == "all") {
336             state_ = PauseOnExceptionsState::ALL;
337             return true;
338         }
339         return false;
340     }
341 
342 private:
343     NO_COPY_SEMANTIC(SetPauseOnExceptionsParams);
344     NO_MOVE_SEMANTIC(SetPauseOnExceptionsParams);
345 
346     PauseOnExceptionsState state_ {PauseOnExceptionsState::ALL};
347 };
348 
349 class StepIntoParams : public PtBaseParams {
350 public:
351     StepIntoParams() = default;
352     ~StepIntoParams() override = default;
353 
354     static std::unique_ptr<StepIntoParams> Create(const PtJson &params);
355 
GetBreakOnAsyncCall()356     bool GetBreakOnAsyncCall() const
357     {
358         return breakOnAsyncCall_.value_or(false);
359     }
360 
HasBreakOnAsyncCall()361     bool HasBreakOnAsyncCall() const
362     {
363         return breakOnAsyncCall_.has_value();
364     }
365 
GetSkipList()366     const std::list<std::unique_ptr<LocationRange>> *GetSkipList() const
367     {
368         if (!skipList_) {
369             return nullptr;
370         }
371         return &(skipList_.value());
372     }
373 
HasSkipList()374     bool HasSkipList() const
375     {
376         return skipList_.has_value();
377     }
378 
379 private:
380     NO_COPY_SEMANTIC(StepIntoParams);
381     NO_MOVE_SEMANTIC(StepIntoParams);
382 
383     std::optional<bool> breakOnAsyncCall_ {};
384     std::optional<std::list<std::unique_ptr<LocationRange>>> skipList_ {};
385 };
386 
387 class StepOverParams : public PtBaseParams {
388 public:
389     StepOverParams() = default;
390     ~StepOverParams() override = default;
391 
392     static std::unique_ptr<StepOverParams> Create(const PtJson &params);
393 
GetSkipList()394     const std::list<std::unique_ptr<LocationRange>> *GetSkipList() const
395     {
396         if (!skipList_) {
397             return nullptr;
398         }
399         return &(skipList_.value());
400     }
401 
HasSkipList()402     bool HasSkipList() const
403     {
404         return skipList_.has_value();
405     }
406 
407 private:
408     NO_COPY_SEMANTIC(StepOverParams);
409     NO_MOVE_SEMANTIC(StepOverParams);
410 
411     std::optional<std::list<std::unique_ptr<LocationRange>>> skipList_ {};
412 };
413 
414 class GetPropertiesParams : public PtBaseParams {
415 public:
416     GetPropertiesParams() = default;
417     ~GetPropertiesParams() override = default;
418 
419     static std::unique_ptr<GetPropertiesParams> Create(const PtJson &params);
420 
GetObjectId()421     RemoteObjectId GetObjectId() const
422     {
423         return objectId_;
424     }
425 
GetOwnProperties()426     bool GetOwnProperties() const
427     {
428         return ownProperties_.value_or(false);
429     }
430 
HasOwnProperties()431     bool HasOwnProperties() const
432     {
433         return ownProperties_.has_value();
434     }
435 
GetAccessPropertiesOnly()436     bool GetAccessPropertiesOnly() const
437     {
438         return accessorPropertiesOnly_.value_or(false);
439     }
440 
HasAccessPropertiesOnly()441     bool HasAccessPropertiesOnly() const
442     {
443         return accessorPropertiesOnly_.has_value();
444     }
445 
GetGeneratePreview()446     bool GetGeneratePreview() const
447     {
448         return generatePreview_.value_or(false);
449     }
450 
HasGeneratePreview()451     bool HasGeneratePreview() const
452     {
453         return generatePreview_.has_value();
454     }
455 
456 private:
457     NO_COPY_SEMANTIC(GetPropertiesParams);
458     NO_MOVE_SEMANTIC(GetPropertiesParams);
459 
460     RemoteObjectId objectId_ {};
461     std::optional<bool> ownProperties_ {};
462     std::optional<bool> accessorPropertiesOnly_ {};
463     std::optional<bool> generatePreview_ {};
464 };
465 
466 class CallFunctionOnParams : public PtBaseParams {
467 public:
468     CallFunctionOnParams() = default;
469     ~CallFunctionOnParams() override = default;
470 
471     static std::unique_ptr<CallFunctionOnParams> Create(const PtJson &params);
472 
GetFunctionDeclaration()473     const std::string &GetFunctionDeclaration()
474     {
475         return functionDeclaration_;
476     }
477 
GetObjectId()478     RemoteObjectId GetObjectId() const
479     {
480         return objectId_.value_or(-1);
481     }
482 
SetObjectId(RemoteObjectId objectId)483     CallFunctionOnParams &SetObjectId(RemoteObjectId objectId)
484     {
485         objectId_ = objectId;
486         return *this;
487     }
488 
HasObjectId()489     bool HasObjectId() const
490     {
491         return objectId_.has_value();
492     }
493 
GetArguments()494     const std::vector<std::unique_ptr<CallArgument>> *GetArguments() const
495     {
496         if (!arguments_) {
497             return nullptr;
498         }
499         return &(arguments_.value());
500     }
501 
HasArguments()502     bool HasArguments() const
503     {
504         return arguments_.has_value();
505     }
506 
GetSilent()507     bool GetSilent() const
508     {
509         return silent_.value_or(false);
510     }
511 
HasSilent()512     bool HasSilent() const
513     {
514         return silent_.has_value();
515     }
516 
GetReturnByValue()517     bool GetReturnByValue() const
518     {
519         return returnByValue_.value_or(false);
520     }
521 
HasReturnByValue()522     bool HasReturnByValue() const
523     {
524         return returnByValue_.has_value();
525     }
526 
GetGeneratePreview()527     bool GetGeneratePreview() const
528     {
529         return generatePreview_.value_or(false);
530     }
531 
HasGeneratePreview()532     bool HasGeneratePreview() const
533     {
534         return generatePreview_.has_value();
535     }
536 
GetUserGesture()537     bool GetUserGesture() const
538     {
539         return userGesture_.value_or(false);
540     }
541 
HasUserGesture()542     bool HasUserGesture() const
543     {
544         return userGesture_.has_value();
545     }
546 
GetAwaitPromise()547     bool GetAwaitPromise() const
548     {
549         return awaitPromise_.value_or(false);
550     }
551 
HasAwaitPromise()552     bool HasAwaitPromise() const
553     {
554         return awaitPromise_.has_value();
555     }
556 
GetExecutionContextId()557     ExecutionContextId GetExecutionContextId() const
558     {
559         return executionContextId_.value_or(-1);
560     }
561 
SetExecutionContextId(ExecutionContextId executionContextId)562     CallFunctionOnParams &SetExecutionContextId(ExecutionContextId executionContextId)
563     {
564         executionContextId_ = executionContextId;
565         return *this;
566     }
567 
HasExecutionContextId()568     bool HasExecutionContextId() const
569     {
570         return executionContextId_.has_value();
571     }
572 
GetObjectGroup()573     const std::string &GetObjectGroup() const
574     {
575         ASSERT(HasObjectGroup());
576         return objectGroup_.value();
577     }
578 
HasObjectGroup()579     bool HasObjectGroup() const
580     {
581         return objectGroup_.has_value();
582     }
583 
GetThrowOnSideEffect()584     bool GetThrowOnSideEffect() const
585     {
586         return throwOnSideEffect_.value_or(false);
587     }
588 
HasThrowOnSideEffect()589     bool HasThrowOnSideEffect() const
590     {
591         return throwOnSideEffect_.has_value();
592     }
593 
594 private:
595     NO_COPY_SEMANTIC(CallFunctionOnParams);
596     NO_MOVE_SEMANTIC(CallFunctionOnParams);
597 
598     std::string functionDeclaration_ {};
599     std::optional<RemoteObjectId> objectId_ {};
600     std::optional<std::vector<std::unique_ptr<CallArgument>>> arguments_ {};
601     std::optional<bool> silent_ {};
602     std::optional<bool> returnByValue_ {};
603     std::optional<bool> generatePreview_ {};
604     std::optional<bool> userGesture_ {};
605     std::optional<bool> awaitPromise_ {};
606     std::optional<ExecutionContextId> executionContextId_ {};
607     std::optional<std::string> objectGroup_ {};
608     std::optional<bool> throwOnSideEffect_ {};
609 };
610 
611 #ifdef SUPPORT_PROFILER_CDP
612 class StartSamplingParams : public PtBaseParams {
613 public:
614     StartSamplingParams() = default;
615     ~StartSamplingParams() override = default;
616 
617     static std::unique_ptr<StartSamplingParams> Create(const PtJson &params);
618 
GetSamplingInterval()619     int32_t GetSamplingInterval() const
620     {
621         return samplingInterval_.value_or(32768);
622     }
623 
624 private:
625     NO_COPY_SEMANTIC(StartSamplingParams);
626     NO_MOVE_SEMANTIC(StartSamplingParams);
627 
628     std::optional<int32_t> samplingInterval_ {32768};
629 };
630 
631 class StartTrackingHeapObjectsParams : public PtBaseParams {
632 public:
633     StartTrackingHeapObjectsParams() = default;
634     ~StartTrackingHeapObjectsParams() override = default;
635 
636     static std::unique_ptr<StartTrackingHeapObjectsParams> Create(const PtJson &params);
637 
GetTrackAllocations()638     bool GetTrackAllocations() const
639     {
640         return trackAllocations_.value_or(false);
641     }
642 
HasTrackAllocations()643     bool HasTrackAllocations() const
644     {
645         return trackAllocations_.has_value();
646     }
647 
648 private:
649     NO_COPY_SEMANTIC(StartTrackingHeapObjectsParams);
650     NO_MOVE_SEMANTIC(StartTrackingHeapObjectsParams);
651 
652     std::optional<bool> trackAllocations_;
653 };
654 
655 class StopTrackingHeapObjectsParams : public PtBaseParams {
656 public:
657     StopTrackingHeapObjectsParams() = default;
658     ~StopTrackingHeapObjectsParams() override = default;
659 
660     static std::unique_ptr<StopTrackingHeapObjectsParams> Create(const PtJson &params);
661 
GetReportProgress()662     bool GetReportProgress() const
663     {
664         return reportProgress_.value_or(false);
665     }
666 
HasReportProgress()667     bool HasReportProgress() const
668     {
669         return reportProgress_.has_value();
670     }
671 
GetTreatGlobalObjectsAsRoots()672     bool GetTreatGlobalObjectsAsRoots() const
673     {
674         return treatGlobalObjectsAsRoots_.value_or(false);
675     }
676 
HasTreatGlobalObjectsAsRoots()677     bool HasTreatGlobalObjectsAsRoots() const
678     {
679         return treatGlobalObjectsAsRoots_.has_value();
680     }
681 
GetCaptureNumericValue()682     bool GetCaptureNumericValue() const
683     {
684         return captureNumericValue_.value_or(false);
685     }
686 
HasCaptureNumericValue()687     bool HasCaptureNumericValue() const
688     {
689         return captureNumericValue_.has_value();
690     }
691 
692 private:
693     NO_COPY_SEMANTIC(StopTrackingHeapObjectsParams);
694     NO_MOVE_SEMANTIC(StopTrackingHeapObjectsParams);
695 
696     std::optional<bool> reportProgress_ {};
697     std::optional<bool> treatGlobalObjectsAsRoots_ {};
698     std::optional<bool> captureNumericValue_ {};
699 };
700 
701 class AddInspectedHeapObjectParams : public PtBaseParams {
702 public:
703     AddInspectedHeapObjectParams() = default;
704     ~AddInspectedHeapObjectParams() override = default;
705 
706     static std::unique_ptr<AddInspectedHeapObjectParams> Create(const PtJson &params);
707 
GetHeapObjectId()708     HeapSnapshotObjectId GetHeapObjectId() const
709     {
710         return heapObjectId_;
711     }
712 
713 private:
714     NO_COPY_SEMANTIC(AddInspectedHeapObjectParams);
715     NO_MOVE_SEMANTIC(AddInspectedHeapObjectParams);
716 
717     HeapSnapshotObjectId heapObjectId_ {};
718 };
719 
720 class GetHeapObjectIdParams : public PtBaseParams {
721 public:
722     GetHeapObjectIdParams() = default;
723     ~GetHeapObjectIdParams() override = default;
724 
725     static std::unique_ptr<GetHeapObjectIdParams> Create(const PtJson &params);
726 
GetObjectId()727     RemoteObjectId GetObjectId() const
728     {
729         return objectId_;
730     }
731 
732 private:
733     NO_COPY_SEMANTIC(GetHeapObjectIdParams);
734     NO_MOVE_SEMANTIC(GetHeapObjectIdParams);
735 
736     RemoteObjectId objectId_ {};
737 };
738 
739 class GetObjectByHeapObjectIdParams : public PtBaseParams {
740 public:
741     GetObjectByHeapObjectIdParams() = default;
742     ~GetObjectByHeapObjectIdParams() override = default;
743 
744     static std::unique_ptr<GetObjectByHeapObjectIdParams> Create(const PtJson &params);
745 
GetObjectId()746     HeapSnapshotObjectId GetObjectId() const
747     {
748         return objectId_;
749     }
750 
GetObjectGroup()751     const std::string &GetObjectGroup() const
752     {
753         ASSERT(HasObjectGroup());
754         return objectGroup_.value();
755     }
756 
HasObjectGroup()757     bool HasObjectGroup() const
758     {
759         return objectGroup_.has_value();
760     }
761 
762 private:
763     NO_COPY_SEMANTIC(GetObjectByHeapObjectIdParams);
764     NO_MOVE_SEMANTIC(GetObjectByHeapObjectIdParams);
765 
766     HeapSnapshotObjectId objectId_ {};
767     std::optional<std::string> objectGroup_ {};
768 };
769 
770 class StartPreciseCoverageParams : public PtBaseParams {
771 public:
772     StartPreciseCoverageParams() = default;
773     ~StartPreciseCoverageParams() override = default;
774 
775     static std::unique_ptr<StartPreciseCoverageParams> Create(const PtJson &params);
776 
GetCallCount()777     bool GetCallCount() const
778     {
779         return callCount_.value_or(false);
780     }
781 
HasCallCount()782     bool HasCallCount() const
783     {
784         return callCount_.has_value();
785     }
786 
GetDetailed()787     bool GetDetailed() const
788     {
789         return detailed_.value_or(false);
790     }
791 
HasDetailed()792     bool HasDetailed() const
793     {
794         return detailed_.has_value();
795     }
796 
GetAllowTriggeredUpdates()797     bool GetAllowTriggeredUpdates() const
798     {
799         return allowTriggeredUpdates_.value_or(false);
800     }
801 
HasAllowTriggeredUpdates()802     bool HasAllowTriggeredUpdates() const
803     {
804         return allowTriggeredUpdates_.has_value();
805     }
806 
807 private:
808     NO_COPY_SEMANTIC(StartPreciseCoverageParams);
809     NO_MOVE_SEMANTIC(StartPreciseCoverageParams);
810 
811     std::optional<bool> callCount_ {};
812     std::optional<bool> detailed_ {};
813     std::optional<bool> allowTriggeredUpdates_ {};
814 };
815 
816 class SetSamplingIntervalParams : public PtBaseParams {
817 public:
818     SetSamplingIntervalParams() = default;
819     ~SetSamplingIntervalParams() override = default;
820 
821     static std::unique_ptr<SetSamplingIntervalParams> Create(const PtJson &params);
822 
GetInterval()823     int32_t GetInterval() const
824     {
825         return interval_;
826     }
827 
SetInterval(int32_t interval)828     SetSamplingIntervalParams &SetInterval(int32_t interval)
829     {
830         interval_ = interval;
831         return *this;
832     }
833 
834 private:
835     NO_COPY_SEMANTIC(SetSamplingIntervalParams);
836     NO_MOVE_SEMANTIC(SetSamplingIntervalParams);
837 
838     int32_t interval_ {0};
839 };
840 #endif
841 }  // namespace panda::ecmascript::tooling
842 #endif