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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp

Issue 2474073005: DevTools: add the logging aspect into the PerformanceMonitor (Closed)
Patch Set: test fixed Created 4 years, 1 month 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
Index: third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp
index 9e3e6f74d40e1cfb49488021f5fdd30b73864c01..daf96bfcf85df6269fd62c8e41e590561347163d 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp
@@ -5,6 +5,7 @@
#include "core/inspector/InspectorLogAgent.h"
#include "bindings/core/v8/SourceLocation.h"
+#include "core/frame/PerformanceMonitor.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/ConsoleMessageStorage.h"
#include "core/inspector/IdentifiersFactory.h"
@@ -13,6 +14,7 @@ namespace blink {
namespace LogAgentState {
static const char logEnabled[] = "logEnabled";
+static const char logViolationsEnabled[] = "logViolationsEnabled";
}
namespace {
@@ -40,6 +42,8 @@ String messageSourceValue(MessageSource source) {
return protocol::Log::LogEntry::SourceEnum::Deprecation;
case WorkerMessageSource:
return protocol::Log::LogEntry::SourceEnum::Worker;
+ case ViolationMessageSource:
+ return protocol::Log::LogEntry::SourceEnum::Violation;
default:
return protocol::Log::LogEntry::SourceEnum::Other;
}
@@ -63,13 +67,17 @@ String messageLevelValue(MessageLevel level) {
} // namespace
-InspectorLogAgent::InspectorLogAgent(ConsoleMessageStorage* storage)
- : m_enabled(false), m_storage(storage) {}
+InspectorLogAgent::InspectorLogAgent(ConsoleMessageStorage* storage,
+ PerformanceMonitor* performanceMonitor)
+ : m_enabled(false),
+ m_storage(storage),
+ m_performanceMonitor(performanceMonitor) {}
InspectorLogAgent::~InspectorLogAgent() {}
DEFINE_TRACE(InspectorLogAgent) {
visitor->trace(m_storage);
+ visitor->trace(m_performanceMonitor);
InspectorBaseAgent::trace(visitor);
}
@@ -77,6 +85,8 @@ void InspectorLogAgent::restore() {
if (!m_state->booleanProperty(LogAgentState::logEnabled, false))
return;
enable();
+ if (m_state->booleanProperty(LogAgentState::logViolationsEnabled, false))
+ setReportViolationsEnabled(true);
}
void InspectorLogAgent::consoleMessageAdded(ConsoleMessage* message) {
@@ -146,4 +156,13 @@ Response InspectorLogAgent::clear() {
return Response::OK();
}
+Response InspectorLogAgent::setReportViolationsEnabled(bool enabled) {
+ if (!m_enabled)
+ return Response::Error("Log is not enabled");
+ m_state->setBoolean(LogAgentState::logViolationsEnabled, enabled);
+ if (m_performanceMonitor)
+ m_performanceMonitor->setLoggingEnabled(enabled);
+ return Response::OK();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698