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

Unified Diff: src/inspector/V8ConsoleMessage.h

Issue 2292573002: [inspector] Initial import of v8_inspector. (Closed)
Patch Set: format the code, disable cpplint Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/inspector/V8ConsoleAgentImpl.cpp ('k') | src/inspector/V8ConsoleMessage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/V8ConsoleMessage.h
diff --git a/src/inspector/V8ConsoleMessage.h b/src/inspector/V8ConsoleMessage.h
new file mode 100644
index 0000000000000000000000000000000000000000..1227dfb2f7f0b5a8a8e84df9d6940204e7ad55ce
--- /dev/null
+++ b/src/inspector/V8ConsoleMessage.h
@@ -0,0 +1,120 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_INSPECTOR_V8CONSOLEMESSAGE_H_
+#define V8_INSPECTOR_V8CONSOLEMESSAGE_H_
+
+#include <v8.h>
+#include <deque>
+#include "src/inspector/protocol/Console.h"
+#include "src/inspector/protocol/Forward.h"
+#include "src/inspector/protocol/Runtime.h"
+
+namespace v8_inspector {
+
+class InspectedContext;
+class V8InspectorImpl;
+class V8InspectorSessionImpl;
+class V8StackTraceImpl;
+
+enum class V8MessageOrigin { kConsole, kException, kRevokedException };
+
+enum class ConsoleAPIType {
+ kLog,
+ kDebug,
+ kInfo,
+ kError,
+ kWarning,
+ kDir,
+ kDirXML,
+ kTable,
+ kTrace,
+ kStartGroup,
+ kStartGroupCollapsed,
+ kEndGroup,
+ kClear,
+ kAssert,
+ kTimeEnd,
+ kCount
+};
+
+class V8ConsoleMessage {
+ public:
+ ~V8ConsoleMessage();
+
+ static std::unique_ptr<V8ConsoleMessage> createForConsoleAPI(
+ double timestamp, ConsoleAPIType,
+ const std::vector<v8::Local<v8::Value>>& arguments,
+ std::unique_ptr<V8StackTraceImpl>, InspectedContext*);
+
+ static std::unique_ptr<V8ConsoleMessage> createForException(
+ double timestamp, const String16& detailedMessage, const String16& url,
+ unsigned lineNumber, unsigned columnNumber,
+ std::unique_ptr<V8StackTraceImpl>, int scriptId, v8::Isolate*,
+ const String16& message, int contextId, v8::Local<v8::Value> exception,
+ unsigned exceptionId);
+
+ static std::unique_ptr<V8ConsoleMessage> createForRevokedException(
+ double timestamp, const String16& message, unsigned revokedExceptionId);
+
+ V8MessageOrigin origin() const;
+ void reportToFrontend(protocol::Console::Frontend*) const;
+ void reportToFrontend(protocol::Runtime::Frontend*, V8InspectorSessionImpl*,
+ bool generatePreview) const;
+ ConsoleAPIType type() const;
+ void contextDestroyed(int contextId);
+
+ private:
+ V8ConsoleMessage(V8MessageOrigin, double timestamp, const String16& message);
+
+ using Arguments = std::vector<std::unique_ptr<v8::Global<v8::Value>>>;
+ std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>>
+ wrapArguments(V8InspectorSessionImpl*, bool generatePreview) const;
+ std::unique_ptr<protocol::Runtime::RemoteObject> wrapException(
+ V8InspectorSessionImpl*, bool generatePreview) const;
+ void setLocation(const String16& url, unsigned lineNumber,
+ unsigned columnNumber, std::unique_ptr<V8StackTraceImpl>,
+ int scriptId);
+
+ V8MessageOrigin m_origin;
+ double m_timestamp;
+ String16 m_message;
+ String16 m_url;
+ unsigned m_lineNumber;
+ unsigned m_columnNumber;
+ std::unique_ptr<V8StackTraceImpl> m_stackTrace;
+ int m_scriptId;
+ int m_contextId;
+ ConsoleAPIType m_type;
+ unsigned m_exceptionId;
+ unsigned m_revokedExceptionId;
+ Arguments m_arguments;
+ String16 m_detailedMessage;
+};
+
+class V8ConsoleMessageStorage {
+ public:
+ V8ConsoleMessageStorage(V8InspectorImpl*, int contextGroupId);
+ ~V8ConsoleMessageStorage();
+
+ int contextGroupId() { return m_contextGroupId; }
+ int expiredCount() { return m_expiredCount; }
+ const std::deque<std::unique_ptr<V8ConsoleMessage>>& messages() const {
+ return m_messages;
+ }
+
+ void addMessage(std::unique_ptr<V8ConsoleMessage>);
+ void contextDestroyed(int contextId);
+ void clear();
+
+ private:
+ V8InspectorImpl* m_inspector;
+ int m_contextGroupId;
+ int m_expiredCount;
+ std::deque<std::unique_ptr<V8ConsoleMessage>> m_messages;
+};
+
+} // namespace v8_inspector
+
+#endif // V8_INSPECTOR_V8CONSOLEMESSAGE_H_
« no previous file with comments | « src/inspector/V8ConsoleAgentImpl.cpp ('k') | src/inspector/V8ConsoleMessage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698