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_INSPECTOR_V8CONSOLEMESSAGE_H_ | 5 #ifndef V8_INSPECTOR_V8CONSOLEMESSAGE_H_ |
6 #define V8_INSPECTOR_V8CONSOLEMESSAGE_H_ | 6 #define V8_INSPECTOR_V8CONSOLEMESSAGE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | |
10 #include <set> | |
11 #include "include/v8.h" | 9 #include "include/v8.h" |
12 #include "src/inspector/protocol/Console.h" | 10 #include "src/inspector/protocol/Console.h" |
13 #include "src/inspector/protocol/Forward.h" | 11 #include "src/inspector/protocol/Forward.h" |
14 #include "src/inspector/protocol/Runtime.h" | 12 #include "src/inspector/protocol/Runtime.h" |
15 | 13 |
16 namespace v8_inspector { | 14 namespace v8_inspector { |
17 | 15 |
18 class InspectedContext; | 16 class InspectedContext; |
19 class V8InspectorImpl; | 17 class V8InspectorImpl; |
20 class V8InspectorSessionImpl; | 18 class V8InspectorSessionImpl; |
(...skipping 18 matching lines...) Expand all Loading... |
39 kAssert, | 37 kAssert, |
40 kTimeEnd, | 38 kTimeEnd, |
41 kCount | 39 kCount |
42 }; | 40 }; |
43 | 41 |
44 class V8ConsoleMessage { | 42 class V8ConsoleMessage { |
45 public: | 43 public: |
46 ~V8ConsoleMessage(); | 44 ~V8ConsoleMessage(); |
47 | 45 |
48 static std::unique_ptr<V8ConsoleMessage> createForConsoleAPI( | 46 static std::unique_ptr<V8ConsoleMessage> createForConsoleAPI( |
49 v8::Local<v8::Context> v8Context, int contextId, int groupId, | 47 double timestamp, ConsoleAPIType, |
50 V8InspectorImpl* inspector, double timestamp, ConsoleAPIType, | |
51 const std::vector<v8::Local<v8::Value>>& arguments, | 48 const std::vector<v8::Local<v8::Value>>& arguments, |
52 std::unique_ptr<V8StackTraceImpl>); | 49 std::unique_ptr<V8StackTraceImpl>, InspectedContext*); |
53 | 50 |
54 static std::unique_ptr<V8ConsoleMessage> createForException( | 51 static std::unique_ptr<V8ConsoleMessage> createForException( |
55 double timestamp, const String16& detailedMessage, const String16& url, | 52 double timestamp, const String16& detailedMessage, const String16& url, |
56 unsigned lineNumber, unsigned columnNumber, | 53 unsigned lineNumber, unsigned columnNumber, |
57 std::unique_ptr<V8StackTraceImpl>, int scriptId, v8::Isolate*, | 54 std::unique_ptr<V8StackTraceImpl>, int scriptId, v8::Isolate*, |
58 const String16& message, int contextId, v8::Local<v8::Value> exception, | 55 const String16& message, int contextId, v8::Local<v8::Value> exception, |
59 unsigned exceptionId); | 56 unsigned exceptionId); |
60 | 57 |
61 static std::unique_ptr<V8ConsoleMessage> createForRevokedException( | 58 static std::unique_ptr<V8ConsoleMessage> createForRevokedException( |
62 double timestamp, const String16& message, unsigned revokedExceptionId); | 59 double timestamp, const String16& message, unsigned revokedExceptionId); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 105 |
109 int contextGroupId() { return m_contextGroupId; } | 106 int contextGroupId() { return m_contextGroupId; } |
110 const std::deque<std::unique_ptr<V8ConsoleMessage>>& messages() const { | 107 const std::deque<std::unique_ptr<V8ConsoleMessage>>& messages() const { |
111 return m_messages; | 108 return m_messages; |
112 } | 109 } |
113 | 110 |
114 void addMessage(std::unique_ptr<V8ConsoleMessage>); | 111 void addMessage(std::unique_ptr<V8ConsoleMessage>); |
115 void contextDestroyed(int contextId); | 112 void contextDestroyed(int contextId); |
116 void clear(); | 113 void clear(); |
117 | 114 |
118 bool shouldReportDeprecationMessage(int contextId, const String16& method); | |
119 int count(int contextId, const String16& id); | |
120 void time(int contextId, const String16& id); | |
121 double timeEnd(int contextId, const String16& id); | |
122 | |
123 private: | 115 private: |
124 V8InspectorImpl* m_inspector; | 116 V8InspectorImpl* m_inspector; |
125 int m_contextGroupId; | 117 int m_contextGroupId; |
126 int m_estimatedSize = 0; | 118 int m_estimatedSize = 0; |
127 std::deque<std::unique_ptr<V8ConsoleMessage>> m_messages; | 119 std::deque<std::unique_ptr<V8ConsoleMessage>> m_messages; |
128 | |
129 struct PerContextData { | |
130 std::set<String16> m_reportedDeprecationMessages; | |
131 std::map<String16, int> m_count; | |
132 std::map<String16, double> m_time; | |
133 }; | |
134 std::map<int, PerContextData> m_data; | |
135 }; | 120 }; |
136 | 121 |
137 } // namespace v8_inspector | 122 } // namespace v8_inspector |
138 | 123 |
139 #endif // V8_INSPECTOR_V8CONSOLEMESSAGE_H_ | 124 #endif // V8_INSPECTOR_V8CONSOLEMESSAGE_H_ |
OLD | NEW |