| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 scheduleDisconnect(v8::base::Semaphore* ready_semaphore); |
| 30 void scheduleCreateContextGroup( | 30 void scheduleCreateContextGroup( |
| 31 TaskRunner::SetupGlobalTasks setup_global_tasks, | 31 IsolateData::SetupGlobalTasks setup_global_tasks, |
| 32 v8::base::Semaphore* ready_semaphore, int* context_group_id); | 32 v8::base::Semaphore* ready_semaphore, int* context_group_id); |
| 33 | 33 |
| 34 static v8_inspector::V8Inspector* InspectorFromContext( | 34 static v8_inspector::V8Inspector* InspectorFromContext( |
| 35 v8::Local<v8::Context> context); | 35 v8::Local<v8::Context> context); |
| 36 static v8_inspector::V8InspectorSession* SessionFromContext( | 36 static v8_inspector::V8InspectorSession* SessionFromContext( |
| 37 v8::Local<v8::Context> context); | 37 v8::Local<v8::Context> context); |
| 38 | 38 |
| 39 // context_group_id = 0 means default context group. | 39 // context_group_id = 0 means default context group. |
| 40 v8_inspector::V8InspectorSession* session(int context_group_id = 0); | 40 v8_inspector::V8InspectorSession* session(int context_group_id = 0); |
| 41 | 41 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 55 void quitMessageLoopOnPause() override; | 55 void quitMessageLoopOnPause() override; |
| 56 void consoleAPIMessage(int contextGroupId, | 56 void consoleAPIMessage(int contextGroupId, |
| 57 v8::Isolate::MessageErrorLevel level, | 57 v8::Isolate::MessageErrorLevel level, |
| 58 const v8_inspector::StringView& message, | 58 const v8_inspector::StringView& message, |
| 59 const v8_inspector::StringView& url, | 59 const v8_inspector::StringView& url, |
| 60 unsigned lineNumber, unsigned columnNumber, | 60 unsigned lineNumber, unsigned columnNumber, |
| 61 v8_inspector::V8StackTrace*) override; | 61 v8_inspector::V8StackTrace*) override; |
| 62 friend class SendMessageToBackendTask; | 62 friend class SendMessageToBackendTask; |
| 63 | 63 |
| 64 friend class ConnectTask; | 64 friend class ConnectTask; |
| 65 void connect(v8::Local<v8::Context> context); | 65 void connect(); |
| 66 void ConnectToContextGroup(int context_group_id, |
| 67 v8_inspector::StringView state); |
| 66 friend class DisconnectTask; | 68 friend class DisconnectTask; |
| 67 void disconnect(bool reset_inspector); | 69 void disconnect(bool reset_inspector); |
| 68 friend class CreateContextGroupTask; | 70 friend class CreateContextGroupTask; |
| 69 int createContextGroup( | 71 int createContextGroup( |
| 70 const TaskRunner::SetupGlobalTasks& setup_global_tasks); | 72 const IsolateData::SetupGlobalTasks& setup_global_tasks); |
| 71 | 73 |
| 72 std::unique_ptr<v8_inspector::V8Inspector> inspector_; | 74 std::unique_ptr<v8_inspector::V8Inspector> inspector_; |
| 73 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; | 75 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; |
| 74 | 76 |
| 75 std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_; | 77 std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_; |
| 76 std::map<int, std::unique_ptr<v8_inspector::StringBuffer>> states_; | 78 std::map<int, std::unique_ptr<v8_inspector::StringBuffer>> states_; |
| 77 | 79 |
| 78 v8::Isolate* isolate_; | 80 v8::Isolate* isolate_; |
| 79 v8::Global<v8::Value> memory_info_; | 81 v8::Global<v8::Value> memory_info_; |
| 80 | 82 |
| 81 TaskRunner* task_runner_; | 83 TaskRunner* task_runner_; |
| 82 FrontendChannel* frontend_channel_; | 84 FrontendChannel* frontend_channel_; |
| 83 | 85 |
| 84 bool current_time_set_for_test_ = false; | 86 bool current_time_set_for_test_ = false; |
| 85 double current_time_ = 0.0; | 87 double current_time_ = 0.0; |
| 86 bool log_console_api_message_calls_ = false; | 88 bool log_console_api_message_calls_ = false; |
| 87 | 89 |
| 88 DISALLOW_COPY_AND_ASSIGN(InspectorClientImpl); | 90 DISALLOW_COPY_AND_ASSIGN(InspectorClientImpl); |
| 89 }; | 91 }; |
| 90 | 92 |
| 91 class SendMessageToBackendExtension : public TaskRunner::SetupGlobalTask { | 93 class SendMessageToBackendExtension : public IsolateData::SetupGlobalTask { |
| 92 public: | 94 public: |
| 93 void Run(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> global) override; | 95 void Run(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> global) override; |
| 94 | 96 |
| 95 static void set_backend_task_runner(TaskRunner* task_runner) { | 97 static void set_backend_task_runner(TaskRunner* task_runner) { |
| 96 backend_task_runner_ = task_runner; | 98 backend_task_runner_ = task_runner; |
| 97 } | 99 } |
| 98 | 100 |
| 99 private: | 101 private: |
| 100 static void SendMessageToBackend( | 102 static void SendMessageToBackend( |
| 101 const v8::FunctionCallbackInfo<v8::Value>& args); | 103 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 102 | 104 |
| 103 static TaskRunner* backend_task_runner_; | 105 static TaskRunner* backend_task_runner_; |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ | 108 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ |
| OLD | NEW |