| 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 static v8_inspector::V8Inspector* InspectorFromContext( | 28 static v8_inspector::V8Inspector* InspectorFromContext( |
| 29 v8::Local<v8::Context> context); | 29 v8::Local<v8::Context> context); |
| 30 static v8_inspector::V8InspectorSession* SessionFromContext( |
| 31 v8::Local<v8::Context> context); |
| 30 | 32 |
| 31 void setCurrentTimeMSForTest(double time); | 33 void setCurrentTimeMSForTest(double time); |
| 32 | 34 |
| 35 v8_inspector::V8InspectorSession* session() const { return session_.get(); } |
| 36 |
| 33 private: | 37 private: |
| 34 // V8InspectorClient implementation. | 38 // V8InspectorClient implementation. |
| 35 v8::Local<v8::Context> ensureDefaultContextInGroup( | 39 v8::Local<v8::Context> ensureDefaultContextInGroup( |
| 36 int context_group_id) override; | 40 int context_group_id) override; |
| 37 double currentTimeMS() override; | 41 double currentTimeMS() override; |
| 38 void runMessageLoopOnPause(int context_group_id) override; | 42 void runMessageLoopOnPause(int context_group_id) override; |
| 39 void quitMessageLoopOnPause() override; | 43 void quitMessageLoopOnPause() override; |
| 40 | 44 |
| 41 static v8_inspector::V8InspectorSession* SessionFromContext( | |
| 42 v8::Local<v8::Context> context); | |
| 43 | |
| 44 friend class SendMessageToBackendTask; | 45 friend class SendMessageToBackendTask; |
| 45 | 46 |
| 46 friend class ConnectTask; | 47 friend class ConnectTask; |
| 47 void connect(v8::Local<v8::Context> context); | 48 void connect(v8::Local<v8::Context> context); |
| 48 | 49 |
| 49 std::unique_ptr<v8_inspector::V8Inspector> inspector_; | 50 std::unique_ptr<v8_inspector::V8Inspector> inspector_; |
| 50 std::unique_ptr<v8_inspector::V8InspectorSession> session_; | 51 std::unique_ptr<v8_inspector::V8InspectorSession> session_; |
| 51 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; | 52 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; |
| 52 | 53 |
| 53 v8::Isolate* isolate_; | 54 v8::Isolate* isolate_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 75 } | 76 } |
| 76 | 77 |
| 77 private: | 78 private: |
| 78 static void SendMessageToBackend( | 79 static void SendMessageToBackend( |
| 79 const v8::FunctionCallbackInfo<v8::Value>& args); | 80 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 80 | 81 |
| 81 static TaskRunner* backend_task_runner_; | 82 static TaskRunner* backend_task_runner_; |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ | 85 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ |
| OLD | NEW |