| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/QualifiedName.h" | 37 #include "core/dom/QualifiedName.h" |
| 38 #include "core/dom/TaskRunnerHelper.h" | 38 #include "core/dom/TaskRunnerHelper.h" |
| 39 #include "core/frame/DOMWindow.h" | 39 #include "core/frame/DOMWindow.h" |
| 40 #include "core/frame/LocalFrame.h" | 40 #include "core/frame/LocalFrame.h" |
| 41 #include "core/frame/UseCounter.h" | 41 #include "core/frame/UseCounter.h" |
| 42 #include "core/html/HTMLFrameOwnerElement.h" | 42 #include "core/html/HTMLFrameOwnerElement.h" |
| 43 #include "core/loader/DocumentLoader.h" | 43 #include "core/loader/DocumentLoader.h" |
| 44 #include "core/origin_trials/OriginTrials.h" | 44 #include "core/origin_trials/OriginTrials.h" |
| 45 #include "core/timing/PerformanceTiming.h" | 45 #include "core/timing/PerformanceTiming.h" |
| 46 #include "platform/loader/fetch/ResourceTimingInfo.h" |
| 47 #include "platform/RuntimeEnabledFeatures.h" |
| 46 | 48 |
| 47 static const double kLongTaskThreshold = 0.05; | 49 static const double kLongTaskThreshold = 0.05; |
| 48 | 50 |
| 49 static const char kUnknownAttribution[] = "unknown"; | 51 static const char kUnknownAttribution[] = "unknown"; |
| 50 static const char kAmbiguousAttribution[] = "multiple-contexts"; | 52 static const char kAmbiguousAttribution[] = "multiple-contexts"; |
| 51 static const char kSameOriginAttribution[] = "same-origin"; | 53 static const char kSameOriginAttribution[] = "same-origin"; |
| 52 static const char kSameOriginSelfAttribution[] = "self"; | 54 static const char kSameOriginSelfAttribution[] = "self"; |
| 53 static const char kSameOriginAncestorAttribution[] = "same-origin-ancestor"; | 55 static const char kSameOriginAncestorAttribution[] = "same-origin-ancestor"; |
| 54 static const char kSameOriginDescendantAttribution[] = "same-origin-descendant"; | 56 static const char kSameOriginDescendantAttribution[] = "same-origin-descendant"; |
| 55 static const char kCrossOriginAncestorAttribution[] = "cross-origin-ancestor"; | 57 static const char kCrossOriginAncestorAttribution[] = "cross-origin-ancestor"; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return m_navigation.get(); | 135 return m_navigation.get(); |
| 134 } | 136 } |
| 135 | 137 |
| 136 PerformanceTiming* Performance::timing() const { | 138 PerformanceTiming* Performance::timing() const { |
| 137 if (!m_timing) | 139 if (!m_timing) |
| 138 m_timing = PerformanceTiming::create(frame()); | 140 m_timing = PerformanceTiming::create(frame()); |
| 139 | 141 |
| 140 return m_timing.get(); | 142 return m_timing.get(); |
| 141 } | 143 } |
| 142 | 144 |
| 145 PerformanceNavigationTiming* Performance::createNavigationTimingInstance() { |
| 146 if (!RuntimeEnabledFeatures::performanceNavigationTiming2Enabled()) |
| 147 return nullptr; |
| 148 if (!frame()) |
| 149 return nullptr; |
| 150 const DocumentLoader* documentLoader = frame()->loader().documentLoader(); |
| 151 DCHECK(documentLoader); |
| 152 ResourceTimingInfo* info = documentLoader->getNavigationTimingInfo(); |
| 153 if (!info) |
| 154 return nullptr; |
| 155 return new PerformanceNavigationTiming(frame(), info, timeOrigin()); |
| 156 } |
| 157 |
| 143 void Performance::updateLongTaskInstrumentation() { | 158 void Performance::updateLongTaskInstrumentation() { |
| 144 DCHECK(frame()); | 159 DCHECK(frame()); |
| 145 if (!frame()->document()) | 160 if (!frame()->document()) |
| 146 return; | 161 return; |
| 147 | 162 |
| 148 if (hasObserverFor(PerformanceEntry::LongTask)) { | 163 if (hasObserverFor(PerformanceEntry::LongTask)) { |
| 149 UseCounter::count(frame()->localFrameRoot(), UseCounter::LongTaskObserver); | 164 UseCounter::count(frame()->localFrameRoot(), UseCounter::LongTaskObserver); |
| 150 frame()->performanceMonitor()->subscribe(PerformanceMonitor::kLongTask, | 165 frame()->performanceMonitor()->subscribe(PerformanceMonitor::kLongTask, |
| 151 kLongTaskThreshold, this); | 166 kLongTaskThreshold, this); |
| 152 } else { | 167 } else { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 HTMLFrameOwnerElement* frameOwner = | 259 HTMLFrameOwnerElement* frameOwner = |
| 245 culpritDomWindow->frame()->deprecatedLocalOwner(); | 260 culpritDomWindow->frame()->deprecatedLocalOwner(); |
| 246 addLongTaskTiming(startTime, endTime, attribution.first, | 261 addLongTaskTiming(startTime, endTime, attribution.first, |
| 247 getFrameAttribute(frameOwner, HTMLNames::srcAttr, false), | 262 getFrameAttribute(frameOwner, HTMLNames::srcAttr, false), |
| 248 getFrameAttribute(frameOwner, HTMLNames::idAttr, false), | 263 getFrameAttribute(frameOwner, HTMLNames::idAttr, false), |
| 249 getFrameAttribute(frameOwner, HTMLNames::nameAttr, true)); | 264 getFrameAttribute(frameOwner, HTMLNames::nameAttr, true)); |
| 250 } | 265 } |
| 251 } | 266 } |
| 252 | 267 |
| 253 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |