-
Notifications
You must be signed in to change notification settings - Fork 16
Cleanup of non-browser prefetch code #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There were several problems (see also WebKit#86): - The `fileLoader` singleton contained code for the browser, which was actually dead. - `benchmark.fetchResources` was called twice in the CLI, once in `Driver.addBenchmark` and once again in `Driver.initialize` - For several of the `Benchmark.prefetch*/retryPrefetch*/fetchResources` methods, it wasn't clear that they would only be called in the browser/non-browser setting, which also resulted in dead and unnecessarily complex code. We can probably clean up more still, especially for the browser prefetching (see TODOs).
✅ Deploy Preview for webkit-jetstream-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
||
let response; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These following lines were dead code, since fileLoader.load
and thus _loadInternal
were only called from non-browser code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, since the remaining non-browser only code doesn't use promises at all, this doesn't need to be async
any longer. And this propagates further up the call chain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
@@ -498,16 +481,6 @@ class Driver { | |||
} | |||
|
|||
JetStream.loadCache = { }; // Done preloading all the files. | |||
} | |||
|
|||
async fetchResources() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged with prefetchResourcesForBrowser
into prefetchResources
.
@@ -181,47 +181,27 @@ function uiFriendlyDuration(time) { | |||
return `${time.toFixed(3)} ms`; | |||
} | |||
|
|||
// TODO: Cleanup / remove / merge. This is only used for caching loads in the | |||
// non-browser setting. In the browser we use exclusively `loadCache`, | |||
// `loadBlob`, `doLoadBlob`, `prefetchResourcesForBrowser` etc., see below. | |||
const fileLoader = (function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future-nit: we could actually start using modules instead of these "hacky" IFEEs to hide the classes.
@kmiller68 and @camillobruni Could you take a look?
There were several problems (see also #86):
fileLoader
singleton contained code for the browser, which was actually dead.benchmark.fetchResources
was called twice in the CLI, once inDriver.addBenchmark
and once again inDriver.initialize
Benchmark.prefetch*/retryPrefetch*/fetchResources
methods, it wasn't clear that they would only be called in the browser/non-browser setting, which also resulted in dead and unnecessarily complex code.We can probably clean up more still, especially for the browser prefetching (see TODOs).