| 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 28 matching lines...) Expand all Loading... |
| 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" | 46 #include "platform/loader/fetch/ResourceTimingInfo.h" |
| 47 #include "platform/RuntimeEnabledFeatures.h" | 47 #include "platform/RuntimeEnabledFeatures.h" |
| 48 | 48 |
| 49 static const double kLongTaskThreshold = 0.05; | 49 static const double kLongTaskObserverThreshold = 0.05; |
| 50 | 50 |
| 51 static const char kUnknownAttribution[] = "unknown"; | 51 static const char kUnknownAttribution[] = "unknown"; |
| 52 static const char kAmbiguousAttribution[] = "multiple-contexts"; | 52 static const char kAmbiguousAttribution[] = "multiple-contexts"; |
| 53 static const char kSameOriginAttribution[] = "same-origin"; | 53 static const char kSameOriginAttribution[] = "same-origin"; |
| 54 static const char kSameOriginSelfAttribution[] = "self"; | 54 static const char kSameOriginSelfAttribution[] = "self"; |
| 55 static const char kSameOriginAncestorAttribution[] = "same-origin-ancestor"; | 55 static const char kSameOriginAncestorAttribution[] = "same-origin-ancestor"; |
| 56 static const char kSameOriginDescendantAttribution[] = "same-origin-descendant"; | 56 static const char kSameOriginDescendantAttribution[] = "same-origin-descendant"; |
| 57 static const char kCrossOriginAncestorAttribution[] = "cross-origin-ancestor"; | 57 static const char kCrossOriginAncestorAttribution[] = "cross-origin-ancestor"; |
| 58 static const char kCrossOriginDescendantAttribution[] = | 58 static const char kCrossOriginDescendantAttribution[] = |
| 59 "cross-origin-descendant"; | 59 "cross-origin-descendant"; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 void Performance::UpdateLongTaskInstrumentation() { | 152 void Performance::UpdateLongTaskInstrumentation() { |
| 153 DCHECK(GetFrame()); | 153 DCHECK(GetFrame()); |
| 154 if (!GetFrame()->GetDocument()) | 154 if (!GetFrame()->GetDocument()) |
| 155 return; | 155 return; |
| 156 | 156 |
| 157 if (HasObserverFor(PerformanceEntry::kLongTask)) { | 157 if (HasObserverFor(PerformanceEntry::kLongTask)) { |
| 158 UseCounter::Count(&GetFrame()->LocalFrameRoot(), | 158 UseCounter::Count(&GetFrame()->LocalFrameRoot(), |
| 159 WebFeature::kLongTaskObserver); | 159 WebFeature::kLongTaskObserver); |
| 160 GetFrame()->GetPerformanceMonitor()->Subscribe( | 160 GetFrame()->GetPerformanceMonitor()->Subscribe( |
| 161 PerformanceMonitor::kLongTask, kLongTaskThreshold, this); | 161 PerformanceMonitor::kLongTask, kLongTaskObserverThreshold, this); |
| 162 } else { | 162 } else { |
| 163 GetFrame()->GetPerformanceMonitor()->UnsubscribeAll(this); | 163 GetFrame()->GetPerformanceMonitor()->UnsubscribeAll(this); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 ScriptValue Performance::toJSONForBinding(ScriptState* script_state) const { | 167 ScriptValue Performance::toJSONForBinding(ScriptState* script_state) const { |
| 168 V8ObjectBuilder result(script_state); | 168 V8ObjectBuilder result(script_state); |
| 169 result.Add("timing", timing()->toJSONForBinding(script_state)); | 169 result.Add("timing", timing()->toJSONForBinding(script_state)); |
| 170 result.Add("navigation", navigation()->toJSONForBinding(script_state)); | 170 result.Add("navigation", navigation()->toJSONForBinding(script_state)); |
| 171 return result.GetScriptValue(); | 171 return result.GetScriptValue(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 culprit_dom_window->GetFrame()->DeprecatedLocalOwner(); | 257 culprit_dom_window->GetFrame()->DeprecatedLocalOwner(); |
| 258 AddLongTaskTiming( | 258 AddLongTaskTiming( |
| 259 start_time, end_time, attribution.first, | 259 start_time, end_time, attribution.first, |
| 260 GetFrameAttribute(frame_owner, HTMLNames::srcAttr, false), | 260 GetFrameAttribute(frame_owner, HTMLNames::srcAttr, false), |
| 261 GetFrameAttribute(frame_owner, HTMLNames::idAttr, false), | 261 GetFrameAttribute(frame_owner, HTMLNames::idAttr, false), |
| 262 GetFrameAttribute(frame_owner, HTMLNames::nameAttr, true)); | 262 GetFrameAttribute(frame_owner, HTMLNames::nameAttr, true)); |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace blink | 266 } // namespace blink |
| OLD | NEW |