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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 static v8_inspector::V8Inspector* InspectorFromContext( | 33 static v8_inspector::V8Inspector* InspectorFromContext( |
34 v8::Local<v8::Context> context); | 34 v8::Local<v8::Context> context); |
35 static v8_inspector::V8InspectorSession* SessionFromContext( | 35 static v8_inspector::V8InspectorSession* SessionFromContext( |
36 v8::Local<v8::Context> context); | 36 v8::Local<v8::Context> context); |
37 | 37 |
38 // context_group_id = 0 means default context group. | 38 // context_group_id = 0 means default context group. |
39 v8_inspector::V8InspectorSession* session(int context_group_id = 0); | 39 v8_inspector::V8InspectorSession* session(int context_group_id = 0); |
40 | 40 |
41 void setCurrentTimeMSForTest(double time); | 41 void setCurrentTimeMSForTest(double time); |
42 void setMemoryInfoForTest(v8::Local<v8::Value> memory_info); | |
43 | 42 |
44 private: | 43 private: |
45 // V8InspectorClient implementation. | 44 // V8InspectorClient implementation. |
46 bool formatAccessorsAsProperties(v8::Local<v8::Value>) override; | 45 bool formatAccessorsAsProperties(v8::Local<v8::Value>) override; |
47 v8::Local<v8::Context> ensureDefaultContextInGroup( | 46 v8::Local<v8::Context> ensureDefaultContextInGroup( |
48 int context_group_id) override; | 47 int context_group_id) override; |
49 double currentTimeMS() override; | 48 double currentTimeMS() override; |
50 v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate* isolate, | |
51 v8::Local<v8::Context>) override; | |
52 void runMessageLoopOnPause(int context_group_id) override; | 49 void runMessageLoopOnPause(int context_group_id) override; |
53 void quitMessageLoopOnPause() override; | 50 void quitMessageLoopOnPause() override; |
54 | 51 |
55 friend class SendMessageToBackendTask; | 52 friend class SendMessageToBackendTask; |
56 | 53 |
57 friend class ConnectTask; | 54 friend class ConnectTask; |
58 void connect(v8::Local<v8::Context> context); | 55 void connect(v8::Local<v8::Context> context); |
59 friend class DisconnectTask; | 56 friend class DisconnectTask; |
60 void disconnect(); | 57 void disconnect(); |
61 friend class CreateContextGroupTask; | 58 friend class CreateContextGroupTask; |
62 int createContextGroup(v8::ExtensionConfiguration* extensions); | 59 int createContextGroup(v8::ExtensionConfiguration* extensions); |
63 | 60 |
64 std::unique_ptr<v8_inspector::V8Inspector> inspector_; | 61 std::unique_ptr<v8_inspector::V8Inspector> inspector_; |
65 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; | 62 std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; |
66 | 63 |
67 std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_; | 64 std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_; |
68 std::map<int, std::unique_ptr<v8_inspector::StringBuffer>> states_; | 65 std::map<int, std::unique_ptr<v8_inspector::StringBuffer>> states_; |
69 | 66 |
70 v8::Isolate* isolate_; | 67 v8::Isolate* isolate_; |
71 v8::Global<v8::Value> memory_info_; | |
72 | 68 |
73 TaskRunner* task_runner_; | 69 TaskRunner* task_runner_; |
74 FrontendChannel* frontend_channel_; | 70 FrontendChannel* frontend_channel_; |
75 | 71 |
76 bool current_time_set_for_test_ = false; | 72 bool current_time_set_for_test_ = false; |
77 double current_time_ = 0.0; | 73 double current_time_ = 0.0; |
78 | 74 |
79 DISALLOW_COPY_AND_ASSIGN(InspectorClientImpl); | 75 DISALLOW_COPY_AND_ASSIGN(InspectorClientImpl); |
80 }; | 76 }; |
81 | 77 |
(...skipping 10 matching lines...) Expand all Loading... |
92 } | 88 } |
93 | 89 |
94 private: | 90 private: |
95 static void SendMessageToBackend( | 91 static void SendMessageToBackend( |
96 const v8::FunctionCallbackInfo<v8::Value>& args); | 92 const v8::FunctionCallbackInfo<v8::Value>& args); |
97 | 93 |
98 static TaskRunner* backend_task_runner_; | 94 static TaskRunner* backend_task_runner_; |
99 }; | 95 }; |
100 | 96 |
101 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ | 97 #endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ |
OLD | NEW |