LCOV - code coverage report
Current view: top level - out/Release/gen/src/inspector/protocol - Profiler.h (source / functions) Hit Total Coverage
Test: app.info Lines: 55 62 88.7 %
Date: 2017-04-26 Functions: 26 37 70.3 %

          Line data    Source code
       1             : // This file is generated
       2             : 
       3             : // Copyright (c) 2016 The Chromium Authors. All rights reserved.
       4             : // Use of this source code is governed by a BSD-style license that can be
       5             : // found in the LICENSE file.
       6             : 
       7             : #ifndef v8_inspector_protocol_Profiler_h
       8             : #define v8_inspector_protocol_Profiler_h
       9             : 
      10             : #include "src/inspector/protocol/Protocol.h"
      11             : // For each imported domain we generate a ValueConversions struct instead of a full domain definition
      12             : // and include Domain::API version from there.
      13             : #include "src/inspector/protocol/Runtime.h"
      14             : #include "src/inspector/protocol/Debugger.h"
      15             : 
      16             : namespace v8_inspector {
      17             : namespace protocol {
      18             : namespace Profiler {
      19             : 
      20             : // ------------- Forward and enum declarations.
      21             : // Profile node. Holds callsite information, execution statistics and child nodes.
      22             : class ProfileNode;
      23             : // Profile.
      24             : class Profile;
      25             : // Specifies a number of samples attributed to a certain source position.
      26             : class PositionTickInfo;
      27             : // Coverage data for a source range.
      28             : class CoverageRange;
      29             : // Coverage data for a JavaScript function.
      30             : class FunctionCoverage;
      31             : // Coverage data for a JavaScript script.
      32             : class ScriptCoverage;
      33             : // Wrapper for notification params
      34             : class ConsoleProfileStartedNotification;
      35             : // Wrapper for notification params
      36             : class ConsoleProfileFinishedNotification;
      37             : 
      38             : // ------------- Type and builder declarations.
      39             : 
      40             : // Profile node. Holds callsite information, execution statistics and child nodes.
      41             : class  ProfileNode : public Serializable{
      42             :     PROTOCOL_DISALLOW_COPY(ProfileNode);
      43             : public:
      44             :     static std::unique_ptr<ProfileNode> fromValue(protocol::Value* value, ErrorSupport* errors);
      45             : 
      46         333 :     ~ProfileNode() override { }
      47             : 
      48             :     int getId() { return m_id; }
      49         111 :     void setId(int value) { m_id = value; }
      50             : 
      51             :     protocol::Runtime::CallFrame* getCallFrame() { return m_callFrame.get(); }
      52             :     void setCallFrame(std::unique_ptr<protocol::Runtime::CallFrame> value) { m_callFrame = std::move(value); }
      53             : 
      54             :     bool hasHitCount() { return m_hitCount.isJust(); }
      55             :     int getHitCount(int defaultValue) { return m_hitCount.isJust() ? m_hitCount.fromJust() : defaultValue; }
      56             :     void setHitCount(int value) { m_hitCount = value; }
      57             : 
      58             :     bool hasChildren() { return m_children.isJust(); }
      59             :     protocol::Array<int>* getChildren(protocol::Array<int>* defaultValue) { return m_children.isJust() ? m_children.fromJust() : defaultValue; }
      60             :     void setChildren(std::unique_ptr<protocol::Array<int>> value) { m_children = std::move(value); }
      61             : 
      62             :     bool hasDeoptReason() { return m_deoptReason.isJust(); }
      63             :     String getDeoptReason(const String& defaultValue) { return m_deoptReason.isJust() ? m_deoptReason.fromJust() : defaultValue; }
      64           0 :     void setDeoptReason(const String& value) { m_deoptReason = value; }
      65             : 
      66             :     bool hasPositionTicks() { return m_positionTicks.isJust(); }
      67             :     protocol::Array<protocol::Profiler::PositionTickInfo>* getPositionTicks(protocol::Array<protocol::Profiler::PositionTickInfo>* defaultValue) { return m_positionTicks.isJust() ? m_positionTicks.fromJust() : defaultValue; }
      68             :     void setPositionTicks(std::unique_ptr<protocol::Array<protocol::Profiler::PositionTickInfo>> value) { m_positionTicks = std::move(value); }
      69             : 
      70             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
      71           0 :     String serialize() override { return toValue()->serialize(); }
      72             :     std::unique_ptr<ProfileNode> clone() const;
      73             : 
      74             :     template<int STATE>
      75             :     class ProfileNodeBuilder {
      76             :     public:
      77             :         enum {
      78             :             NoFieldsSet = 0,
      79             :           IdSet = 1 << 1,
      80             :           CallFrameSet = 1 << 2,
      81             :             AllFieldsSet = (IdSet | CallFrameSet | 0)};
      82             : 
      83             : 
      84             :         ProfileNodeBuilder<STATE | IdSet>& setId(int value)
      85             :         {
      86             :             static_assert(!(STATE & IdSet), "property id should not be set yet");
      87             :             m_result->setId(value);
      88             :             return castState<IdSet>();
      89             :         }
      90             : 
      91             :         ProfileNodeBuilder<STATE | CallFrameSet>& setCallFrame(std::unique_ptr<protocol::Runtime::CallFrame> value)
      92             :         {
      93             :             static_assert(!(STATE & CallFrameSet), "property callFrame should not be set yet");
      94             :             m_result->setCallFrame(std::move(value));
      95             :             return castState<CallFrameSet>();
      96             :         }
      97             : 
      98             :         ProfileNodeBuilder<STATE>& setHitCount(int value)
      99             :         {
     100             :             m_result->setHitCount(value);
     101             :             return *this;
     102             :         }
     103             : 
     104             :         ProfileNodeBuilder<STATE>& setChildren(std::unique_ptr<protocol::Array<int>> value)
     105             :         {
     106             :             m_result->setChildren(std::move(value));
     107             :             return *this;
     108             :         }
     109             : 
     110             :         ProfileNodeBuilder<STATE>& setDeoptReason(const String& value)
     111             :         {
     112             :             m_result->setDeoptReason(value);
     113             :             return *this;
     114             :         }
     115             : 
     116             :         ProfileNodeBuilder<STATE>& setPositionTicks(std::unique_ptr<protocol::Array<protocol::Profiler::PositionTickInfo>> value)
     117             :         {
     118             :             m_result->setPositionTicks(std::move(value));
     119             :             return *this;
     120             :         }
     121             : 
     122             :         std::unique_ptr<ProfileNode> build()
     123             :         {
     124             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     125             :             return std::move(m_result);
     126             :         }
     127             : 
     128             :     private:
     129             :         friend class ProfileNode;
     130         222 :         ProfileNodeBuilder() : m_result(new ProfileNode()) { }
     131             : 
     132             :         template<int STEP> ProfileNodeBuilder<STATE | STEP>& castState()
     133             :         {
     134             :             return *reinterpret_cast<ProfileNodeBuilder<STATE | STEP>*>(this);
     135             :         }
     136             : 
     137             :         std::unique_ptr<protocol::Profiler::ProfileNode> m_result;
     138             :     };
     139             : 
     140             :     static ProfileNodeBuilder<0> create()
     141             :     {
     142         111 :         return ProfileNodeBuilder<0>();
     143             :     }
     144             : 
     145             : private:
     146             :     ProfileNode()
     147         111 :     {
     148         111 :           m_id = 0;
     149             :     }
     150             : 
     151             :     int m_id;
     152             :     std::unique_ptr<protocol::Runtime::CallFrame> m_callFrame;
     153             :     Maybe<int> m_hitCount;
     154             :     Maybe<protocol::Array<int>> m_children;
     155             :     Maybe<String> m_deoptReason;
     156             :     Maybe<protocol::Array<protocol::Profiler::PositionTickInfo>> m_positionTicks;
     157             : };
     158             : 
     159             : 
     160             : // Profile.
     161             : class  Profile : public Serializable{
     162             :     PROTOCOL_DISALLOW_COPY(Profile);
     163             : public:
     164             :     static std::unique_ptr<Profile> fromValue(protocol::Value* value, ErrorSupport* errors);
     165             : 
     166         102 :     ~Profile() override { }
     167             : 
     168             :     protocol::Array<protocol::Profiler::ProfileNode>* getNodes() { return m_nodes.get(); }
     169             :     void setNodes(std::unique_ptr<protocol::Array<protocol::Profiler::ProfileNode>> value) { m_nodes = std::move(value); }
     170             : 
     171             :     double getStartTime() { return m_startTime; }
     172          34 :     void setStartTime(double value) { m_startTime = value; }
     173             : 
     174             :     double getEndTime() { return m_endTime; }
     175          34 :     void setEndTime(double value) { m_endTime = value; }
     176             : 
     177             :     bool hasSamples() { return m_samples.isJust(); }
     178             :     protocol::Array<int>* getSamples(protocol::Array<int>* defaultValue) { return m_samples.isJust() ? m_samples.fromJust() : defaultValue; }
     179             :     void setSamples(std::unique_ptr<protocol::Array<int>> value) { m_samples = std::move(value); }
     180             : 
     181             :     bool hasTimeDeltas() { return m_timeDeltas.isJust(); }
     182             :     protocol::Array<int>* getTimeDeltas(protocol::Array<int>* defaultValue) { return m_timeDeltas.isJust() ? m_timeDeltas.fromJust() : defaultValue; }
     183             :     void setTimeDeltas(std::unique_ptr<protocol::Array<int>> value) { m_timeDeltas = std::move(value); }
     184             : 
     185             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     186           0 :     String serialize() override { return toValue()->serialize(); }
     187             :     std::unique_ptr<Profile> clone() const;
     188             : 
     189             :     template<int STATE>
     190             :     class ProfileBuilder {
     191             :     public:
     192             :         enum {
     193             :             NoFieldsSet = 0,
     194             :           NodesSet = 1 << 1,
     195             :           StartTimeSet = 1 << 2,
     196             :           EndTimeSet = 1 << 3,
     197             :             AllFieldsSet = (NodesSet | StartTimeSet | EndTimeSet | 0)};
     198             : 
     199             : 
     200             :         ProfileBuilder<STATE | NodesSet>& setNodes(std::unique_ptr<protocol::Array<protocol::Profiler::ProfileNode>> value)
     201             :         {
     202             :             static_assert(!(STATE & NodesSet), "property nodes should not be set yet");
     203             :             m_result->setNodes(std::move(value));
     204             :             return castState<NodesSet>();
     205             :         }
     206             : 
     207             :         ProfileBuilder<STATE | StartTimeSet>& setStartTime(double value)
     208             :         {
     209             :             static_assert(!(STATE & StartTimeSet), "property startTime should not be set yet");
     210             :             m_result->setStartTime(value);
     211             :             return castState<StartTimeSet>();
     212             :         }
     213             : 
     214             :         ProfileBuilder<STATE | EndTimeSet>& setEndTime(double value)
     215             :         {
     216             :             static_assert(!(STATE & EndTimeSet), "property endTime should not be set yet");
     217             :             m_result->setEndTime(value);
     218             :             return castState<EndTimeSet>();
     219             :         }
     220             : 
     221             :         ProfileBuilder<STATE>& setSamples(std::unique_ptr<protocol::Array<int>> value)
     222             :         {
     223             :             m_result->setSamples(std::move(value));
     224             :             return *this;
     225             :         }
     226             : 
     227             :         ProfileBuilder<STATE>& setTimeDeltas(std::unique_ptr<protocol::Array<int>> value)
     228             :         {
     229             :             m_result->setTimeDeltas(std::move(value));
     230             :             return *this;
     231             :         }
     232             : 
     233             :         std::unique_ptr<Profile> build()
     234             :         {
     235             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     236             :             return std::move(m_result);
     237             :         }
     238             : 
     239             :     private:
     240             :         friend class Profile;
     241          68 :         ProfileBuilder() : m_result(new Profile()) { }
     242             : 
     243             :         template<int STEP> ProfileBuilder<STATE | STEP>& castState()
     244             :         {
     245             :             return *reinterpret_cast<ProfileBuilder<STATE | STEP>*>(this);
     246             :         }
     247             : 
     248             :         std::unique_ptr<protocol::Profiler::Profile> m_result;
     249             :     };
     250             : 
     251             :     static ProfileBuilder<0> create()
     252             :     {
     253          34 :         return ProfileBuilder<0>();
     254             :     }
     255             : 
     256             : private:
     257             :     Profile()
     258          34 :     {
     259          34 :           m_startTime = 0;
     260          34 :           m_endTime = 0;
     261             :     }
     262             : 
     263             :     std::unique_ptr<protocol::Array<protocol::Profiler::ProfileNode>> m_nodes;
     264             :     double m_startTime;
     265             :     double m_endTime;
     266             :     Maybe<protocol::Array<int>> m_samples;
     267             :     Maybe<protocol::Array<int>> m_timeDeltas;
     268             : };
     269             : 
     270             : 
     271             : // Specifies a number of samples attributed to a certain source position.
     272             : class  PositionTickInfo : public Serializable{
     273             :     PROTOCOL_DISALLOW_COPY(PositionTickInfo);
     274             : public:
     275             :     static std::unique_ptr<PositionTickInfo> fromValue(protocol::Value* value, ErrorSupport* errors);
     276             : 
     277          48 :     ~PositionTickInfo() override { }
     278             : 
     279             :     int getLine() { return m_line; }
     280          24 :     void setLine(int value) { m_line = value; }
     281             : 
     282             :     int getTicks() { return m_ticks; }
     283          24 :     void setTicks(int value) { m_ticks = value; }
     284             : 
     285             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     286           0 :     String serialize() override { return toValue()->serialize(); }
     287             :     std::unique_ptr<PositionTickInfo> clone() const;
     288             : 
     289             :     template<int STATE>
     290             :     class PositionTickInfoBuilder {
     291             :     public:
     292             :         enum {
     293             :             NoFieldsSet = 0,
     294             :           LineSet = 1 << 1,
     295             :           TicksSet = 1 << 2,
     296             :             AllFieldsSet = (LineSet | TicksSet | 0)};
     297             : 
     298             : 
     299             :         PositionTickInfoBuilder<STATE | LineSet>& setLine(int value)
     300             :         {
     301             :             static_assert(!(STATE & LineSet), "property line should not be set yet");
     302             :             m_result->setLine(value);
     303             :             return castState<LineSet>();
     304             :         }
     305             : 
     306             :         PositionTickInfoBuilder<STATE | TicksSet>& setTicks(int value)
     307             :         {
     308             :             static_assert(!(STATE & TicksSet), "property ticks should not be set yet");
     309             :             m_result->setTicks(value);
     310             :             return castState<TicksSet>();
     311             :         }
     312             : 
     313             :         std::unique_ptr<PositionTickInfo> build()
     314             :         {
     315             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     316             :             return std::move(m_result);
     317             :         }
     318             : 
     319             :     private:
     320             :         friend class PositionTickInfo;
     321          48 :         PositionTickInfoBuilder() : m_result(new PositionTickInfo()) { }
     322             : 
     323             :         template<int STEP> PositionTickInfoBuilder<STATE | STEP>& castState()
     324             :         {
     325             :             return *reinterpret_cast<PositionTickInfoBuilder<STATE | STEP>*>(this);
     326             :         }
     327             : 
     328             :         std::unique_ptr<protocol::Profiler::PositionTickInfo> m_result;
     329             :     };
     330             : 
     331             :     static PositionTickInfoBuilder<0> create()
     332             :     {
     333          24 :         return PositionTickInfoBuilder<0>();
     334             :     }
     335             : 
     336             : private:
     337             :     PositionTickInfo()
     338          24 :     {
     339          24 :           m_line = 0;
     340          24 :           m_ticks = 0;
     341             :     }
     342             : 
     343             :     int m_line;
     344             :     int m_ticks;
     345             : };
     346             : 
     347             : 
     348             : // Coverage data for a source range.
     349             : class  CoverageRange : public Serializable{
     350             :     PROTOCOL_DISALLOW_COPY(CoverageRange);
     351             : public:
     352             :     static std::unique_ptr<CoverageRange> fromValue(protocol::Value* value, ErrorSupport* errors);
     353             : 
     354         576 :     ~CoverageRange() override { }
     355             : 
     356             :     int getStartOffset() { return m_startOffset; }
     357         288 :     void setStartOffset(int value) { m_startOffset = value; }
     358             : 
     359             :     int getEndOffset() { return m_endOffset; }
     360         288 :     void setEndOffset(int value) { m_endOffset = value; }
     361             : 
     362             :     int getCount() { return m_count; }
     363         288 :     void setCount(int value) { m_count = value; }
     364             : 
     365             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     366           0 :     String serialize() override { return toValue()->serialize(); }
     367             :     std::unique_ptr<CoverageRange> clone() const;
     368             : 
     369             :     template<int STATE>
     370             :     class CoverageRangeBuilder {
     371             :     public:
     372             :         enum {
     373             :             NoFieldsSet = 0,
     374             :           StartOffsetSet = 1 << 1,
     375             :           EndOffsetSet = 1 << 2,
     376             :           CountSet = 1 << 3,
     377             :             AllFieldsSet = (StartOffsetSet | EndOffsetSet | CountSet | 0)};
     378             : 
     379             : 
     380             :         CoverageRangeBuilder<STATE | StartOffsetSet>& setStartOffset(int value)
     381             :         {
     382             :             static_assert(!(STATE & StartOffsetSet), "property startOffset should not be set yet");
     383             :             m_result->setStartOffset(value);
     384             :             return castState<StartOffsetSet>();
     385             :         }
     386             : 
     387             :         CoverageRangeBuilder<STATE | EndOffsetSet>& setEndOffset(int value)
     388             :         {
     389             :             static_assert(!(STATE & EndOffsetSet), "property endOffset should not be set yet");
     390             :             m_result->setEndOffset(value);
     391             :             return castState<EndOffsetSet>();
     392             :         }
     393             : 
     394             :         CoverageRangeBuilder<STATE | CountSet>& setCount(int value)
     395             :         {
     396             :             static_assert(!(STATE & CountSet), "property count should not be set yet");
     397             :             m_result->setCount(value);
     398             :             return castState<CountSet>();
     399             :         }
     400             : 
     401             :         std::unique_ptr<CoverageRange> build()
     402             :         {
     403             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     404             :             return std::move(m_result);
     405             :         }
     406             : 
     407             :     private:
     408             :         friend class CoverageRange;
     409         576 :         CoverageRangeBuilder() : m_result(new CoverageRange()) { }
     410             : 
     411             :         template<int STEP> CoverageRangeBuilder<STATE | STEP>& castState()
     412             :         {
     413             :             return *reinterpret_cast<CoverageRangeBuilder<STATE | STEP>*>(this);
     414             :         }
     415             : 
     416             :         std::unique_ptr<protocol::Profiler::CoverageRange> m_result;
     417             :     };
     418             : 
     419             :     static CoverageRangeBuilder<0> create()
     420             :     {
     421         288 :         return CoverageRangeBuilder<0>();
     422             :     }
     423             : 
     424             : private:
     425             :     CoverageRange()
     426         288 :     {
     427         288 :           m_startOffset = 0;
     428         288 :           m_endOffset = 0;
     429         288 :           m_count = 0;
     430             :     }
     431             : 
     432             :     int m_startOffset;
     433             :     int m_endOffset;
     434             :     int m_count;
     435             : };
     436             : 
     437             : 
     438             : // Coverage data for a JavaScript function.
     439             : class  FunctionCoverage : public Serializable{
     440             :     PROTOCOL_DISALLOW_COPY(FunctionCoverage);
     441             : public:
     442             :     static std::unique_ptr<FunctionCoverage> fromValue(protocol::Value* value, ErrorSupport* errors);
     443             : 
     444         864 :     ~FunctionCoverage() override { }
     445             : 
     446             :     String getFunctionName() { return m_functionName; }
     447             :     void setFunctionName(const String& value) { m_functionName = value; }
     448             : 
     449             :     protocol::Array<protocol::Profiler::CoverageRange>* getRanges() { return m_ranges.get(); }
     450             :     void setRanges(std::unique_ptr<protocol::Array<protocol::Profiler::CoverageRange>> value) { m_ranges = std::move(value); }
     451             : 
     452             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     453           0 :     String serialize() override { return toValue()->serialize(); }
     454             :     std::unique_ptr<FunctionCoverage> clone() const;
     455             : 
     456             :     template<int STATE>
     457             :     class FunctionCoverageBuilder {
     458             :     public:
     459             :         enum {
     460             :             NoFieldsSet = 0,
     461             :           FunctionNameSet = 1 << 1,
     462             :           RangesSet = 1 << 2,
     463             :             AllFieldsSet = (FunctionNameSet | RangesSet | 0)};
     464             : 
     465             : 
     466             :         FunctionCoverageBuilder<STATE | FunctionNameSet>& setFunctionName(const String& value)
     467             :         {
     468             :             static_assert(!(STATE & FunctionNameSet), "property functionName should not be set yet");
     469             :             m_result->setFunctionName(value);
     470             :             return castState<FunctionNameSet>();
     471             :         }
     472             : 
     473             :         FunctionCoverageBuilder<STATE | RangesSet>& setRanges(std::unique_ptr<protocol::Array<protocol::Profiler::CoverageRange>> value)
     474             :         {
     475             :             static_assert(!(STATE & RangesSet), "property ranges should not be set yet");
     476             :             m_result->setRanges(std::move(value));
     477             :             return castState<RangesSet>();
     478             :         }
     479             : 
     480             :         std::unique_ptr<FunctionCoverage> build()
     481             :         {
     482             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     483             :             return std::move(m_result);
     484             :         }
     485             : 
     486             :     private:
     487             :         friend class FunctionCoverage;
     488         576 :         FunctionCoverageBuilder() : m_result(new FunctionCoverage()) { }
     489             : 
     490             :         template<int STEP> FunctionCoverageBuilder<STATE | STEP>& castState()
     491             :         {
     492             :             return *reinterpret_cast<FunctionCoverageBuilder<STATE | STEP>*>(this);
     493             :         }
     494             : 
     495             :         std::unique_ptr<protocol::Profiler::FunctionCoverage> m_result;
     496             :     };
     497             : 
     498             :     static FunctionCoverageBuilder<0> create()
     499             :     {
     500         288 :         return FunctionCoverageBuilder<0>();
     501             :     }
     502             : 
     503             : private:
     504             :     FunctionCoverage()
     505         576 :     {
     506             :     }
     507             : 
     508             :     String m_functionName;
     509             :     std::unique_ptr<protocol::Array<protocol::Profiler::CoverageRange>> m_ranges;
     510             : };
     511             : 
     512             : 
     513             : // Coverage data for a JavaScript script.
     514             : class  ScriptCoverage : public Serializable{
     515             :     PROTOCOL_DISALLOW_COPY(ScriptCoverage);
     516             : public:
     517             :     static std::unique_ptr<ScriptCoverage> fromValue(protocol::Value* value, ErrorSupport* errors);
     518             : 
     519         360 :     ~ScriptCoverage() override { }
     520             : 
     521             :     String getScriptId() { return m_scriptId; }
     522             :     void setScriptId(const String& value) { m_scriptId = value; }
     523             : 
     524             :     String getUrl() { return m_url; }
     525             :     void setUrl(const String& value) { m_url = value; }
     526             : 
     527             :     protocol::Array<protocol::Profiler::FunctionCoverage>* getFunctions() { return m_functions.get(); }
     528             :     void setFunctions(std::unique_ptr<protocol::Array<protocol::Profiler::FunctionCoverage>> value) { m_functions = std::move(value); }
     529             : 
     530             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     531           0 :     String serialize() override { return toValue()->serialize(); }
     532             :     std::unique_ptr<ScriptCoverage> clone() const;
     533             : 
     534             :     template<int STATE>
     535             :     class ScriptCoverageBuilder {
     536             :     public:
     537             :         enum {
     538             :             NoFieldsSet = 0,
     539             :           ScriptIdSet = 1 << 1,
     540             :           UrlSet = 1 << 2,
     541             :           FunctionsSet = 1 << 3,
     542             :             AllFieldsSet = (ScriptIdSet | UrlSet | FunctionsSet | 0)};
     543             : 
     544             : 
     545             :         ScriptCoverageBuilder<STATE | ScriptIdSet>& setScriptId(const String& value)
     546             :         {
     547             :             static_assert(!(STATE & ScriptIdSet), "property scriptId should not be set yet");
     548             :             m_result->setScriptId(value);
     549             :             return castState<ScriptIdSet>();
     550             :         }
     551             : 
     552             :         ScriptCoverageBuilder<STATE | UrlSet>& setUrl(const String& value)
     553             :         {
     554             :             static_assert(!(STATE & UrlSet), "property url should not be set yet");
     555             :             m_result->setUrl(value);
     556             :             return castState<UrlSet>();
     557             :         }
     558             : 
     559             :         ScriptCoverageBuilder<STATE | FunctionsSet>& setFunctions(std::unique_ptr<protocol::Array<protocol::Profiler::FunctionCoverage>> value)
     560             :         {
     561             :             static_assert(!(STATE & FunctionsSet), "property functions should not be set yet");
     562             :             m_result->setFunctions(std::move(value));
     563             :             return castState<FunctionsSet>();
     564             :         }
     565             : 
     566             :         std::unique_ptr<ScriptCoverage> build()
     567             :         {
     568             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     569             :             return std::move(m_result);
     570             :         }
     571             : 
     572             :     private:
     573             :         friend class ScriptCoverage;
     574         240 :         ScriptCoverageBuilder() : m_result(new ScriptCoverage()) { }
     575             : 
     576             :         template<int STEP> ScriptCoverageBuilder<STATE | STEP>& castState()
     577             :         {
     578             :             return *reinterpret_cast<ScriptCoverageBuilder<STATE | STEP>*>(this);
     579             :         }
     580             : 
     581             :         std::unique_ptr<protocol::Profiler::ScriptCoverage> m_result;
     582             :     };
     583             : 
     584             :     static ScriptCoverageBuilder<0> create()
     585             :     {
     586         120 :         return ScriptCoverageBuilder<0>();
     587             :     }
     588             : 
     589             : private:
     590             :     ScriptCoverage()
     591         240 :     {
     592             :     }
     593             : 
     594             :     String m_scriptId;
     595             :     String m_url;
     596             :     std::unique_ptr<protocol::Array<protocol::Profiler::FunctionCoverage>> m_functions;
     597             : };
     598             : 
     599             : 
     600             : // Wrapper for notification params
     601             : class  ConsoleProfileStartedNotification : public Serializable{
     602             :     PROTOCOL_DISALLOW_COPY(ConsoleProfileStartedNotification);
     603             : public:
     604             :     static std::unique_ptr<ConsoleProfileStartedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
     605             : 
     606          84 :     ~ConsoleProfileStartedNotification() override { }
     607             : 
     608             :     String getId() { return m_id; }
     609             :     void setId(const String& value) { m_id = value; }
     610             : 
     611             :     protocol::Debugger::Location* getLocation() { return m_location.get(); }
     612             :     void setLocation(std::unique_ptr<protocol::Debugger::Location> value) { m_location = std::move(value); }
     613             : 
     614             :     bool hasTitle() { return m_title.isJust(); }
     615             :     String getTitle(const String& defaultValue) { return m_title.isJust() ? m_title.fromJust() : defaultValue; }
     616          56 :     void setTitle(const String& value) { m_title = value; }
     617             : 
     618             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     619          84 :     String serialize() override { return toValue()->serialize(); }
     620             :     std::unique_ptr<ConsoleProfileStartedNotification> clone() const;
     621             : 
     622             :     template<int STATE>
     623             :     class ConsoleProfileStartedNotificationBuilder {
     624             :     public:
     625             :         enum {
     626             :             NoFieldsSet = 0,
     627             :           IdSet = 1 << 1,
     628             :           LocationSet = 1 << 2,
     629             :             AllFieldsSet = (IdSet | LocationSet | 0)};
     630             : 
     631             : 
     632             :         ConsoleProfileStartedNotificationBuilder<STATE | IdSet>& setId(const String& value)
     633             :         {
     634             :             static_assert(!(STATE & IdSet), "property id should not be set yet");
     635             :             m_result->setId(value);
     636             :             return castState<IdSet>();
     637             :         }
     638             : 
     639             :         ConsoleProfileStartedNotificationBuilder<STATE | LocationSet>& setLocation(std::unique_ptr<protocol::Debugger::Location> value)
     640             :         {
     641             :             static_assert(!(STATE & LocationSet), "property location should not be set yet");
     642             :             m_result->setLocation(std::move(value));
     643             :             return castState<LocationSet>();
     644             :         }
     645             : 
     646             :         ConsoleProfileStartedNotificationBuilder<STATE>& setTitle(const String& value)
     647             :         {
     648             :             m_result->setTitle(value);
     649             :             return *this;
     650             :         }
     651             : 
     652             :         std::unique_ptr<ConsoleProfileStartedNotification> build()
     653             :         {
     654             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     655             :             return std::move(m_result);
     656             :         }
     657             : 
     658             :     private:
     659             :         friend class ConsoleProfileStartedNotification;
     660          56 :         ConsoleProfileStartedNotificationBuilder() : m_result(new ConsoleProfileStartedNotification()) { }
     661             : 
     662             :         template<int STEP> ConsoleProfileStartedNotificationBuilder<STATE | STEP>& castState()
     663             :         {
     664             :             return *reinterpret_cast<ConsoleProfileStartedNotificationBuilder<STATE | STEP>*>(this);
     665             :         }
     666             : 
     667             :         std::unique_ptr<protocol::Profiler::ConsoleProfileStartedNotification> m_result;
     668             :     };
     669             : 
     670             :     static ConsoleProfileStartedNotificationBuilder<0> create()
     671             :     {
     672          28 :         return ConsoleProfileStartedNotificationBuilder<0>();
     673             :     }
     674             : 
     675             : private:
     676             :     ConsoleProfileStartedNotification()
     677          56 :     {
     678             :     }
     679             : 
     680             :     String m_id;
     681             :     std::unique_ptr<protocol::Debugger::Location> m_location;
     682             :     Maybe<String> m_title;
     683             : };
     684             : 
     685             : 
     686             : // Wrapper for notification params
     687             : class  ConsoleProfileFinishedNotification : public Serializable{
     688             :     PROTOCOL_DISALLOW_COPY(ConsoleProfileFinishedNotification);
     689             : public:
     690             :     static std::unique_ptr<ConsoleProfileFinishedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
     691             : 
     692          66 :     ~ConsoleProfileFinishedNotification() override { }
     693             : 
     694             :     String getId() { return m_id; }
     695             :     void setId(const String& value) { m_id = value; }
     696             : 
     697             :     protocol::Debugger::Location* getLocation() { return m_location.get(); }
     698             :     void setLocation(std::unique_ptr<protocol::Debugger::Location> value) { m_location = std::move(value); }
     699             : 
     700             :     protocol::Profiler::Profile* getProfile() { return m_profile.get(); }
     701             :     void setProfile(std::unique_ptr<protocol::Profiler::Profile> value) { m_profile = std::move(value); }
     702             : 
     703             :     bool hasTitle() { return m_title.isJust(); }
     704             :     String getTitle(const String& defaultValue) { return m_title.isJust() ? m_title.fromJust() : defaultValue; }
     705          44 :     void setTitle(const String& value) { m_title = value; }
     706             : 
     707             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     708          66 :     String serialize() override { return toValue()->serialize(); }
     709             :     std::unique_ptr<ConsoleProfileFinishedNotification> clone() const;
     710             : 
     711             :     template<int STATE>
     712             :     class ConsoleProfileFinishedNotificationBuilder {
     713             :     public:
     714             :         enum {
     715             :             NoFieldsSet = 0,
     716             :           IdSet = 1 << 1,
     717             :           LocationSet = 1 << 2,
     718             :           ProfileSet = 1 << 3,
     719             :             AllFieldsSet = (IdSet | LocationSet | ProfileSet | 0)};
     720             : 
     721             : 
     722             :         ConsoleProfileFinishedNotificationBuilder<STATE | IdSet>& setId(const String& value)
     723             :         {
     724             :             static_assert(!(STATE & IdSet), "property id should not be set yet");
     725             :             m_result->setId(value);
     726             :             return castState<IdSet>();
     727             :         }
     728             : 
     729             :         ConsoleProfileFinishedNotificationBuilder<STATE | LocationSet>& setLocation(std::unique_ptr<protocol::Debugger::Location> value)
     730             :         {
     731             :             static_assert(!(STATE & LocationSet), "property location should not be set yet");
     732             :             m_result->setLocation(std::move(value));
     733             :             return castState<LocationSet>();
     734             :         }
     735             : 
     736             :         ConsoleProfileFinishedNotificationBuilder<STATE | ProfileSet>& setProfile(std::unique_ptr<protocol::Profiler::Profile> value)
     737             :         {
     738             :             static_assert(!(STATE & ProfileSet), "property profile should not be set yet");
     739             :             m_result->setProfile(std::move(value));
     740             :             return castState<ProfileSet>();
     741             :         }
     742             : 
     743             :         ConsoleProfileFinishedNotificationBuilder<STATE>& setTitle(const String& value)
     744             :         {
     745             :             m_result->setTitle(value);
     746             :             return *this;
     747             :         }
     748             : 
     749             :         std::unique_ptr<ConsoleProfileFinishedNotification> build()
     750             :         {
     751             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     752             :             return std::move(m_result);
     753             :         }
     754             : 
     755             :     private:
     756             :         friend class ConsoleProfileFinishedNotification;
     757          44 :         ConsoleProfileFinishedNotificationBuilder() : m_result(new ConsoleProfileFinishedNotification()) { }
     758             : 
     759             :         template<int STEP> ConsoleProfileFinishedNotificationBuilder<STATE | STEP>& castState()
     760             :         {
     761             :             return *reinterpret_cast<ConsoleProfileFinishedNotificationBuilder<STATE | STEP>*>(this);
     762             :         }
     763             : 
     764             :         std::unique_ptr<protocol::Profiler::ConsoleProfileFinishedNotification> m_result;
     765             :     };
     766             : 
     767             :     static ConsoleProfileFinishedNotificationBuilder<0> create()
     768             :     {
     769          22 :         return ConsoleProfileFinishedNotificationBuilder<0>();
     770             :     }
     771             : 
     772             : private:
     773             :     ConsoleProfileFinishedNotification()
     774          44 :     {
     775             :     }
     776             : 
     777             :     String m_id;
     778             :     std::unique_ptr<protocol::Debugger::Location> m_location;
     779             :     std::unique_ptr<protocol::Profiler::Profile> m_profile;
     780             :     Maybe<String> m_title;
     781             : };
     782             : 
     783             : 
     784             : // ------------- Backend interface.
     785             : 
     786        4573 : class  Backend {
     787             : public:
     788        4573 :     virtual ~Backend() { }
     789             : 
     790             :     virtual DispatchResponse enable() = 0;
     791             :     virtual DispatchResponse disable() = 0;
     792             :     virtual DispatchResponse setSamplingInterval(int in_interval) = 0;
     793             :     virtual DispatchResponse start() = 0;
     794             :     virtual DispatchResponse stop(std::unique_ptr<protocol::Profiler::Profile>* out_profile) = 0;
     795             :     virtual DispatchResponse startPreciseCoverage(Maybe<bool> in_callCount) = 0;
     796             :     virtual DispatchResponse stopPreciseCoverage() = 0;
     797             :     virtual DispatchResponse takePreciseCoverage(std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>>* out_result) = 0;
     798             :     virtual DispatchResponse getBestEffortCoverage(std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>>* out_result) = 0;
     799             : 
     800             : };
     801             : 
     802             : // ------------- Frontend interface.
     803             : 
     804             : class  Frontend {
     805             : public:
     806        4573 :     explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
     807             :     void consoleProfileStarted(const String& id, std::unique_ptr<protocol::Debugger::Location> location, Maybe<String> title = Maybe<String>());
     808             :     void consoleProfileFinished(const String& id, std::unique_ptr<protocol::Debugger::Location> location, std::unique_ptr<protocol::Profiler::Profile> profile, Maybe<String> title = Maybe<String>());
     809             : 
     810             :     void flush();
     811             :     void sendRawNotification(const String&);
     812             : private:
     813             :     FrontendChannel* m_frontendChannel;
     814             : };
     815             : 
     816             : // ------------- Dispatcher.
     817             : 
     818             : class  Dispatcher {
     819             : public:
     820             :     static void wire(UberDispatcher*, Backend*);
     821             : 
     822             : private:
     823             :     Dispatcher() { }
     824             : };
     825             : 
     826             : // ------------- Metainfo.
     827             : 
     828             : class  Metainfo {
     829             : public:
     830             :     using BackendClass = Backend;
     831             :     using FrontendClass = Frontend;
     832             :     using DispatcherClass = Dispatcher;
     833             :     static const char domainName[];
     834             :     static const char commandPrefix[];
     835             :     static const char version[];
     836             : };
     837             : 
     838             : } // namespace Profiler
     839             : } // namespace v8_inspector
     840             : } // namespace protocol
     841             : 
     842             : #endif // !defined(v8_inspector_protocol_Profiler_h)

Generated by: LCOV version 1.10