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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp

Issue 2522583002: Roll third_party/inspector_protocol to 4ad35c45aca9834b67ec2cb152c816ea1b7ceb48 (Closed)
Patch Set: updated README.chromium Created 4 years 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 #include "core/inspector/InspectorLogAgent.h" 5 #include "core/inspector/InspectorLogAgent.h"
6 6
7 #include "bindings/core/v8/SourceLocation.h" 7 #include "bindings/core/v8/SourceLocation.h"
8 #include "core/frame/PerformanceMonitor.h" 8 #include "core/frame/PerformanceMonitor.h"
9 #include "core/inspector/ConsoleMessage.h" 9 #include "core/inspector/ConsoleMessage.h"
10 #include "core/inspector/ConsoleMessageStorage.h" 10 #include "core/inspector/ConsoleMessageStorage.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 void InspectorLogAgent::restore() { 87 void InspectorLogAgent::restore() {
88 if (!m_state->booleanProperty(LogAgentState::logEnabled, false)) 88 if (!m_state->booleanProperty(LogAgentState::logEnabled, false))
89 return; 89 return;
90 enable(); 90 enable();
91 protocol::Value* config = m_state->get(LogAgentState::logViolations); 91 protocol::Value* config = m_state->get(LogAgentState::logViolations);
92 if (config) { 92 if (config) {
93 protocol::ErrorSupport errors; 93 protocol::ErrorSupport errors;
94 startViolationsReport( 94 startViolationsReport(
95 protocol::Array<ViolationSetting>::parse(config, &errors)); 95 protocol::Array<ViolationSetting>::fromValue(config, &errors));
96 } 96 }
97 } 97 }
98 98
99 void InspectorLogAgent::consoleMessageAdded(ConsoleMessage* message) { 99 void InspectorLogAgent::consoleMessageAdded(ConsoleMessage* message) {
100 DCHECK(m_enabled); 100 DCHECK(m_enabled);
101 101
102 std::unique_ptr<protocol::Log::LogEntry> entry = 102 std::unique_ptr<protocol::Log::LogEntry> entry =
103 protocol::Log::LogEntry::create() 103 protocol::Log::LogEntry::create()
104 .setSource(messageSourceValue(message->source())) 104 .setSource(messageSourceValue(message->source()))
105 .setLevel(messageLevelValue(message->level())) 105 .setLevel(messageLevelValue(message->level()))
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return PerformanceMonitor::kHandler; 177 return PerformanceMonitor::kHandler;
178 if (name == ViolationSetting::NameEnum::RecurringHandler) 178 if (name == ViolationSetting::NameEnum::RecurringHandler)
179 return PerformanceMonitor::kRecurringHandler; 179 return PerformanceMonitor::kRecurringHandler;
180 return PerformanceMonitor::kAfterLast; 180 return PerformanceMonitor::kAfterLast;
181 } 181 }
182 182
183 Response InspectorLogAgent::startViolationsReport( 183 Response InspectorLogAgent::startViolationsReport(
184 std::unique_ptr<protocol::Array<ViolationSetting>> settings) { 184 std::unique_ptr<protocol::Array<ViolationSetting>> settings) {
185 if (!m_enabled) 185 if (!m_enabled)
186 return Response::Error("Log is not enabled"); 186 return Response::Error("Log is not enabled");
187 m_state->setValue(LogAgentState::logViolations, settings->serialize()); 187 m_state->setValue(LogAgentState::logViolations, settings->toValue());
188 if (!m_performanceMonitor) 188 if (!m_performanceMonitor)
189 return Response::Error("Violations are not supported for this target"); 189 return Response::Error("Violations are not supported for this target");
190 m_performanceMonitor->unsubscribeAll(this); 190 m_performanceMonitor->unsubscribeAll(this);
191 for (size_t i = 0; i < settings->length(); ++i) { 191 for (size_t i = 0; i < settings->length(); ++i) {
192 PerformanceMonitor::Violation violation = 192 PerformanceMonitor::Violation violation =
193 parseViolation(settings->get(i)->getName()); 193 parseViolation(settings->get(i)->getName());
194 if (violation == PerformanceMonitor::kAfterLast) 194 if (violation == PerformanceMonitor::kAfterLast)
195 continue; 195 continue;
196 m_performanceMonitor->subscribe( 196 m_performanceMonitor->subscribe(
197 violation, settings->get(i)->getThreshold() / 1000, this); 197 violation, settings->get(i)->getThreshold() / 1000, this);
(...skipping 21 matching lines...) Expand all
219 void InspectorLogAgent::reportGenericViolation(PerformanceMonitor::Violation, 219 void InspectorLogAgent::reportGenericViolation(PerformanceMonitor::Violation,
220 const String& text, 220 const String& text,
221 double time, 221 double time,
222 SourceLocation* location) { 222 SourceLocation* location) {
223 ConsoleMessage* message = ConsoleMessage::create( 223 ConsoleMessage* message = ConsoleMessage::create(
224 ViolationMessageSource, WarningMessageLevel, text, location->clone()); 224 ViolationMessageSource, WarningMessageLevel, text, location->clone());
225 consoleMessageAdded(message); 225 consoleMessageAdded(message);
226 }; 226 };
227 227
228 } // namespace blink 228 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698