Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.h

Issue 2141673002: [DevTools] Always send a copy of worker message through the page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 13 #include "platform/v8_inspector/public/V8StackTrace.h"
14 #include <deque> 14 #include <deque>
15 #include <v8.h> 15 #include <v8.h>
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class InspectedContext; 19 class InspectedContext;
20 class V8DebuggerImpl; 20 class V8DebuggerImpl;
21 class V8InspectorSessionImpl; 21 class V8InspectorSessionImpl;
22 class V8StackTrace; 22 class V8StackTrace;
23 23
24 enum class V8MessageOrigin { kConsole, kException, kRevokedException }; 24 enum class V8MessageOrigin { kConsole, kException, kRevokedException };
25 25
26 class V8ConsoleMessage { 26 class V8ConsoleMessage {
27 public: 27 public:
28 V8ConsoleMessage(
29 double timestamp,
30 MessageSource,
31 MessageLevel,
32 const String16& message,
33 const String16& url,
34 unsigned lineNumber,
35 unsigned columnNumber,
36 std::unique_ptr<V8StackTrace>,
37 int scriptId,
38 const String16& requestIdentifier);
39 ~V8ConsoleMessage(); 28 ~V8ConsoleMessage();
40 29
41 static std::unique_ptr<V8ConsoleMessage> createForConsoleAPI( 30 static std::unique_ptr<V8ConsoleMessage> createForConsoleAPI(
42 double timestamp, 31 double timestamp,
43 MessageType, 32 MessageType,
44 MessageLevel, 33 MessageLevel,
45 const String16& message, 34 const String16& message,
46 std::vector<v8::Local<v8::Value>>* arguments, 35 std::vector<v8::Local<v8::Value>>* arguments,
47 std::unique_ptr<V8StackTrace>, 36 std::unique_ptr<V8StackTrace>,
48 InspectedContext*); 37 InspectedContext*);
49 38
50 static std::unique_ptr<V8ConsoleMessage> createForException( 39 static std::unique_ptr<V8ConsoleMessage> createForException(
51 double timestamp, 40 double timestamp,
52 const String16& message, 41 const String16& message,
53 const String16& url, 42 const String16& url,
54 unsigned lineNumber, 43 unsigned lineNumber,
55 unsigned columnNumber, 44 unsigned columnNumber,
56 std::unique_ptr<V8StackTrace>, 45 std::unique_ptr<V8StackTrace>,
57 int scriptId, 46 int scriptId,
58 v8::Isolate*, 47 v8::Isolate*,
59 int contextId, 48 int contextId,
60 v8::Local<v8::Value> exception, 49 v8::Local<v8::Value> exception,
61 unsigned exceptionId); 50 unsigned exceptionId);
62 51
63 static std::unique_ptr<V8ConsoleMessage> createForRevokedException( 52 static std::unique_ptr<V8ConsoleMessage> createForRevokedException(
64 double timestamp, 53 double timestamp,
65 const String16& message, 54 const String16& message,
66 unsigned revokedExceptionId); 55 unsigned revokedExceptionId);
67 56
57 static std::unique_ptr<V8ConsoleMessage> createExternal(
58 double timestamp,
59 MessageSource,
60 MessageLevel,
61 const String16& message,
62 const String16& url,
63 unsigned lineNumber,
64 unsigned columnNumber,
65 std::unique_ptr<V8StackTrace>,
66 int scriptId,
67 const String16& requestIdentifier,
68 const String16& workerId);
69
68 V8MessageOrigin origin() const; 70 V8MessageOrigin origin() const;
69 void reportToFrontend(protocol::Console::Frontend*, V8InspectorSessionImpl*, bool generatePreview) const; 71 void reportToFrontend(protocol::Console::Frontend*, V8InspectorSessionImpl*, bool generatePreview) const;
70 void reportToFrontend(protocol::Runtime::Frontend*, V8InspectorSessionImpl*, bool generatePreview) const; 72 void reportToFrontend(protocol::Runtime::Frontend*, V8InspectorSessionImpl*, bool generatePreview) const;
71 unsigned argumentCount() const; 73 unsigned argumentCount() const;
72 MessageType type() const; 74 MessageType type() const;
73 void contextDestroyed(int contextId); 75 void contextDestroyed(int contextId);
74 76
75 private: 77 private:
78 V8ConsoleMessage(V8MessageOrigin, double timestamp, MessageSource, MessageLe vel, const String16& message);
79
76 using Arguments = std::vector<std::unique_ptr<v8::Global<v8::Value>>>; 80 using Arguments = std::vector<std::unique_ptr<v8::Global<v8::Value>>>;
77 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> wrapArgume nts(V8InspectorSessionImpl*, bool generatePreview) const; 81 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> wrapArgume nts(V8InspectorSessionImpl*, bool generatePreview) const;
78 std::unique_ptr<protocol::Runtime::RemoteObject> wrapException(V8InspectorSe ssionImpl*, bool generatePreview) const; 82 std::unique_ptr<protocol::Runtime::RemoteObject> wrapException(V8InspectorSe ssionImpl*, bool generatePreview) const;
83 void setLocation(const String16& url, unsigned lineNumber, unsigned columnNu mber, std::unique_ptr<V8StackTrace>, int scriptId);
79 84
80 V8MessageOrigin m_origin; 85 V8MessageOrigin m_origin;
81 double m_timestamp; 86 double m_timestamp;
82 MessageSource m_source; 87 MessageSource m_source;
83 MessageLevel m_level; 88 MessageLevel m_level;
84 String16 m_message; 89 String16 m_message;
85 String16 m_url; 90 String16 m_url;
86 unsigned m_lineNumber; 91 unsigned m_lineNumber;
87 unsigned m_columnNumber; 92 unsigned m_columnNumber;
88 std::unique_ptr<V8StackTrace> m_stackTrace; 93 std::unique_ptr<V8StackTrace> m_stackTrace;
89 int m_scriptId; 94 int m_scriptId;
90 String16 m_requestIdentifier; 95 String16 m_requestIdentifier;
96 String16 m_workerId;
91 int m_contextId; 97 int m_contextId;
92 MessageType m_type; 98 MessageType m_type;
93 unsigned m_exceptionId; 99 unsigned m_exceptionId;
94 unsigned m_revokedExceptionId; 100 unsigned m_revokedExceptionId;
95 Arguments m_arguments; 101 Arguments m_arguments;
96 }; 102 };
97 103
98 class V8ConsoleMessageStorage { 104 class V8ConsoleMessageStorage {
99 public: 105 public:
100 V8ConsoleMessageStorage(V8DebuggerImpl*, int contextGroupId); 106 V8ConsoleMessageStorage(V8DebuggerImpl*, int contextGroupId);
(...skipping 10 matching lines...) Expand all
111 private: 117 private:
112 V8DebuggerImpl* m_debugger; 118 V8DebuggerImpl* m_debugger;
113 int m_contextGroupId; 119 int m_contextGroupId;
114 int m_expiredCount; 120 int m_expiredCount;
115 std::deque<std::unique_ptr<V8ConsoleMessage>> m_messages; 121 std::deque<std::unique_ptr<V8ConsoleMessage>> m_messages;
116 }; 122 };
117 123
118 } // namespace blink 124 } // namespace blink
119 125
120 #endif // V8ConsoleMessage_h 126 #endif // V8ConsoleMessage_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698