OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_CLIENT_IMPL_H_ |
| 6 #define V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_CLIENT_IMPL_H_ |
| 7 |
| 8 #include "include/v8-inspector.h" |
| 9 #include "include/v8.h" |
| 10 #include "src/base/macros.h" |
| 11 #include "test/inspector-protocol/task.h" |
| 12 |
| 13 namespace v8 { |
| 14 namespace base { |
| 15 class Semaphore; |
| 16 } // base |
| 17 } // v8 |
| 18 |
| 19 namespace v8_inspector { |
| 20 |
| 21 class ChannelImpl; |
| 22 |
| 23 class V8InspectorClientImpl : public V8InspectorClient { |
| 24 public: |
| 25 V8InspectorClientImpl(); |
| 26 virtual ~V8InspectorClientImpl(); |
| 27 |
| 28 void connect(ChannelImpl* channel, v8::Local<v8::Context>); |
| 29 |
| 30 // V8InspectorClient implementation. |
| 31 v8::Local<v8::Context> ensureDefaultContextInGroup(int) override; |
| 32 double currentTimeMS() override; |
| 33 void runMessageLoopOnPause(int) override; |
| 34 void quitMessageLoopOnPause() override; |
| 35 |
| 36 static V8Inspector* InspectorFromContext(v8::Local<v8::Context> context); |
| 37 static V8InspectorSession* SessionFromContext(v8::Local<v8::Context> context); |
| 38 |
| 39 private: |
| 40 std::unique_ptr<V8Inspector> inspector_; |
| 41 std::unique_ptr<V8InspectorSession> session_; |
| 42 v8::Isolate* isolate_; |
| 43 v8::Global<v8::Context> context_; |
| 44 bool running_message_loop_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(V8InspectorClientImpl); |
| 47 }; |
| 48 |
| 49 class ConnectTask : public Task { |
| 50 public: |
| 51 ConnectTask(V8InspectorClientImpl* client, ChannelImpl* channel, |
| 52 v8::base::Semaphore* ready); |
| 53 virtual ~ConnectTask() {} |
| 54 |
| 55 bool is_protocol_task() { return true; } |
| 56 |
| 57 void Run(v8::Isolate* isolate, const v8::Global<v8::Context>& context); |
| 58 |
| 59 private: |
| 60 V8InspectorClientImpl* client_; |
| 61 ChannelImpl* channel_; |
| 62 v8::base::Semaphore* ready_; |
| 63 }; |
| 64 |
| 65 } // namespace v8_inspector |
| 66 |
| 67 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_CLIENT_IMPL_H_ |
OLD | NEW |