Commit bc68bebf authored by Alexei Filippov's avatar Alexei Filippov Committed by Commit Bot

DevTools: Mangle ProfileChunk events' id

The id is process scoped so mangle it with pid to get a unique id.

Change-Id: I681bf76f1b01c946287c247257c911a326cbced5
Reviewed-on: https://chromium-review.googlesource.com/1123322Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572061}
parent e82de018
...@@ -248,19 +248,20 @@ SDK.TracingModel = class { ...@@ -248,19 +248,20 @@ SDK.TracingModel = class {
* @param {!SDK.TracingModel.Event} event * @param {!SDK.TracingModel.Event} event
*/ */
_addSampleEvent(event) { _addSampleEvent(event) {
const group = this._profileGroups.get(event.id); const id = `${event.thread.process().id()}:${event.id}`;
const group = this._profileGroups.get(id);
if (group) if (group)
group._addChild(event); group._addChild(event);
else else
this._profileGroups.set(event.id, new SDK.TracingModel.ProfileEventsGroup(event)); this._profileGroups.set(id, new SDK.TracingModel.ProfileEventsGroup(event));
} }
/** /**
* @param {string} id * @param {!SDK.TracingModel.Event} event
* @return {?SDK.TracingModel.ProfileEventsGroup} * @return {?SDK.TracingModel.ProfileEventsGroup}
*/ */
profileGroup(id) { profileGroup(event) {
return this._profileGroups.get(id) || null; return this._profileGroups.get(`${event.thread.process().id()}:${event.id}`) || null;
} }
/** /**
......
...@@ -429,7 +429,7 @@ TimelineModel.TimelineModel = class { ...@@ -429,7 +429,7 @@ TimelineModel.TimelineModel = class {
cpuProfileEvent = events.find(e => e.name === TimelineModel.TimelineModel.RecordType.Profile); cpuProfileEvent = events.find(e => e.name === TimelineModel.TimelineModel.RecordType.Profile);
if (!cpuProfileEvent) if (!cpuProfileEvent)
return null; return null;
const profileGroup = tracingModel.profileGroup(cpuProfileEvent.id); const profileGroup = tracingModel.profileGroup(cpuProfileEvent);
if (!profileGroup) { if (!profileGroup) {
Common.console.error('Invalid CPU profile format.'); Common.console.error('Invalid CPU profile format.');
return null; return null;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment