Bug 172467 - Web Inspector: Don't load the active recording until a Timeline view needs to be shown
Summary: Web Inspector: Don't load the active recording until a Timeline view needs to...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-05-22 13:28 PDT by Devin Rousso
Modified: 2017-05-30 20:26 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.97 KB, patch)
2017-05-22 13:31 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Image] Timeline Before (494.19 KB, image/png)
2017-05-22 13:32 PDT, Devin Rousso
no flags Details
[Image] Timeline After (480.69 KB, image/png)
2017-05-22 13:32 PDT, Devin Rousso
no flags Details
Patch (2.81 KB, patch)
2017-05-23 13:32 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (3.34 KB, patch)
2017-05-23 17:05 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2017-05-22 13:28:15 PDT
The active recording `WebInspector.timelineManager.activeRecording` is displayed when the Timeline tab is created, causing a ContentView to be created even though it isn't being shown.  Instead of displaying the recording then, we can do it later when a timeline view needs to be shown, assuming a different recording hasn't already been loaded.
Comment 1 Devin Rousso 2017-05-22 13:31:52 PDT
Created attachment 310906 [details]
Patch
Comment 2 Devin Rousso 2017-05-22 13:32:10 PDT
Created attachment 310907 [details]
[Image] Timeline Before
Comment 3 Devin Rousso 2017-05-22 13:32:21 PDT
Created attachment 310908 [details]
[Image] Timeline After
Comment 4 Matt Baker 2017-05-22 13:38:29 PDT
Nice, a 50 ms improvement is pretty good! Did you take more than one sample?
Comment 5 Devin Rousso 2017-05-22 13:47:12 PDT
(In reply to Matt Baker from comment #4)
> Nice, a 50 ms improvement is pretty good! Did you take more than one sample?

I re-ran it about 5 times, each on a different tab, and saw around the same improvement.

Additionally, I tested the few approaches I know of to load the inspector on the Timelines tab (Develop menu, reloading when Timelines was last selected, clicking the dashboard, etc.) and saw no issues.
Comment 6 Joseph Pecoraro 2017-05-22 21:35:54 PDT
Comment on attachment 310906 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=310906&action=review

r- for question below.

> Source/WebInspectorUI/ChangeLog:12
> +        `_displayedRecording` isn't already set.  This delays the creation of the content view for

Style: One space after a period.

> Source/WebInspectorUI/ChangeLog:19
> +
> +

Style: Too many blank lines

> Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js:537
> +        if (!this._displayedRecording && WebInspector.timelineManager.activeRecording)
> +            this._recordingLoaded();

I think this deserves a comment, because it is really not the right place for this.

Perhaps it should just be inside a function named `_lazyInitialization`. It is also unclear to me why this is the correct place and not something like `shown` or `restoreFromCookie`. Can you describe why this is the most appropriate?
Comment 7 Devin Rousso 2017-05-23 13:27:14 PDT
Comment on attachment 310906 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=310906&action=review

>> Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js:537
>> +            this._recordingLoaded();
> 
> I think this deserves a comment, because it is really not the right place for this.
> 
> Perhaps it should just be inside a function named `_lazyInitialization`. It is also unclear to me why this is the correct place and not something like `shown` or `restoreFromCookie`. Can you describe why this is the most appropriate?

I am investigating moving it to `restoreFromCookie`.  I agree that it was badly placed, but I put it here because it was the one function that every "entry" to the Timelines tab seemed to call.
Comment 8 Devin Rousso 2017-05-23 13:32:16 PDT
Created attachment 311043 [details]
Patch
Comment 9 Joseph Pecoraro 2017-05-23 15:57:02 PDT
Comment on attachment 311043 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311043&action=review

> Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js:326
>  

Does that me we should be able to assert down here that we have a _displayedRecording? Before this change, and the previous patch, would have loaded the active recording in this path as well but this patch does not. Why does it not need to be done here?
Comment 10 Devin Rousso 2017-05-23 17:05:30 PDT
Created attachment 311080 [details]
Patch
Comment 11 Joseph Pecoraro 2017-05-24 11:23:02 PDT
Comment on attachment 311080 [details]
Patch

r=me
Comment 12 WebKit Commit Bot 2017-05-24 11:53:49 PDT
Comment on attachment 311080 [details]
Patch

Clearing flags on attachment: 311080

Committed r217379: <http://trac.webkit.org/changeset/217379>
Comment 13 WebKit Commit Bot 2017-05-24 11:53:50 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Radar WebKit Bug Importer 2017-05-30 20:26:17 PDT
<rdar://problem/32479815>