LCOV - code coverage report
Current view: top level - out/Release/gen/src/inspector/protocol - Schema.h (source / functions) Hit Total Coverage
Test: app.info Lines: 3 14 21.4 %
Date: 2019-01-20 Functions: 0 8 0.0 %

          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_Schema_h
       8             : #define v8_inspector_protocol_Schema_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 "include/inspector/Schema.h"
      14             : 
      15             : namespace v8_inspector {
      16             : namespace protocol {
      17             : namespace Schema {
      18             : 
      19             : // ------------- Forward and enum declarations.
      20             : class Domain;
      21             : 
      22             : // ------------- Type and builder declarations.
      23             : 
      24             : class  Domain : public Serializable, public API::Domain{
      25             :     PROTOCOL_DISALLOW_COPY(Domain);
      26             : public:
      27             :     static std::unique_ptr<Domain> fromValue(protocol::Value* value, ErrorSupport* errors);
      28             : 
      29           0 :     ~Domain() override { }
      30             : 
      31             :     String getName() { return m_name; }
      32           0 :     void setName(const String& value) { m_name = value; }
      33             : 
      34             :     String getVersion() { return m_version; }
      35           0 :     void setVersion(const String& value) { m_version = value; }
      36             : 
      37             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
      38           0 :     String serialize() override { return toValue()->serialize(); }
      39             :     std::unique_ptr<Domain> clone() const;
      40             :     std::unique_ptr<StringBuffer> toJSONString() const override;
      41             : 
      42             :     template<int STATE>
      43             :     class DomainBuilder {
      44             :     public:
      45             :         enum {
      46             :             NoFieldsSet = 0,
      47             :             NameSet = 1 << 1,
      48             :             VersionSet = 1 << 2,
      49             :             AllFieldsSet = (NameSet | VersionSet | 0)};
      50             : 
      51             : 
      52             :         DomainBuilder<STATE | NameSet>& setName(const String& value)
      53             :         {
      54             :             static_assert(!(STATE & NameSet), "property name should not be set yet");
      55             :             m_result->setName(value);
      56             :             return castState<NameSet>();
      57             :         }
      58             : 
      59             :         DomainBuilder<STATE | VersionSet>& setVersion(const String& value)
      60             :         {
      61             :             static_assert(!(STATE & VersionSet), "property version should not be set yet");
      62             :             m_result->setVersion(value);
      63             :             return castState<VersionSet>();
      64             :         }
      65             : 
      66             :         std::unique_ptr<Domain> build()
      67             :         {
      68             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
      69             :             return std::move(m_result);
      70             :         }
      71             : 
      72             :     private:
      73             :         friend class Domain;
      74           0 :         DomainBuilder() : m_result(new Domain()) { }
      75             : 
      76             :         template<int STEP> DomainBuilder<STATE | STEP>& castState()
      77             :         {
      78             :             return *reinterpret_cast<DomainBuilder<STATE | STEP>*>(this);
      79             :         }
      80             : 
      81             :         std::unique_ptr<protocol::Schema::Domain> m_result;
      82             :     };
      83             : 
      84             :     static DomainBuilder<0> create()
      85             :     {
      86           0 :         return DomainBuilder<0>();
      87             :     }
      88             : 
      89             : private:
      90           0 :     Domain()
      91           0 :     {
      92           0 :     }
      93             : 
      94             :     String m_name;
      95             :     String m_version;
      96             : };
      97             : 
      98             : 
      99             : // ------------- Backend interface.
     100             : 
     101        3834 : class  Backend {
     102             : public:
     103        3834 :     virtual ~Backend() { }
     104             : 
     105             :     virtual DispatchResponse getDomains(std::unique_ptr<protocol::Array<protocol::Schema::Domain>>* out_domains) = 0;
     106             : 
     107           0 :     virtual DispatchResponse disable()
     108             :     {
     109           0 :         return DispatchResponse::OK();
     110             :     }
     111             : };
     112             : 
     113             : // ------------- Frontend interface.
     114             : 
     115             : class  Frontend {
     116             : public:
     117        3834 :     explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
     118             : 
     119             :     void flush();
     120             :     void sendRawNotification(const String&);
     121             : private:
     122             :     FrontendChannel* m_frontendChannel;
     123             : };
     124             : 
     125             : // ------------- Dispatcher.
     126             : 
     127             : class  Dispatcher {
     128             : public:
     129             :     static void wire(UberDispatcher*, Backend*);
     130             : 
     131             : private:
     132             :     Dispatcher() { }
     133             : };
     134             : 
     135             : // ------------- Metainfo.
     136             : 
     137             : class  Metainfo {
     138             : public:
     139             :     using BackendClass = Backend;
     140             :     using FrontendClass = Frontend;
     141             :     using DispatcherClass = Dispatcher;
     142             :     static const char domainName[];
     143             :     static const char commandPrefix[];
     144             :     static const char version[];
     145             : };
     146             : 
     147             : } // namespace Schema
     148             : } // namespace v8_inspector
     149             : } // namespace protocol
     150             : 
     151             : #endif // !defined(v8_inspector_protocol_Schema_h)

Generated by: LCOV version 1.10