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