OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium 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 V8ConsoleMessage_h | 5 #ifndef V8ConsoleMessage_h |
6 #define V8ConsoleMessage_h | 6 #define V8ConsoleMessage_h |
7 | 7 |
8 #include "platform/inspector_protocol/Collections.h" | 8 #include "platform/inspector_protocol/Collections.h" |
9 #include "platform/inspector_protocol/String16.h" | 9 #include "platform/inspector_protocol/String16.h" |
10 #include "platform/v8_inspector/protocol/Console.h" | 10 #include "platform/v8_inspector/protocol/Console.h" |
11 #include "platform/v8_inspector/protocol/Runtime.h" | 11 #include "platform/v8_inspector/protocol/Runtime.h" |
12 #include "platform/v8_inspector/public/V8ConsoleTypes.h" | 12 #include "platform/v8_inspector/public/V8ConsoleTypes.h" |
13 #include "platform/v8_inspector/public/V8StackTrace.h" | |
14 #include <deque> | 13 #include <deque> |
15 #include <v8.h> | 14 #include <v8.h> |
16 | 15 |
17 namespace blink { | 16 namespace blink { |
18 | 17 |
19 class InspectedContext; | 18 class InspectedContext; |
20 class V8DebuggerImpl; | 19 class V8DebuggerImpl; |
21 class V8InspectorSessionImpl; | 20 class V8InspectorSessionImpl; |
22 class V8StackTrace; | 21 class V8StackTraceImpl; |
23 | 22 |
24 enum class V8MessageOrigin { kConsole, kException, kRevokedException }; | 23 enum class V8MessageOrigin { kConsole, kException, kRevokedException }; |
25 | 24 |
26 enum class ConsoleAPIType { kLog, kDebug, kInfo, kError, kWarning, kDir, kDirXML
, kTable, kTrace, kStartGroup, kStartGroupCollapsed, kEndGroup, kClear, kAssert,
kTimeEnd, kCount }; | 25 enum class ConsoleAPIType { kLog, kDebug, kInfo, kError, kWarning, kDir, kDirXML
, kTable, kTrace, kStartGroup, kStartGroupCollapsed, kEndGroup, kClear, kAssert,
kTimeEnd, kCount }; |
27 | 26 |
28 class V8ConsoleMessage { | 27 class V8ConsoleMessage { |
29 public: | 28 public: |
30 ~V8ConsoleMessage(); | 29 ~V8ConsoleMessage(); |
31 | 30 |
32 static std::unique_ptr<V8ConsoleMessage> createForConsoleAPI( | 31 static std::unique_ptr<V8ConsoleMessage> createForConsoleAPI( |
33 double timestamp, | 32 double timestamp, |
34 ConsoleAPIType, | 33 ConsoleAPIType, |
35 const std::vector<v8::Local<v8::Value>>& arguments, | 34 const std::vector<v8::Local<v8::Value>>& arguments, |
36 std::unique_ptr<V8StackTrace>, | 35 std::unique_ptr<V8StackTraceImpl>, |
37 InspectedContext*); | 36 InspectedContext*); |
38 | 37 |
39 static std::unique_ptr<V8ConsoleMessage> createForException( | 38 static std::unique_ptr<V8ConsoleMessage> createForException( |
40 double timestamp, | 39 double timestamp, |
41 const String16& message, | 40 const String16& message, |
42 const String16& url, | 41 const String16& url, |
43 unsigned lineNumber, | 42 unsigned lineNumber, |
44 unsigned columnNumber, | 43 unsigned columnNumber, |
45 std::unique_ptr<V8StackTrace>, | 44 std::unique_ptr<V8StackTraceImpl>, |
46 int scriptId, | 45 int scriptId, |
47 v8::Isolate*, | 46 v8::Isolate*, |
48 int contextId, | 47 int contextId, |
49 v8::Local<v8::Value> exception, | 48 v8::Local<v8::Value> exception, |
50 unsigned exceptionId); | 49 unsigned exceptionId); |
51 | 50 |
52 static std::unique_ptr<V8ConsoleMessage> createForRevokedException( | 51 static std::unique_ptr<V8ConsoleMessage> createForRevokedException( |
53 double timestamp, | 52 double timestamp, |
54 const String16& message, | 53 const String16& message, |
55 unsigned revokedExceptionId); | 54 unsigned revokedExceptionId); |
56 | 55 |
57 V8MessageOrigin origin() const; | 56 V8MessageOrigin origin() const; |
58 void reportToFrontend(protocol::Console::Frontend*) const; | 57 void reportToFrontend(protocol::Console::Frontend*) const; |
59 void reportToFrontend(protocol::Runtime::Frontend*, V8InspectorSessionImpl*,
bool generatePreview) const; | 58 void reportToFrontend(protocol::Runtime::Frontend*, V8InspectorSessionImpl*,
bool generatePreview) const; |
60 ConsoleAPIType type() const; | 59 ConsoleAPIType type() const; |
61 void contextDestroyed(int contextId); | 60 void contextDestroyed(int contextId); |
62 | 61 |
63 private: | 62 private: |
64 V8ConsoleMessage(V8MessageOrigin, double timestamp, const String16& message)
; | 63 V8ConsoleMessage(V8MessageOrigin, double timestamp, const String16& message)
; |
65 | 64 |
66 using Arguments = std::vector<std::unique_ptr<v8::Global<v8::Value>>>; | 65 using Arguments = std::vector<std::unique_ptr<v8::Global<v8::Value>>>; |
67 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> wrapArgume
nts(V8InspectorSessionImpl*, bool generatePreview) const; | 66 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> wrapArgume
nts(V8InspectorSessionImpl*, bool generatePreview) const; |
68 std::unique_ptr<protocol::Runtime::RemoteObject> wrapException(V8InspectorSe
ssionImpl*, bool generatePreview) const; | 67 std::unique_ptr<protocol::Runtime::RemoteObject> wrapException(V8InspectorSe
ssionImpl*, bool generatePreview) const; |
69 void setLocation(const String16& url, unsigned lineNumber, unsigned columnNu
mber, std::unique_ptr<V8StackTrace>, int scriptId); | 68 void setLocation(const String16& url, unsigned lineNumber, unsigned columnNu
mber, std::unique_ptr<V8StackTraceImpl>, int scriptId); |
70 | 69 |
71 V8MessageOrigin m_origin; | 70 V8MessageOrigin m_origin; |
72 double m_timestamp; | 71 double m_timestamp; |
73 String16 m_message; | 72 String16 m_message; |
74 String16 m_url; | 73 String16 m_url; |
75 unsigned m_lineNumber; | 74 unsigned m_lineNumber; |
76 unsigned m_columnNumber; | 75 unsigned m_columnNumber; |
77 std::unique_ptr<V8StackTrace> m_stackTrace; | 76 std::unique_ptr<V8StackTraceImpl> m_stackTrace; |
78 int m_scriptId; | 77 int m_scriptId; |
79 int m_contextId; | 78 int m_contextId; |
80 ConsoleAPIType m_type; | 79 ConsoleAPIType m_type; |
81 unsigned m_exceptionId; | 80 unsigned m_exceptionId; |
82 unsigned m_revokedExceptionId; | 81 unsigned m_revokedExceptionId; |
83 Arguments m_arguments; | 82 Arguments m_arguments; |
84 }; | 83 }; |
85 | 84 |
86 class V8ConsoleMessageStorage { | 85 class V8ConsoleMessageStorage { |
87 public: | 86 public: |
(...skipping 13 matching lines...) Expand all Loading... |
101 | 100 |
102 V8DebuggerImpl* m_debugger; | 101 V8DebuggerImpl* m_debugger; |
103 int m_contextGroupId; | 102 int m_contextGroupId; |
104 int m_expiredCount; | 103 int m_expiredCount; |
105 std::deque<std::unique_ptr<V8ConsoleMessage>> m_messages; | 104 std::deque<std::unique_ptr<V8ConsoleMessage>> m_messages; |
106 }; | 105 }; |
107 | 106 |
108 } // namespace blink | 107 } // namespace blink |
109 | 108 |
110 #endif // V8ConsoleMessage_h | 109 #endif // V8ConsoleMessage_h |
OLD | NEW |