| Index: third_party/WebKit/Source/core/frame/PerformanceMonitor.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/PerformanceMonitor.cpp b/third_party/WebKit/Source/core/frame/PerformanceMonitor.cpp
|
| index b4949cedf9d84b798ab425346c4a523a3b09e2b6..b6b5b8747e0df93f5c39a256e3cd4e97c02ae11f 100644
|
| --- a/third_party/WebKit/Source/core/frame/PerformanceMonitor.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/PerformanceMonitor.cpp
|
| @@ -9,6 +9,7 @@
|
| #include "core/dom/ExecutionContext.h"
|
| #include "core/frame/Frame.h"
|
| #include "core/frame/LocalFrame.h"
|
| +#include "core/html/parser/HTMLDocumentParser.h"
|
| #include "public/platform/Platform.h"
|
| #include "wtf/CurrentTime.h"
|
|
|
| @@ -63,6 +64,17 @@ void PerformanceMonitor::didRecalculateStyle(Document* document) {
|
| }
|
|
|
| // static
|
| +void PerformanceMonitor::documentWriteFetchScript(Document* document) {
|
| + PerformanceMonitor* performanceMonitor =
|
| + PerformanceMonitor::instrumentingMonitor(document);
|
| + if (!performanceMonitor)
|
| + return;
|
| + String text = "Parser was blocked due to document.write(<script>)";
|
| + performanceMonitor->reportGenericViolation(
|
| + kBlockedParser, text, 0, SourceLocation::capture(document).get());
|
| +}
|
| +
|
| +// static
|
| double PerformanceMonitor::threshold(ExecutionContext* context,
|
| Violation violation) {
|
| PerformanceMonitor* monitor =
|
| @@ -80,13 +92,7 @@ void PerformanceMonitor::reportGenericViolation(ExecutionContext* context,
|
| PerformanceMonitor::instrumentingMonitor(context);
|
| if (!monitor)
|
| return;
|
| - ClientThresholds* clientThresholds = monitor->m_subscriptions.get(violation);
|
| - if (!clientThresholds)
|
| - return;
|
| - for (const auto& it : *clientThresholds) {
|
| - if (it.value < time)
|
| - it.key->reportGenericViolation(violation, text, time, location);
|
| - }
|
| + monitor->reportGenericViolation(violation, text, time, location);
|
| }
|
|
|
| // static
|
| @@ -213,10 +219,9 @@ void PerformanceMonitor::willProcessTask() {
|
| }
|
|
|
| void PerformanceMonitor::didProcessTask() {
|
| - double threshold = m_thresholds[kLongLayout];
|
| - if (!threshold || m_perTaskStyleAndLayoutTime < threshold)
|
| + double layoutThreshold = m_thresholds[kLongLayout];
|
| + if (!layoutThreshold || m_perTaskStyleAndLayoutTime < layoutThreshold)
|
| return;
|
| -
|
| ClientThresholds* clientThresholds = m_subscriptions.get(kLongLayout);
|
| DCHECK(clientThresholds);
|
| for (const auto& it : *clientThresholds) {
|
| @@ -225,6 +230,19 @@ void PerformanceMonitor::didProcessTask() {
|
| }
|
| }
|
|
|
| +void PerformanceMonitor::reportGenericViolation(Violation violation,
|
| + const String& text,
|
| + double time,
|
| + SourceLocation* location) {
|
| + ClientThresholds* clientThresholds = m_subscriptions.get(violation);
|
| + if (!clientThresholds)
|
| + return;
|
| + for (const auto& it : *clientThresholds) {
|
| + if (it.value < time)
|
| + it.key->reportGenericViolation(violation, text, time, location);
|
| + }
|
| +}
|
| +
|
| void PerformanceMonitor::ReportTaskTime(scheduler::TaskQueue*,
|
| double startTime,
|
| double endTime) {
|
|
|