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: 30 62 48.4 %
Date: 2019-02-19 Functions: 11 36 30.6 %

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

Generated by: LCOV version 1.10