LCOV - code coverage report
Current view: top level - src/inspector - v8-inspector-impl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 1 1 100.0 %
Date: 2017-04-26 Functions: 0 0 -

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2010, Google Inc. All rights reserved.
       3             :  *
       4             :  * Redistribution and use in source and binary forms, with or without
       5             :  * modification, are permitted provided that the following conditions are
       6             :  * met:
       7             :  *
       8             :  *     * Redistributions of source code must retain the above copyright
       9             :  * notice, this list of conditions and the following disclaimer.
      10             :  *     * Redistributions in binary form must reproduce the above
      11             :  * copyright notice, this list of conditions and the following disclaimer
      12             :  * in the documentation and/or other materials provided with the
      13             :  * distribution.
      14             :  *     * Neither the name of Google Inc. nor the names of its
      15             :  * contributors may be used to endorse or promote products derived from
      16             :  * this software without specific prior written permission.
      17             :  *
      18             :  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
      19             :  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
      20             :  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
      21             :  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
      22             :  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
      23             :  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
      24             :  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      25             :  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      26             :  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      27             :  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
      28             :  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      29             :  */
      30             : 
      31             : #ifndef V8_INSPECTOR_V8INSPECTORIMPL_H_
      32             : #define V8_INSPECTOR_V8INSPECTORIMPL_H_
      33             : 
      34             : #include <vector>
      35             : 
      36             : #include "src/base/macros.h"
      37             : #include "src/inspector/protocol/Protocol.h"
      38             : 
      39             : #include "include/v8-inspector.h"
      40             : 
      41             : namespace v8_inspector {
      42             : 
      43             : class InspectedContext;
      44             : class V8Console;
      45             : class V8ConsoleMessageStorage;
      46             : class V8Debugger;
      47             : class V8DebuggerAgentImpl;
      48             : class V8InspectorSessionImpl;
      49             : class V8ProfilerAgentImpl;
      50             : class V8RuntimeAgentImpl;
      51             : class V8StackTraceImpl;
      52             : 
      53             : class V8InspectorImpl : public V8Inspector {
      54             :  public:
      55             :   V8InspectorImpl(v8::Isolate*, V8InspectorClient*);
      56             :   ~V8InspectorImpl() override;
      57             : 
      58             :   v8::Isolate* isolate() const { return m_isolate; }
      59             :   V8InspectorClient* client() { return m_client; }
      60             :   V8Debugger* debugger() { return m_debugger.get(); }
      61             :   int contextGroupId(v8::Local<v8::Context>);
      62             :   int contextGroupId(int contextId);
      63             : 
      64             :   v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::Context>,
      65             :                                                         v8::Local<v8::String>);
      66             :   v8::MaybeLocal<v8::Script> compileScript(v8::Local<v8::Context>,
      67             :                                            const String16& code,
      68             :                                            const String16& fileName);
      69             :   v8::Local<v8::Context> regexContext();
      70             : 
      71             :   // V8Inspector implementation.
      72             :   std::unique_ptr<V8InspectorSession> connect(int contextGroupId,
      73             :                                               V8Inspector::Channel*,
      74             :                                               const StringView& state) override;
      75             :   void contextCreated(const V8ContextInfo&) override;
      76             :   void contextDestroyed(v8::Local<v8::Context>) override;
      77             :   void resetContextGroup(int contextGroupId) override;
      78             :   void idleStarted() override;
      79             :   void idleFinished() override;
      80             :   unsigned exceptionThrown(v8::Local<v8::Context>, const StringView& message,
      81             :                            v8::Local<v8::Value> exception,
      82             :                            const StringView& detailedMessage,
      83             :                            const StringView& url, unsigned lineNumber,
      84             :                            unsigned columnNumber, std::unique_ptr<V8StackTrace>,
      85             :                            int scriptId) override;
      86             :   void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId,
      87             :                         const StringView& message) override;
      88             :   std::unique_ptr<V8StackTrace> createStackTrace(
      89             :       v8::Local<v8::StackTrace>) override;
      90             :   std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) override;
      91             :   void asyncTaskScheduled(const StringView& taskName, void* task,
      92             :                           bool recurring) override;
      93             :   void asyncTaskCanceled(void* task) override;
      94             :   void asyncTaskStarted(void* task) override;
      95             :   void asyncTaskFinished(void* task) override;
      96             :   void allAsyncTasksCanceled() override;
      97             : 
      98        1716 :   unsigned nextExceptionId() { return ++m_lastExceptionId; }
      99             :   void enableStackCapturingIfNeeded();
     100             :   void disableStackCapturingIfNeeded();
     101             :   void muteExceptions(int contextGroupId);
     102             :   void unmuteExceptions(int contextGroupId);
     103             :   V8ConsoleMessageStorage* ensureConsoleMessageStorage(int contextGroupId);
     104             :   bool hasConsoleMessageStorage(int contextGroupId);
     105             :   using ContextByIdMap =
     106             :       protocol::HashMap<int, std::unique_ptr<InspectedContext>>;
     107             :   void discardInspectedContext(int contextGroupId, int contextId);
     108             :   const ContextByIdMap* contextGroup(int contextGroupId);
     109             :   void disconnect(V8InspectorSessionImpl*);
     110             :   V8InspectorSessionImpl* sessionForContextGroup(int contextGroupId);
     111             :   InspectedContext* getContext(int groupId, int contextId) const;
     112             :   V8DebuggerAgentImpl* enabledDebuggerAgentForGroup(int contextGroupId);
     113             :   V8RuntimeAgentImpl* enabledRuntimeAgentForGroup(int contextGroupId);
     114             :   V8ProfilerAgentImpl* enabledProfilerAgentForGroup(int contextGroupId);
     115             :   V8Console* console();
     116             : 
     117             :  private:
     118             :   v8::Isolate* m_isolate;
     119             :   V8InspectorClient* m_client;
     120             :   std::unique_ptr<V8Debugger> m_debugger;
     121             :   v8::Global<v8::Context> m_regexContext;
     122             :   int m_capturingStackTracesCount;
     123             :   unsigned m_lastExceptionId;
     124             :   int m_lastContextId;
     125             : 
     126             :   using MuteExceptionsMap = protocol::HashMap<int, int>;
     127             :   MuteExceptionsMap m_muteExceptionsMap;
     128             : 
     129             :   using ContextsByGroupMap =
     130             :       protocol::HashMap<int, std::unique_ptr<ContextByIdMap>>;
     131             :   ContextsByGroupMap m_contexts;
     132             : 
     133             :   using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>;
     134             :   SessionMap m_sessions;
     135             : 
     136             :   using ConsoleStorageMap =
     137             :       protocol::HashMap<int, std::unique_ptr<V8ConsoleMessageStorage>>;
     138             :   ConsoleStorageMap m_consoleStorageMap;
     139             : 
     140             :   protocol::HashMap<int, int> m_contextIdToGroupIdMap;
     141             : 
     142             :   std::unique_ptr<V8Console> m_console;
     143             : 
     144             :   DISALLOW_COPY_AND_ASSIGN(V8InspectorImpl);
     145             : };
     146             : 
     147             : }  // namespace v8_inspector
     148             : 
     149             : #endif  // V8_INSPECTOR_V8INSPECTORIMPL_H_

Generated by: LCOV version 1.10