Skip to content

Commit

Permalink
squash 'resources/unpacked/devtools' changes from adf7209..18b86b0
Browse files Browse the repository at this point in the history
18b86b0 DevTools: WebSocketFrameView - Add frames display control toolbar
544b916 Revert of DevTools: Roll Lighthouse binary to 2.0.0-alpha.7 (patchset #3 id:20001 of https://codereview.chromium.org/2888263002/ )
d658f9a [DevTools] Show icon in top toolbar when Node target is available
993b27c DevTools: Roll Lighthouse binary to 2.0.0-alpha.7 Hash: aebc9bdf53754ffd360f7c54c752b046383c2d1b
b0155de DevTools: Show badges instead of products in ConsoleContextSelector
d5903af [Devtools][Regression] Fixed network film strip sometimes errored
123fed4 [DevTools] breakpoint manager should be ready for location from different model
47fe6ba DevTools: fix exception on heap snapshot error reporting.
fe59089 DevTools: prep audits panel for Lighthouse roll
a606325 [Devtools] Updated frontend version to 24 - remove products column
b1a60f2 [DevTools] update decorations when there is no pending possibleBreakpoints

git-subtree-dir: resources/unpacked/devtools
git-subtree-split: 18b86b0
  • Loading branch information
darwin committed May 19, 2017
1 parent f9c8c49 commit 2dead10
Show file tree
Hide file tree
Showing 21 changed files with 332 additions and 296 deletions.
2 changes: 2 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ all_devtools_files = [
"front_end/main/GCActionDelegate.js",
"front_end/main/Main.js",
"front_end/main/module.json",
"front_end/main/nodeIcon.css",
"front_end/main/remoteDebuggingTerminatedScreen.css",
"front_end/main/renderingOptions.css",
"front_end/main/RenderingOptions.js",
Expand Down Expand Up @@ -804,6 +805,7 @@ devtools_image_files = [
"front_end/Images/ic_warning_black_18dp.svg",
"front_end/Images/navigationControls.png",
"front_end/Images/navigationControls_2x.png",
"front_end/Images/nodeIcon.png",
"front_end/Images/popoverArrows.png",
"front_end/Images/profileGroupIcon.png",
"front_end/Images/profileIcon.png",
Expand Down
Binary file added front_end/Images/nodeIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 14 additions & 76 deletions front_end/audits2/Audits2Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,19 @@ Audits2.Audits2Panel = class extends UI.PanelWithSidebar {
this._updateStatus(Common.UIString('Loading\u2026'));
})
.then(_ => this._protocolService.startLighthouse(this._inspectedURL, categoryIDs))
.then(lighthouseResult =>
this._stopAndReattach().then(() => this._buildReportUI(lighthouseResult))
).catch(err => {
.then(lighthouseResult => {
if (lighthouseResult && lighthouseResult.fatal) {
const error = new Error(lighthouseResult.message);
error.stack = lighthouseResult.stack;
throw error;
}

return this._stopAndReattach().then(() => this._buildReportUI(lighthouseResult));
})
.catch(err => {
if (err instanceof Error)
this._renderBugReport(err);
});
});
}

_hideDialog() {
Expand Down Expand Up @@ -266,6 +273,8 @@ Audits2.Audits2Panel = class extends UI.PanelWithSidebar {
var title = encodeURI('title=DevTools Error: ' + err.message.substring(0, 60));

var qsBody = '';
qsBody += '**Initial URL**: ' + this._inspectedURL + '\n';
qsBody += '**Chrome Version**: ' + navigator.userAgent.match(/Chrome\/(\S+)/)[1] + '\n';
qsBody += '**Error Message**: ' + err.message + '\n';
qsBody += '**Stack Trace**:\n ```' + err.stack + '```';
var body = '&body=' + encodeURI(qsBody);
Expand Down Expand Up @@ -540,7 +549,7 @@ Audits2.Audits2Panel.TreeElement = class extends UI.TreeElement {
return;
}

this._reportContainer = this._resultsView.createChild('div', 'report-container lh-vars lh-root');
this._reportContainer = this._resultsView.createChild('div', 'report-container lh-vars lh-root lh-devtools');

var dom = new DOM(/** @type {!Document} */ (this._resultsView.ownerDocument));
var detailsRenderer = new Audits2.DetailsRenderer(dom);
Expand All @@ -554,77 +563,6 @@ Audits2.Audits2Panel.TreeElement = class extends UI.TreeElement {

renderer.setTemplateContext(templatesDOM);
renderer.renderReport(this._lighthouseResult, this._reportContainer);

var performanceScoreElement = this._reportContainer.querySelector('.lh-category[id=performance] .lh-score');
var artifacts = this._lighthouseResult['artifacts'];
if (!performanceScoreElement || !artifacts)
return;
var tracePass = artifacts['traces'] ? artifacts['traces']['defaultPass'] : null;
if (!tracePass)
return;

var fmp = this._lighthouseResult['audits']['first-meaningful-paint'];
if (!fmp || !fmp['extendedInfo'])
return;

var tti = this._lighthouseResult['audits']['time-to-interactive'];
if (!tti || !tti['extendedInfo'])
return;

var navStart = fmp['extendedInfo']['value']['timestamps']['navStart'];
var markers = [
{
title: Common.UIString('First contentful paint'),
value: (fmp['extendedInfo']['value']['timestamps']['fCP'] - navStart) / 1000
},
{
title: Common.UIString('First meaningful paint'),
value: (fmp['extendedInfo']['value']['timestamps']['fMP'] - navStart) / 1000
},
{
title: Common.UIString('Time to interactive'),
value: (tti['extendedInfo']['value']['timestamps']['timeToInteractive'] - navStart) / 1000
},
{
title: Common.UIString('Visually ready'),
value: (tti['extendedInfo']['value']['timestamps']['visuallyReady'] - navStart) / 1000
}
];

var timeSpan = Math.max(...markers.map(marker => marker.value));
var screenshots = tracePass.traceEvents.filter(e => e.cat === 'disabled-by-default-devtools.screenshot');
var timelineElement = createElementWithClass('div', 'audits2-timeline');
var filmStripElement = timelineElement.createChild('div', 'audits2-filmstrip');

var numberOfFrames = 8;
var roundToMs = 100;
var timeStep = (Math.ceil(timeSpan / numberOfFrames / roundToMs)) * roundToMs;

for (var time = 0; time < timeSpan; time += timeStep) {
var frameForTime = null;
for (var e of screenshots) {
if ((e.ts - navStart) / 1000 < time + timeStep)
frameForTime = e.args.snapshot;
}
var frame = filmStripElement.createChild('div', 'frame');
frame.createChild('div', 'time').textContent = Number.millisToString(time + timeStep);

var thumbnail = frame.createChild('div', 'thumbnail');
if (frameForTime) {
var img = thumbnail.createChild('img');
img.src = 'data:image/jpg;base64,' + frameForTime;
}
}

for (var marker of markers) {
var markerElement = timelineElement.createChild('div', 'audits2-timeline-marker');
markerElement.createChild('div', 'audits2-timeline-bar').style.width =
(100 * (marker.value / timeSpan) | 0) + '%';
markerElement.createChild('span').textContent = Common.UIString('%s: ', marker.title);
markerElement.createChild('span', 'audits2-timeline-subtitle').textContent = Number.millisToString(marker.value);
}

performanceScoreElement.parentElement.insertBefore(timelineElement, performanceScoreElement.nextSibling);
}
};

Expand Down
62 changes: 0 additions & 62 deletions front_end/audits2/audits2Panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,65 +54,3 @@
overflow: auto;
position: relative;
}

.audits2-timeline {
display: flex;
flex-direction: column;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
padding: 5px 0;
margin: 5px 0 0 68px;
overflow: auto;
}

.lh-filmstrip {
display: none !important;
}

.audits2-filmstrip {
display: flex;
flex-direction: row;
margin-bottom: 20px;
}

.audits2-filmstrip .frame {
display: flex;
flex-direction: column;
align-items: center;
padding: 4px;
flex: none;
}

.audits2-filmstrip .frame .thumbnail {
display: flex;
width: 54px;
height: 100%;
flex-direction: row;
align-items: center;
margin: 4px 0 2px;
border: 2px solid transparent;
box-shadow: 0 0 3px #bbb;
}

.audits2-filmstrip .frame .thumbnail img {
height: auto;
width: 50px;
flex: 0 0 auto;
}

.audits2-filmstrip .frame .time {
margin-top: 2px;
}

.audits2-timeline-marker {
margin: 4px 0 6px;
width: calc(68px * 7);
}

.audits2-timeline-subtitle {
color: #01579B;
}

.audits2-timeline-bar {
border-top: 4px solid #03A9F4;
}
6 changes: 5 additions & 1 deletion front_end/audits2_worker/Audits2Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ var Audits2Service = class {
result.artifacts = {traces: traces};
return result;
})
.catchException(null);
.catch(err => ({
fatal: true,
message: err.message,
stack: err.stack,
}));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions front_end/bindings/BreakpointManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,8 @@ Bindings.BreakpointManager.ModelBreakpoint = class {

var debuggerLocation = uiSourceCode &&
Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber);
if (debuggerLocation && debuggerLocation.debuggerModel !== this._debuggerModel)
debuggerLocation = null;
var newState;
if (this._breakpoint._isRemoved || !this._breakpoint.enabled() || this._scriptDiverged()) {
newState = null;
Expand Down
10 changes: 9 additions & 1 deletion front_end/common/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,14 @@ Common.VersionController = class {
oldSetting.remove();
}

_updateVersionFrom24To25() {
var defaultColumns = {status: true, type: true, initiator: true, size: true, time: true};
var networkLogColumnsSetting = Common.settings.createSetting('networkLogColumns', defaultColumns);
var columns = networkLogColumnsSetting.get();
delete columns.product;
networkLogColumnsSetting.set(columns);
}

_migrateSettingsFromLocalStorage() {
// This step migrates all the settings except for the ones below into the browser profile.
var localSettings = new Set([
Expand Down Expand Up @@ -798,7 +806,7 @@ Common.VersionController = class {
};

Common.VersionController._currentVersionName = 'inspectorVersion';
Common.VersionController.currentVersion = 24;
Common.VersionController.currentVersion = 25;

/**
* @type {!Common.Settings}
Expand Down
Loading

0 comments on commit 2dead10

Please sign in to comment.