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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineModel.js

Issue 1748993002: DevTools: Initial implementation of line-level CPU profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove JSSF to sdk dependency Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 var events = thread.events(); 1011 var events = thread.events();
1012 var asyncEvents = thread.asyncEvents(); 1012 var asyncEvents = thread.asyncEvents();
1013 1013
1014 var jsSamples; 1014 var jsSamples;
1015 if (Runtime.experiments.isEnabled("timelineTracingJSProfile")) { 1015 if (Runtime.experiments.isEnabled("timelineTracingJSProfile")) {
1016 jsSamples = WebInspector.TimelineJSProfileProcessor.processRawV8Samp les(events); 1016 jsSamples = WebInspector.TimelineJSProfileProcessor.processRawV8Samp les(events);
1017 } else { 1017 } else {
1018 var cpuProfileEvent = events.peekLast(); 1018 var cpuProfileEvent = events.peekLast();
1019 if (cpuProfileEvent && cpuProfileEvent.name === WebInspector.Timelin eModel.RecordType.CpuProfile) { 1019 if (cpuProfileEvent && cpuProfileEvent.name === WebInspector.Timelin eModel.RecordType.CpuProfile) {
1020 var cpuProfile = cpuProfileEvent.args["data"]["cpuProfile"]; 1020 var cpuProfile = cpuProfileEvent.args["data"]["cpuProfile"];
1021 if (cpuProfile) 1021 if (cpuProfile) {
1022 jsSamples = WebInspector.TimelineJSProfileProcessor.generate TracingEventsFromCpuProfile(cpuProfile, thread); 1022 var jsProfileModel = new WebInspector.CPUProfileDataModel(cp uProfile);
1023 WebInspector.TimelineJSProfileProcessor.buildLineLevelProfil es(jsProfileModel);
1024 jsSamples = WebInspector.TimelineJSProfileProcessor.generate TracingEventsFromCpuProfile(jsProfileModel, thread);
1025 }
1023 } 1026 }
1024 } 1027 }
1025 1028
1026 if (jsSamples && jsSamples.length) 1029 if (jsSamples && jsSamples.length)
1027 events = events.mergeOrdered(jsSamples, WebInspector.TracingModel.Ev ent.orderedCompareStartTime); 1030 events = events.mergeOrdered(jsSamples, WebInspector.TracingModel.Ev ent.orderedCompareStartTime);
1028 if (jsSamples || events.some(function(e) { return e.name === WebInspecto r.TimelineModel.RecordType.JSSample; })) { 1031 if (jsSamples || events.some(function(e) { return e.name === WebInspecto r.TimelineModel.RecordType.JSSample; })) {
1029 var jsFrameEvents = WebInspector.TimelineJSProfileProcessor.generate JSFrameEvents(events); 1032 var jsFrameEvents = WebInspector.TimelineJSProfileProcessor.generate JSFrameEvents(events);
1030 if (jsFrameEvents && jsFrameEvents.length) 1033 if (jsFrameEvents && jsFrameEvents.length)
1031 events = jsFrameEvents.mergeOrdered(events, WebInspector.Tracing Model.Event.orderedCompareStartTime); 1034 events = jsFrameEvents.mergeOrdered(events, WebInspector.Tracing Model.Event.orderedCompareStartTime);
1032 } 1035 }
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 if (!id) 2010 if (!id)
2008 return; 2011 return;
2009 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ 2012 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */
2010 var initiatorMap = this._initiatorByType.get(initiatorType); 2013 var initiatorMap = this._initiatorByType.get(initiatorType);
2011 if (isInitiator) 2014 if (isInitiator)
2012 initiatorMap.set(id, event); 2015 initiatorMap.set(id, event);
2013 else 2016 else
2014 event.initiator = initiatorMap.get(id) || null; 2017 event.initiator = initiatorMap.get(id) || null;
2015 } 2018 }
2016 } 2019 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698