| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ | 5 #ifndef V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ |
| 6 #define V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ | 6 #define V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "include/v8-inspector.h" | 8 #include "include/v8-inspector.h" |
| 9 #include "include/v8.h" | 9 #include "include/v8.h" |
| 10 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
| 11 #include "src/base/platform/platform.h" | 11 #include "src/base/platform/platform.h" |
| 12 #include "test/inspector/task-runner.h" | 12 #include "test/inspector/task-runner.h" |
| 13 | 13 |
| 14 class InspectorClientImpl : public v8_inspector::V8InspectorClient { | 14 class InspectorClientImpl : public v8_inspector::V8InspectorClient { |
| 15 public: | 15 public: |
| 16 class FrontendChannel { | 16 class FrontendChannel { |
| 17 public: | 17 public: |
| 18 virtual ~FrontendChannel() = default; | 18 virtual ~FrontendChannel() = default; |
| 19 virtual void SendMessageToFrontend( | 19 virtual void SendMessageToFrontend( |
| 20 const v8_inspector::StringView& message) = 0; | 20 const v8_inspector::StringView& message) = 0; |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 InspectorClientImpl(TaskRunner* task_runner, | 23 InspectorClientImpl(TaskRunner* task_runner, |
| 24 FrontendChannel* frontend_channel, | 24 FrontendChannel* frontend_channel, |
| 25 v8::base::Semaphore* ready_semaphore); | 25 v8::base::Semaphore* ready_semaphore); |
| 26 virtual ~InspectorClientImpl(); | 26 virtual ~InspectorClientImpl(); |
| 27 | 27 |
| 28 void scheduleReconnect(v8::base::Semaphore* ready_semaphore); | 28 void scheduleReconnect(v8::base::Semaphore* ready_semaphore); |
| 29 void scheduleDisconnect(v8::base::Semaphore* ready_semaphore); |
| 29 void scheduleCreateContextGroup( | 30 void scheduleCreateContextGroup( |
| 30 TaskRunner::SetupGlobalTasks setup_global_tasks, | 31 TaskRunner::SetupGlobalTasks setup_global_tasks, |
| 31 v8::base::Semaphore* ready_semaphore, int* context_group_id); | 32 v8::base::Semaphore* ready_semaphore, int* context_group_id); |
| 32 | 33 |
| 33 static v8_inspector::V8Inspector* InspectorFromContext( | 34 static v8_inspector::V8Inspector* InspectorFromContext( |
| 34 v8::Local<v8::Context> context); | 35 v8::Local<v8::Context> context); |
| 35 static v8_inspector::V8InspectorSession* SessionFromContext( | 36 static v8_inspector::V8InspectorSession* SessionFromContext( |
| 36 v8::Local<v8::Context> context); | 37 v8::Local<v8::Context> context); |
| 37 | 38 |
| 38 // context_group_id = 0 means default context group. | 39 // context_group_id = 0 means default context group. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 56 v8::Isolate::MessageErrorLevel level, | 57 v8::Isolate::MessageErrorLevel level, |
| 57 const v8_inspector::StringView& message, | 58 const v8_inspector::StringView& message, |
| 58 const v8_inspector::StringView& url, | 59 const v8_inspector::StringView& url, |
| 59 unsigned lineNumber, unsigned columnNumber, | 60 unsigned lineNumber, unsigned columnNumber, |
| 60 v8_inspector::V8StackTrace*) override; | 61 v8_inspector::V8StackTrace*) override; |
| 61 friend class SendMessageToBackendTask; | 62 friend class SendMessageToBackendTask; |
| 62 | 63 |
| 63 friend class ConnectTask; | 64 friend class ConnectTask; |
| 64 void connect(v8::Local<v8::Context> context); | 65 void connect(v8::Local<v8::Context> context); |
| 65 friend class DisconnectTask; | 66 friend class DisconnectTask; |
| 66 void disconnect(); | 67 void disconnect(bool reset_inspector); |
| 67 friend class CreateContextGroupTask; | 68 friend class CreateContextGroupTask; |
| 68 int createContextGroup( | 69 int createContextGroup( |
| 69 const TaskRunner::SetupGlobalTasks& setup_global_tasks); | 70 const TaskRunner::SetupGlobalTasks& setup_global_tasks); |
| 70 | 71 |
| 71 std::unique_ptr<v8_inspector::V8Inspector> inspector_; | 72 std::unique_ptr<v8_inspector::V8Inspector> inspector_; |
| 72 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; | 73 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; |
| 73 | 74 |
| 74 std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_; | 75 std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_; |
| 75 std::map<int, std::unique_ptr<v8_inspector::StringBuffer>> states_; | 76 std::map<int, std::unique_ptr<v8_inspector::StringBuffer>> states_; |
| 76 | 77 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 96 } | 97 } |
| 97 | 98 |
| 98 private: | 99 private: |
| 99 static void SendMessageToBackend( | 100 static void SendMessageToBackend( |
| 100 const v8::FunctionCallbackInfo<v8::Value>& args); | 101 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 101 | 102 |
| 102 static TaskRunner* backend_task_runner_; | 103 static TaskRunner* backend_task_runner_; |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ | 106 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ |
| OLD | NEW |