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