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

Side by Side Diff: third_party/WebKit/Source/core/timing/Performance.cpp

Issue 2966073003: Long tasks: add a trace event for long tasks (Closed)
Patch Set: use duration instead Created 3 years, 5 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void Performance::UpdateLongTaskInstrumentation() { 156 void Performance::UpdateLongTaskInstrumentation() {
157 DCHECK(GetFrame()); 157 DCHECK(GetFrame());
158 if (!GetFrame()->GetDocument()) 158 if (!GetFrame()->GetDocument())
159 return; 159 return;
160 160
161 if (HasObserverFor(PerformanceEntry::kLongTask)) { 161 if (HasObserverFor(PerformanceEntry::kLongTask)) {
162 UseCounter::Count(&GetFrame()->LocalFrameRoot(), 162 UseCounter::Count(&GetFrame()->LocalFrameRoot(),
163 WebFeature::kLongTaskObserver); 163 WebFeature::kLongTaskObserver);
164 GetFrame()->GetPerformanceMonitor()->Subscribe( 164 GetFrame()->GetPerformanceMonitor()->Subscribe(
165 PerformanceMonitor::kLongTask, kLongTaskThreshold, this); 165 PerformanceMonitor::kLongTask, kLongTaskObserverThreshold, this);
166 } else { 166 } else {
167 GetFrame()->GetPerformanceMonitor()->UnsubscribeAll(this); 167 GetFrame()->GetPerformanceMonitor()->UnsubscribeAll(this);
168 } 168 }
169 } 169 }
170 170
171 ScriptValue Performance::toJSONForBinding(ScriptState* script_state) const { 171 ScriptValue Performance::toJSONForBinding(ScriptState* script_state) const {
172 V8ObjectBuilder result(script_state); 172 V8ObjectBuilder result(script_state);
173 result.Add("timing", timing()->toJSONForBinding(script_state)); 173 result.Add("timing", timing()->toJSONForBinding(script_state));
174 result.Add("navigation", navigation()->toJSONForBinding(script_state)); 174 result.Add("navigation", navigation()->toJSONForBinding(script_state));
175 return result.GetScriptValue(); 175 return result.GetScriptValue();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 culprit_dom_window->GetFrame()->DeprecatedLocalOwner(); 261 culprit_dom_window->GetFrame()->DeprecatedLocalOwner();
262 AddLongTaskTiming( 262 AddLongTaskTiming(
263 start_time, end_time, attribution.first, 263 start_time, end_time, attribution.first,
264 GetFrameAttribute(frame_owner, HTMLNames::srcAttr, false), 264 GetFrameAttribute(frame_owner, HTMLNames::srcAttr, false),
265 GetFrameAttribute(frame_owner, HTMLNames::idAttr, false), 265 GetFrameAttribute(frame_owner, HTMLNames::idAttr, false),
266 GetFrameAttribute(frame_owner, HTMLNames::nameAttr, true)); 266 GetFrameAttribute(frame_owner, HTMLNames::nameAttr, true));
267 } 267 }
268 } 268 }
269 269
270 } // namespace blink 270 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698