LCOV - code coverage report
Current view: top level - out/Release/gen/src/inspector/protocol - HeapProfiler.h (source / functions) Hit Total Coverage
Test: app.info Lines: 31 56 55.4 %
Date: 2019-01-20 Functions: 11 29 37.9 %

          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_HeapProfiler_h
       8             : #define v8_inspector_protocol_HeapProfiler_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             : 
      15             : namespace v8_inspector {
      16             : namespace protocol {
      17             : namespace HeapProfiler {
      18             : 
      19             : // ------------- Forward and enum declarations.
      20             : using HeapSnapshotObjectId = String;
      21             : class SamplingHeapProfileNode;
      22             : class SamplingHeapProfileSample;
      23             : class SamplingHeapProfile;
      24             : class AddHeapSnapshotChunkNotification;
      25             : class HeapStatsUpdateNotification;
      26             : class LastSeenObjectIdNotification;
      27             : class ReportHeapSnapshotProgressNotification;
      28             : using ResetProfilesNotification = Object;
      29             : 
      30             : // ------------- Type and builder declarations.
      31             : 
      32             : class  SamplingHeapProfileNode : public Serializable{
      33             :     PROTOCOL_DISALLOW_COPY(SamplingHeapProfileNode);
      34             : public:
      35             :     static std::unique_ptr<SamplingHeapProfileNode> fromValue(protocol::Value* value, ErrorSupport* errors);
      36             : 
      37         150 :     ~SamplingHeapProfileNode() override { }
      38             : 
      39             :     protocol::Runtime::CallFrame* getCallFrame() { return m_callFrame.get(); }
      40             :     void setCallFrame(std::unique_ptr<protocol::Runtime::CallFrame> value) { m_callFrame = std::move(value); }
      41             : 
      42             :     double getSelfSize() { return m_selfSize; }
      43          50 :     void setSelfSize(double value) { m_selfSize = value; }
      44             : 
      45             :     int getId() { return m_id; }
      46          50 :     void setId(int value) { m_id = value; }
      47             : 
      48             :     protocol::Array<protocol::HeapProfiler::SamplingHeapProfileNode>* getChildren() { return m_children.get(); }
      49             :     void setChildren(std::unique_ptr<protocol::Array<protocol::HeapProfiler::SamplingHeapProfileNode>> value) { m_children = std::move(value); }
      50             : 
      51             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
      52           0 :     String serialize() override { return toValue()->serialize(); }
      53             :     std::unique_ptr<SamplingHeapProfileNode> clone() const;
      54             : 
      55             :     template<int STATE>
      56             :     class SamplingHeapProfileNodeBuilder {
      57             :     public:
      58             :         enum {
      59             :             NoFieldsSet = 0,
      60             :             CallFrameSet = 1 << 1,
      61             :             SelfSizeSet = 1 << 2,
      62             :             IdSet = 1 << 3,
      63             :             ChildrenSet = 1 << 4,
      64             :             AllFieldsSet = (CallFrameSet | SelfSizeSet | IdSet | ChildrenSet | 0)};
      65             : 
      66             : 
      67             :         SamplingHeapProfileNodeBuilder<STATE | CallFrameSet>& setCallFrame(std::unique_ptr<protocol::Runtime::CallFrame> value)
      68             :         {
      69             :             static_assert(!(STATE & CallFrameSet), "property callFrame should not be set yet");
      70             :             m_result->setCallFrame(std::move(value));
      71             :             return castState<CallFrameSet>();
      72             :         }
      73             : 
      74             :         SamplingHeapProfileNodeBuilder<STATE | SelfSizeSet>& setSelfSize(double value)
      75             :         {
      76             :             static_assert(!(STATE & SelfSizeSet), "property selfSize should not be set yet");
      77             :             m_result->setSelfSize(value);
      78             :             return castState<SelfSizeSet>();
      79             :         }
      80             : 
      81             :         SamplingHeapProfileNodeBuilder<STATE | IdSet>& setId(int value)
      82             :         {
      83             :             static_assert(!(STATE & IdSet), "property id should not be set yet");
      84             :             m_result->setId(value);
      85             :             return castState<IdSet>();
      86             :         }
      87             : 
      88             :         SamplingHeapProfileNodeBuilder<STATE | ChildrenSet>& setChildren(std::unique_ptr<protocol::Array<protocol::HeapProfiler::SamplingHeapProfileNode>> value)
      89             :         {
      90             :             static_assert(!(STATE & ChildrenSet), "property children should not be set yet");
      91             :             m_result->setChildren(std::move(value));
      92             :             return castState<ChildrenSet>();
      93             :         }
      94             : 
      95             :         std::unique_ptr<SamplingHeapProfileNode> build()
      96             :         {
      97             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
      98             :             return std::move(m_result);
      99             :         }
     100             : 
     101             :     private:
     102             :         friend class SamplingHeapProfileNode;
     103         100 :         SamplingHeapProfileNodeBuilder() : m_result(new SamplingHeapProfileNode()) { }
     104             : 
     105             :         template<int STEP> SamplingHeapProfileNodeBuilder<STATE | STEP>& castState()
     106             :         {
     107             :             return *reinterpret_cast<SamplingHeapProfileNodeBuilder<STATE | STEP>*>(this);
     108             :         }
     109             : 
     110             :         std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfileNode> m_result;
     111             :     };
     112             : 
     113             :     static SamplingHeapProfileNodeBuilder<0> create()
     114             :     {
     115          50 :         return SamplingHeapProfileNodeBuilder<0>();
     116             :     }
     117             : 
     118             : private:
     119             :     SamplingHeapProfileNode()
     120          50 :     {
     121          50 :           m_selfSize = 0;
     122          50 :           m_id = 0;
     123             :     }
     124             : 
     125             :     std::unique_ptr<protocol::Runtime::CallFrame> m_callFrame;
     126             :     double m_selfSize;
     127             :     int m_id;
     128             :     std::unique_ptr<protocol::Array<protocol::HeapProfiler::SamplingHeapProfileNode>> m_children;
     129             : };
     130             : 
     131             : 
     132             : class  SamplingHeapProfileSample : public Serializable{
     133             :     PROTOCOL_DISALLOW_COPY(SamplingHeapProfileSample);
     134             : public:
     135             :     static std::unique_ptr<SamplingHeapProfileSample> fromValue(protocol::Value* value, ErrorSupport* errors);
     136             : 
     137          50 :     ~SamplingHeapProfileSample() override { }
     138             : 
     139             :     double getSize() { return m_size; }
     140          25 :     void setSize(double value) { m_size = value; }
     141             : 
     142             :     int getNodeId() { return m_nodeId; }
     143          25 :     void setNodeId(int value) { m_nodeId = value; }
     144             : 
     145             :     double getOrdinal() { return m_ordinal; }
     146          25 :     void setOrdinal(double value) { m_ordinal = value; }
     147             : 
     148             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     149           0 :     String serialize() override { return toValue()->serialize(); }
     150             :     std::unique_ptr<SamplingHeapProfileSample> clone() const;
     151             : 
     152             :     template<int STATE>
     153             :     class SamplingHeapProfileSampleBuilder {
     154             :     public:
     155             :         enum {
     156             :             NoFieldsSet = 0,
     157             :             SizeSet = 1 << 1,
     158             :             NodeIdSet = 1 << 2,
     159             :             OrdinalSet = 1 << 3,
     160             :             AllFieldsSet = (SizeSet | NodeIdSet | OrdinalSet | 0)};
     161             : 
     162             : 
     163             :         SamplingHeapProfileSampleBuilder<STATE | SizeSet>& setSize(double value)
     164             :         {
     165             :             static_assert(!(STATE & SizeSet), "property size should not be set yet");
     166             :             m_result->setSize(value);
     167             :             return castState<SizeSet>();
     168             :         }
     169             : 
     170             :         SamplingHeapProfileSampleBuilder<STATE | NodeIdSet>& setNodeId(int value)
     171             :         {
     172             :             static_assert(!(STATE & NodeIdSet), "property nodeId should not be set yet");
     173             :             m_result->setNodeId(value);
     174             :             return castState<NodeIdSet>();
     175             :         }
     176             : 
     177             :         SamplingHeapProfileSampleBuilder<STATE | OrdinalSet>& setOrdinal(double value)
     178             :         {
     179             :             static_assert(!(STATE & OrdinalSet), "property ordinal should not be set yet");
     180             :             m_result->setOrdinal(value);
     181             :             return castState<OrdinalSet>();
     182             :         }
     183             : 
     184             :         std::unique_ptr<SamplingHeapProfileSample> build()
     185             :         {
     186             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     187             :             return std::move(m_result);
     188             :         }
     189             : 
     190             :     private:
     191             :         friend class SamplingHeapProfileSample;
     192          50 :         SamplingHeapProfileSampleBuilder() : m_result(new SamplingHeapProfileSample()) { }
     193             : 
     194             :         template<int STEP> SamplingHeapProfileSampleBuilder<STATE | STEP>& castState()
     195             :         {
     196             :             return *reinterpret_cast<SamplingHeapProfileSampleBuilder<STATE | STEP>*>(this);
     197             :         }
     198             : 
     199             :         std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfileSample> m_result;
     200             :     };
     201             : 
     202             :     static SamplingHeapProfileSampleBuilder<0> create()
     203             :     {
     204          25 :         return SamplingHeapProfileSampleBuilder<0>();
     205             :     }
     206             : 
     207             : private:
     208             :     SamplingHeapProfileSample()
     209          25 :     {
     210          25 :           m_size = 0;
     211          25 :           m_nodeId = 0;
     212          25 :           m_ordinal = 0;
     213             :     }
     214             : 
     215             :     double m_size;
     216             :     int m_nodeId;
     217             :     double m_ordinal;
     218             : };
     219             : 
     220             : 
     221             : class  SamplingHeapProfile : public Serializable{
     222             :     PROTOCOL_DISALLOW_COPY(SamplingHeapProfile);
     223             : public:
     224             :     static std::unique_ptr<SamplingHeapProfile> fromValue(protocol::Value* value, ErrorSupport* errors);
     225             : 
     226          60 :     ~SamplingHeapProfile() override { }
     227             : 
     228             :     protocol::HeapProfiler::SamplingHeapProfileNode* getHead() { return m_head.get(); }
     229             :     void setHead(std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfileNode> value) { m_head = std::move(value); }
     230             : 
     231             :     protocol::Array<protocol::HeapProfiler::SamplingHeapProfileSample>* getSamples() { return m_samples.get(); }
     232             :     void setSamples(std::unique_ptr<protocol::Array<protocol::HeapProfiler::SamplingHeapProfileSample>> value) { m_samples = std::move(value); }
     233             : 
     234             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     235           0 :     String serialize() override { return toValue()->serialize(); }
     236             :     std::unique_ptr<SamplingHeapProfile> clone() const;
     237             : 
     238             :     template<int STATE>
     239             :     class SamplingHeapProfileBuilder {
     240             :     public:
     241             :         enum {
     242             :             NoFieldsSet = 0,
     243             :             HeadSet = 1 << 1,
     244             :             SamplesSet = 1 << 2,
     245             :             AllFieldsSet = (HeadSet | SamplesSet | 0)};
     246             : 
     247             : 
     248             :         SamplingHeapProfileBuilder<STATE | HeadSet>& setHead(std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfileNode> value)
     249             :         {
     250             :             static_assert(!(STATE & HeadSet), "property head should not be set yet");
     251             :             m_result->setHead(std::move(value));
     252             :             return castState<HeadSet>();
     253             :         }
     254             : 
     255             :         SamplingHeapProfileBuilder<STATE | SamplesSet>& setSamples(std::unique_ptr<protocol::Array<protocol::HeapProfiler::SamplingHeapProfileSample>> value)
     256             :         {
     257             :             static_assert(!(STATE & SamplesSet), "property samples should not be set yet");
     258             :             m_result->setSamples(std::move(value));
     259             :             return castState<SamplesSet>();
     260             :         }
     261             : 
     262             :         std::unique_ptr<SamplingHeapProfile> build()
     263             :         {
     264             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     265             :             return std::move(m_result);
     266             :         }
     267             : 
     268             :     private:
     269             :         friend class SamplingHeapProfile;
     270          40 :         SamplingHeapProfileBuilder() : m_result(new SamplingHeapProfile()) { }
     271             : 
     272             :         template<int STEP> SamplingHeapProfileBuilder<STATE | STEP>& castState()
     273             :         {
     274             :             return *reinterpret_cast<SamplingHeapProfileBuilder<STATE | STEP>*>(this);
     275             :         }
     276             : 
     277             :         std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfile> m_result;
     278             :     };
     279             : 
     280             :     static SamplingHeapProfileBuilder<0> create()
     281             :     {
     282          20 :         return SamplingHeapProfileBuilder<0>();
     283             :     }
     284             : 
     285             : private:
     286             :     SamplingHeapProfile()
     287          20 :     {
     288             :     }
     289             : 
     290             :     std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfileNode> m_head;
     291             :     std::unique_ptr<protocol::Array<protocol::HeapProfiler::SamplingHeapProfileSample>> m_samples;
     292             : };
     293             : 
     294             : 
     295             : class  AddHeapSnapshotChunkNotification : public Serializable{
     296             :     PROTOCOL_DISALLOW_COPY(AddHeapSnapshotChunkNotification);
     297             : public:
     298             :     static std::unique_ptr<AddHeapSnapshotChunkNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
     299             : 
     300         350 :     ~AddHeapSnapshotChunkNotification() override { }
     301             : 
     302             :     String getChunk() { return m_chunk; }
     303         175 :     void setChunk(const String& value) { m_chunk = value; }
     304             : 
     305             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     306         525 :     String serialize() override { return toValue()->serialize(); }
     307             :     std::unique_ptr<AddHeapSnapshotChunkNotification> clone() const;
     308             : 
     309             :     template<int STATE>
     310             :     class AddHeapSnapshotChunkNotificationBuilder {
     311             :     public:
     312             :         enum {
     313             :             NoFieldsSet = 0,
     314             :             ChunkSet = 1 << 1,
     315             :             AllFieldsSet = (ChunkSet | 0)};
     316             : 
     317             : 
     318             :         AddHeapSnapshotChunkNotificationBuilder<STATE | ChunkSet>& setChunk(const String& value)
     319             :         {
     320             :             static_assert(!(STATE & ChunkSet), "property chunk should not be set yet");
     321             :             m_result->setChunk(value);
     322             :             return castState<ChunkSet>();
     323             :         }
     324             : 
     325             :         std::unique_ptr<AddHeapSnapshotChunkNotification> build()
     326             :         {
     327             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     328             :             return std::move(m_result);
     329             :         }
     330             : 
     331             :     private:
     332             :         friend class AddHeapSnapshotChunkNotification;
     333         350 :         AddHeapSnapshotChunkNotificationBuilder() : m_result(new AddHeapSnapshotChunkNotification()) { }
     334             : 
     335             :         template<int STEP> AddHeapSnapshotChunkNotificationBuilder<STATE | STEP>& castState()
     336             :         {
     337             :             return *reinterpret_cast<AddHeapSnapshotChunkNotificationBuilder<STATE | STEP>*>(this);
     338             :         }
     339             : 
     340             :         std::unique_ptr<protocol::HeapProfiler::AddHeapSnapshotChunkNotification> m_result;
     341             :     };
     342             : 
     343             :     static AddHeapSnapshotChunkNotificationBuilder<0> create()
     344             :     {
     345         175 :         return AddHeapSnapshotChunkNotificationBuilder<0>();
     346             :     }
     347             : 
     348             : private:
     349             :     AddHeapSnapshotChunkNotification()
     350         175 :     {
     351             :     }
     352             : 
     353             :     String m_chunk;
     354             : };
     355             : 
     356             : 
     357             : class  HeapStatsUpdateNotification : public Serializable{
     358             :     PROTOCOL_DISALLOW_COPY(HeapStatsUpdateNotification);
     359             : public:
     360             :     static std::unique_ptr<HeapStatsUpdateNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
     361             : 
     362           0 :     ~HeapStatsUpdateNotification() override { }
     363             : 
     364             :     protocol::Array<int>* getStatsUpdate() { return m_statsUpdate.get(); }
     365             :     void setStatsUpdate(std::unique_ptr<protocol::Array<int>> value) { m_statsUpdate = std::move(value); }
     366             : 
     367             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     368           0 :     String serialize() override { return toValue()->serialize(); }
     369             :     std::unique_ptr<HeapStatsUpdateNotification> clone() const;
     370             : 
     371             :     template<int STATE>
     372             :     class HeapStatsUpdateNotificationBuilder {
     373             :     public:
     374             :         enum {
     375             :             NoFieldsSet = 0,
     376             :             StatsUpdateSet = 1 << 1,
     377             :             AllFieldsSet = (StatsUpdateSet | 0)};
     378             : 
     379             : 
     380             :         HeapStatsUpdateNotificationBuilder<STATE | StatsUpdateSet>& setStatsUpdate(std::unique_ptr<protocol::Array<int>> value)
     381             :         {
     382             :             static_assert(!(STATE & StatsUpdateSet), "property statsUpdate should not be set yet");
     383             :             m_result->setStatsUpdate(std::move(value));
     384             :             return castState<StatsUpdateSet>();
     385             :         }
     386             : 
     387             :         std::unique_ptr<HeapStatsUpdateNotification> build()
     388             :         {
     389             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     390             :             return std::move(m_result);
     391             :         }
     392             : 
     393             :     private:
     394             :         friend class HeapStatsUpdateNotification;
     395           0 :         HeapStatsUpdateNotificationBuilder() : m_result(new HeapStatsUpdateNotification()) { }
     396             : 
     397             :         template<int STEP> HeapStatsUpdateNotificationBuilder<STATE | STEP>& castState()
     398             :         {
     399             :             return *reinterpret_cast<HeapStatsUpdateNotificationBuilder<STATE | STEP>*>(this);
     400             :         }
     401             : 
     402             :         std::unique_ptr<protocol::HeapProfiler::HeapStatsUpdateNotification> m_result;
     403             :     };
     404             : 
     405             :     static HeapStatsUpdateNotificationBuilder<0> create()
     406             :     {
     407             :         return HeapStatsUpdateNotificationBuilder<0>();
     408             :     }
     409             : 
     410             : private:
     411             :     HeapStatsUpdateNotification()
     412           0 :     {
     413             :     }
     414             : 
     415             :     std::unique_ptr<protocol::Array<int>> m_statsUpdate;
     416             : };
     417             : 
     418             : 
     419             : class  LastSeenObjectIdNotification : public Serializable{
     420             :     PROTOCOL_DISALLOW_COPY(LastSeenObjectIdNotification);
     421             : public:
     422             :     static std::unique_ptr<LastSeenObjectIdNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
     423             : 
     424           0 :     ~LastSeenObjectIdNotification() override { }
     425             : 
     426             :     int getLastSeenObjectId() { return m_lastSeenObjectId; }
     427           0 :     void setLastSeenObjectId(int value) { m_lastSeenObjectId = value; }
     428             : 
     429             :     double getTimestamp() { return m_timestamp; }
     430           0 :     void setTimestamp(double value) { m_timestamp = value; }
     431             : 
     432             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     433           0 :     String serialize() override { return toValue()->serialize(); }
     434             :     std::unique_ptr<LastSeenObjectIdNotification> clone() const;
     435             : 
     436             :     template<int STATE>
     437             :     class LastSeenObjectIdNotificationBuilder {
     438             :     public:
     439             :         enum {
     440             :             NoFieldsSet = 0,
     441             :             LastSeenObjectIdSet = 1 << 1,
     442             :             TimestampSet = 1 << 2,
     443             :             AllFieldsSet = (LastSeenObjectIdSet | TimestampSet | 0)};
     444             : 
     445             : 
     446             :         LastSeenObjectIdNotificationBuilder<STATE | LastSeenObjectIdSet>& setLastSeenObjectId(int value)
     447             :         {
     448             :             static_assert(!(STATE & LastSeenObjectIdSet), "property lastSeenObjectId should not be set yet");
     449             :             m_result->setLastSeenObjectId(value);
     450             :             return castState<LastSeenObjectIdSet>();
     451             :         }
     452             : 
     453             :         LastSeenObjectIdNotificationBuilder<STATE | TimestampSet>& setTimestamp(double value)
     454             :         {
     455             :             static_assert(!(STATE & TimestampSet), "property timestamp should not be set yet");
     456             :             m_result->setTimestamp(value);
     457             :             return castState<TimestampSet>();
     458             :         }
     459             : 
     460             :         std::unique_ptr<LastSeenObjectIdNotification> build()
     461             :         {
     462             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     463             :             return std::move(m_result);
     464             :         }
     465             : 
     466             :     private:
     467             :         friend class LastSeenObjectIdNotification;
     468           0 :         LastSeenObjectIdNotificationBuilder() : m_result(new LastSeenObjectIdNotification()) { }
     469             : 
     470             :         template<int STEP> LastSeenObjectIdNotificationBuilder<STATE | STEP>& castState()
     471             :         {
     472             :             return *reinterpret_cast<LastSeenObjectIdNotificationBuilder<STATE | STEP>*>(this);
     473             :         }
     474             : 
     475             :         std::unique_ptr<protocol::HeapProfiler::LastSeenObjectIdNotification> m_result;
     476             :     };
     477             : 
     478             :     static LastSeenObjectIdNotificationBuilder<0> create()
     479             :     {
     480           0 :         return LastSeenObjectIdNotificationBuilder<0>();
     481             :     }
     482             : 
     483             : private:
     484             :     LastSeenObjectIdNotification()
     485           0 :     {
     486           0 :           m_lastSeenObjectId = 0;
     487           0 :           m_timestamp = 0;
     488             :     }
     489             : 
     490             :     int m_lastSeenObjectId;
     491             :     double m_timestamp;
     492             : };
     493             : 
     494             : 
     495             : class  ReportHeapSnapshotProgressNotification : public Serializable{
     496             :     PROTOCOL_DISALLOW_COPY(ReportHeapSnapshotProgressNotification);
     497             : public:
     498             :     static std::unique_ptr<ReportHeapSnapshotProgressNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
     499             : 
     500           0 :     ~ReportHeapSnapshotProgressNotification() override { }
     501             : 
     502             :     int getDone() { return m_done; }
     503           0 :     void setDone(int value) { m_done = value; }
     504             : 
     505             :     int getTotal() { return m_total; }
     506           0 :     void setTotal(int value) { m_total = value; }
     507             : 
     508             :     bool hasFinished() { return m_finished.isJust(); }
     509             :     bool getFinished(bool defaultValue) { return m_finished.isJust() ? m_finished.fromJust() : defaultValue; }
     510             :     void setFinished(bool value) { m_finished = value; }
     511             : 
     512             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     513           0 :     String serialize() override { return toValue()->serialize(); }
     514             :     std::unique_ptr<ReportHeapSnapshotProgressNotification> clone() const;
     515             : 
     516             :     template<int STATE>
     517             :     class ReportHeapSnapshotProgressNotificationBuilder {
     518             :     public:
     519             :         enum {
     520             :             NoFieldsSet = 0,
     521             :             DoneSet = 1 << 1,
     522             :             TotalSet = 1 << 2,
     523             :             AllFieldsSet = (DoneSet | TotalSet | 0)};
     524             : 
     525             : 
     526             :         ReportHeapSnapshotProgressNotificationBuilder<STATE | DoneSet>& setDone(int value)
     527             :         {
     528             :             static_assert(!(STATE & DoneSet), "property done should not be set yet");
     529             :             m_result->setDone(value);
     530             :             return castState<DoneSet>();
     531             :         }
     532             : 
     533             :         ReportHeapSnapshotProgressNotificationBuilder<STATE | TotalSet>& setTotal(int value)
     534             :         {
     535             :             static_assert(!(STATE & TotalSet), "property total should not be set yet");
     536             :             m_result->setTotal(value);
     537             :             return castState<TotalSet>();
     538             :         }
     539             : 
     540             :         ReportHeapSnapshotProgressNotificationBuilder<STATE>& setFinished(bool value)
     541             :         {
     542             :             m_result->setFinished(value);
     543             :             return *this;
     544             :         }
     545             : 
     546             :         std::unique_ptr<ReportHeapSnapshotProgressNotification> build()
     547             :         {
     548             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     549             :             return std::move(m_result);
     550             :         }
     551             : 
     552             :     private:
     553             :         friend class ReportHeapSnapshotProgressNotification;
     554           0 :         ReportHeapSnapshotProgressNotificationBuilder() : m_result(new ReportHeapSnapshotProgressNotification()) { }
     555             : 
     556             :         template<int STEP> ReportHeapSnapshotProgressNotificationBuilder<STATE | STEP>& castState()
     557             :         {
     558             :             return *reinterpret_cast<ReportHeapSnapshotProgressNotificationBuilder<STATE | STEP>*>(this);
     559             :         }
     560             : 
     561             :         std::unique_ptr<protocol::HeapProfiler::ReportHeapSnapshotProgressNotification> m_result;
     562             :     };
     563             : 
     564             :     static ReportHeapSnapshotProgressNotificationBuilder<0> create()
     565             :     {
     566           0 :         return ReportHeapSnapshotProgressNotificationBuilder<0>();
     567             :     }
     568             : 
     569             : private:
     570             :     ReportHeapSnapshotProgressNotification()
     571           0 :     {
     572           0 :           m_done = 0;
     573           0 :           m_total = 0;
     574             :     }
     575             : 
     576             :     int m_done;
     577             :     int m_total;
     578             :     Maybe<bool> m_finished;
     579             : };
     580             : 
     581             : 
     582             : // ------------- Backend interface.
     583             : 
     584        3834 : class  Backend {
     585             : public:
     586        3834 :     virtual ~Backend() { }
     587             : 
     588             :     virtual DispatchResponse addInspectedHeapObject(const String& in_heapObjectId) = 0;
     589             :     virtual DispatchResponse collectGarbage() = 0;
     590             :     virtual DispatchResponse disable() = 0;
     591             :     virtual DispatchResponse enable() = 0;
     592             :     virtual DispatchResponse getHeapObjectId(const String& in_objectId, String* out_heapSnapshotObjectId) = 0;
     593             :     virtual DispatchResponse getObjectByHeapObjectId(const String& in_objectId, Maybe<String> in_objectGroup, std::unique_ptr<protocol::Runtime::RemoteObject>* out_result) = 0;
     594             :     virtual DispatchResponse getSamplingProfile(std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfile>* out_profile) = 0;
     595             :     virtual DispatchResponse startSampling(Maybe<double> in_samplingInterval) = 0;
     596             :     virtual DispatchResponse startTrackingHeapObjects(Maybe<bool> in_trackAllocations) = 0;
     597             :     virtual DispatchResponse stopSampling(std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfile>* out_profile) = 0;
     598             :     virtual DispatchResponse stopTrackingHeapObjects(Maybe<bool> in_reportProgress) = 0;
     599             :     virtual DispatchResponse takeHeapSnapshot(Maybe<bool> in_reportProgress) = 0;
     600             : 
     601             : };
     602             : 
     603             : // ------------- Frontend interface.
     604             : 
     605             : class  Frontend {
     606             : public:
     607        3834 :     explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
     608             :     void addHeapSnapshotChunk(const String& chunk);
     609             :     void heapStatsUpdate(std::unique_ptr<protocol::Array<int>> statsUpdate);
     610             :     void lastSeenObjectId(int lastSeenObjectId, double timestamp);
     611             :     void reportHeapSnapshotProgress(int done, int total, Maybe<bool> finished = Maybe<bool>());
     612             :     void resetProfiles();
     613             : 
     614             :     void flush();
     615             :     void sendRawNotification(const String&);
     616             : private:
     617             :     FrontendChannel* m_frontendChannel;
     618             : };
     619             : 
     620             : // ------------- Dispatcher.
     621             : 
     622             : class  Dispatcher {
     623             : public:
     624             :     static void wire(UberDispatcher*, Backend*);
     625             : 
     626             : private:
     627             :     Dispatcher() { }
     628             : };
     629             : 
     630             : // ------------- Metainfo.
     631             : 
     632             : class  Metainfo {
     633             : public:
     634             :     using BackendClass = Backend;
     635             :     using FrontendClass = Frontend;
     636             :     using DispatcherClass = Dispatcher;
     637             :     static const char domainName[];
     638             :     static const char commandPrefix[];
     639             :     static const char version[];
     640             : };
     641             : 
     642             : } // namespace HeapProfiler
     643             : } // namespace v8_inspector
     644             : } // namespace protocol
     645             : 
     646             : #endif // !defined(v8_inspector_protocol_HeapProfiler_h)

Generated by: LCOV version 1.10