LCOV - code coverage report
Current view: top level - src/inspector - value-mirror.h (source / functions) Hit Total Coverage
Test: app.info Lines: 7 11 63.6 %
Date: 2019-01-20 Functions: 4 10 40.0 %

          Line data    Source code
       1             : // Copyright 2018 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_INSPECTOR_VALUE_MIRROR_H_
       6             : #define V8_INSPECTOR_VALUE_MIRROR_H_
       7             : 
       8             : #include <memory>
       9             : 
      10             : #include "src/base/macros.h"
      11             : #include "src/inspector/protocol/Protocol.h"
      12             : #include "src/inspector/protocol/Runtime.h"
      13             : #include "src/inspector/string-16.h"
      14             : 
      15             : #include "include/v8-inspector.h"
      16             : #include "include/v8.h"
      17             : 
      18             : namespace v8_inspector {
      19             : 
      20             : class ValueMirror;
      21             : enum class WrapMode;
      22             : 
      23       10476 : struct InternalPropertyMirror {
      24             :   String16 name;
      25             :   std::unique_ptr<ValueMirror> value;
      26             : };
      27             : 
      28    39604080 : struct PropertyMirror {
      29             :   String16 name;
      30             :   bool writable;
      31             :   bool configurable;
      32             :   bool enumerable;
      33             :   bool isOwn;
      34             :   bool isIndex;
      35             :   std::unique_ptr<ValueMirror> value;
      36             :   std::unique_ptr<ValueMirror> getter;
      37             :   std::unique_ptr<ValueMirror> setter;
      38             :   std::unique_ptr<ValueMirror> symbol;
      39             :   std::unique_ptr<ValueMirror> exception;
      40             : };
      41             : 
      42     7251668 : class ValueMirror {
      43             :  public:
      44             :   virtual ~ValueMirror();
      45             : 
      46             :   static std::unique_ptr<ValueMirror> create(v8::Local<v8::Context> context,
      47             :                                              v8::Local<v8::Value> value);
      48             :   virtual protocol::Response buildRemoteObject(
      49             :       v8::Local<v8::Context> context, WrapMode mode,
      50             :       std::unique_ptr<protocol::Runtime::RemoteObject>* result) const = 0;
      51           0 :   virtual void buildPropertyPreview(
      52             :       v8::Local<v8::Context> context, const String16& name,
      53           0 :       std::unique_ptr<protocol::Runtime::PropertyPreview>*) const {}
      54          50 :   virtual void buildObjectPreview(
      55             :       v8::Local<v8::Context> context, bool generatePreviewForTable,
      56             :       int* nameLimit, int* indexLimit,
      57          50 :       std::unique_ptr<protocol::Runtime::ObjectPreview>*) const {}
      58           0 :   virtual void buildEntryPreview(
      59             :       v8::Local<v8::Context> context, int* nameLimit, int* indexLimit,
      60           0 :       std::unique_ptr<protocol::Runtime::ObjectPreview>*) const {}
      61             :   virtual v8::Local<v8::Value> v8Value() const = 0;
      62             : 
      63       79157 :   class PropertyAccumulator {
      64             :    public:
      65       79157 :     virtual ~PropertyAccumulator() = default;
      66             :     virtual bool Add(PropertyMirror mirror) = 0;
      67             :   };
      68             :   static bool getProperties(v8::Local<v8::Context> context,
      69             :                             v8::Local<v8::Object> object, bool ownProperties,
      70             :                             bool accessorPropertiesOnly,
      71             :                             PropertyAccumulator* accumulator);
      72             :   static void getInternalProperties(
      73             :       v8::Local<v8::Context> context, v8::Local<v8::Object> object,
      74             :       std::vector<InternalPropertyMirror>* mirrors);
      75             : };
      76             : }  // namespace v8_inspector
      77             : 
      78             : #endif  // V8_INSPECTOR_VALUE_MIRROR_H_

Generated by: LCOV version 1.10