Index: test/inspector/inspector-impl.h |
diff --git a/test/inspector/inspector-impl.h b/test/inspector/inspector-impl.h |
index 92e83747f515934e47db7a99769178c76fb40dcb..edbec72cfbfc530e17abb1081d18972ccb038dee 100644 |
--- a/test/inspector/inspector-impl.h |
+++ b/test/inspector/inspector-impl.h |
@@ -5,11 +5,15 @@ |
#ifndef V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ |
#define V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ |
+#include <map> |
+#include <vector> |
+ |
#include "include/v8-inspector.h" |
#include "include/v8.h" |
#include "src/base/macros.h" |
#include "src/base/platform/platform.h" |
-#include "test/inspector/task-runner.h" |
+ |
+class TaskRunner; |
class InspectorClientImpl : public v8_inspector::V8InspectorClient { |
public: |
@@ -17,31 +21,30 @@ class InspectorClientImpl : public v8_inspector::V8InspectorClient { |
public: |
virtual ~FrontendChannel() = default; |
virtual void SendMessageToFrontend( |
- const v8_inspector::StringView& message) = 0; |
+ int session_id, const v8_inspector::StringView& message) = 0; |
}; |
- InspectorClientImpl(TaskRunner* task_runner, |
- FrontendChannel* frontend_channel, |
- v8::base::Semaphore* ready_semaphore); |
+ InspectorClientImpl(v8::Isolate* isolate, TaskRunner* task_runner, |
+ FrontendChannel* frontend_channel); |
virtual ~InspectorClientImpl(); |
- void scheduleReconnect(v8::base::Semaphore* ready_semaphore); |
- void scheduleDisconnect(v8::base::Semaphore* ready_semaphore); |
- void scheduleCreateContextGroup( |
- IsolateData::SetupGlobalTasks setup_global_tasks, |
- v8::base::Semaphore* ready_semaphore, int* context_group_id); |
- |
- static v8_inspector::V8Inspector* InspectorFromContext( |
- v8::Local<v8::Context> context); |
- static v8_inspector::V8InspectorSession* SessionFromContext( |
- v8::Local<v8::Context> context); |
- |
- // context_group_id = 0 means default context group. |
- v8_inspector::V8InspectorSession* session(int context_group_id = 0); |
- |
- void setCurrentTimeMSForTest(double time); |
- void setMemoryInfoForTest(v8::Local<v8::Value> memory_info); |
- void setLogConsoleApiMessageCalls(bool log); |
+ v8_inspector::V8Inspector* inspector() const { return inspector_.get(); } |
+ int ConnectSession(int context_group_id, |
+ const v8_inspector::StringView& state); |
+ std::unique_ptr<v8_inspector::StringBuffer> DisconnectSession(int session_id); |
+ void SendMessage(int session_id, const v8_inspector::StringView& message); |
+ void BreakProgram(int context_group_id, |
+ const v8_inspector::StringView& reason, |
+ const v8_inspector::StringView& details); |
+ void SchedulePauseOnNextStatement(int context_group_id, |
+ const v8_inspector::StringView& reason, |
+ const v8_inspector::StringView& details); |
+ void CancelPauseOnNextStatement(int context_group_id); |
+ void SetCurrentTimeMSForTest(double time); |
+ void SetMemoryInfoForTest(v8::Local<v8::Value> memory_info); |
+ void SetLogConsoleApiMessageCalls(bool log); |
+ void ContextCreated(v8::Local<v8::Context> context, int context_group_id); |
+ void ContextDestroyed(v8::Local<v8::Context> context); |
private: |
// V8InspectorClient implementation. |
@@ -59,30 +62,18 @@ class InspectorClientImpl : public v8_inspector::V8InspectorClient { |
const v8_inspector::StringView& url, |
unsigned lineNumber, unsigned columnNumber, |
v8_inspector::V8StackTrace*) override; |
- friend class SendMessageToBackendTask; |
- friend class ConnectTask; |
- void connect(); |
- void ConnectToContextGroup(int context_group_id, |
- v8_inspector::StringView state); |
- friend class DisconnectTask; |
- void disconnect(bool reset_inspector); |
- friend class CreateContextGroupTask; |
- int createContextGroup( |
- const IsolateData::SetupGlobalTasks& setup_global_tasks); |
+ std::vector<int> GetSessionIds(int context_group_id); |
std::unique_ptr<v8_inspector::V8Inspector> inspector_; |
- std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; |
- |
+ int last_session_id_ = 0; |
std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_; |
- std::map<int, std::unique_ptr<v8_inspector::StringBuffer>> states_; |
- |
+ std::map<v8_inspector::V8InspectorSession*, int> context_group_by_session_; |
+ std::map<int, std::unique_ptr<v8_inspector::V8Inspector::Channel>> channels_; |
+ TaskRunner* task_runner_; |
v8::Isolate* isolate_; |
v8::Global<v8::Value> memory_info_; |
- |
- TaskRunner* task_runner_; |
FrontendChannel* frontend_channel_; |
- |
bool current_time_set_for_test_ = false; |
double current_time_ = 0.0; |
bool log_console_api_message_calls_ = false; |
@@ -90,19 +81,4 @@ class InspectorClientImpl : public v8_inspector::V8InspectorClient { |
DISALLOW_COPY_AND_ASSIGN(InspectorClientImpl); |
}; |
-class SendMessageToBackendExtension : public IsolateData::SetupGlobalTask { |
- public: |
- void Run(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> global) override; |
- |
- static void set_backend_task_runner(TaskRunner* task_runner) { |
- backend_task_runner_ = task_runner; |
- } |
- |
- private: |
- static void SendMessageToBackend( |
- const v8::FunctionCallbackInfo<v8::Value>& args); |
- |
- static TaskRunner* backend_task_runner_; |
-}; |
- |
#endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ |