Skip to content

Deduplicate HTTP Uri ModelLoaders #4352

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

Merged

Conversation

dlew
Copy link
Contributor

@dlew dlew commented Sep 21, 2020

Description

This change deduplicates the identical efforts made by UrlUriLoader and HttpUriLoader by deprecating HttpUriLoader and removing it from the registry.

Fixes #2943

Motivation and Context

Glide had two essentially identical ModelLoaders: UrlUriLoader and HttpUriLoader. They both were being used to defer HTTP/HTTPS Uris to another ModelLoader.

Best-case scenario, this was a harmless distraction; but in some bad cases, it was possible for both ModelLoaders to fire, duplicating work.

With this change, only one of the two HTTP Uri ModelLoaders are entered into the registry. The one no longer being used has been deprecated as well.

I chose to deprecate HttpUriLoader because it can be implemented as a UrlUriLoader (but not vice versa, due to generics). To demonstrate that it still behaves the same, the test (which now targets UrlUriLoader) is unchanged but still passes.

Note

This PR was originally opened as #4316 but went stale while I was on vacation. I've rebased onto the latest master and am more than happy to work with maintainers to figure out how to get this merged (if this fix is desired).

Glide had two essentially identical ModelLoaders: UrlUriLoader and
HttpUriLoader. They both were being used to defer HTTP/HTTPS Uris
to another ModelLoader.

Best-case scenario, this was a harmless distraction; but in some bad
cases, it was possible for both ModelLoaders to fire, duplicating work.

With this change, only one of the two HTTP Uri ModelLoaders are entered
into the registry. The one no longer being used has been deprecated as well.

I chose to deprecate HttpUriLoader because it can be implemented as a
UrlUriLoader (but not vice versa, due to generics). To demonstrate that
it still behaves the same, the test (which now targets UrlUriLoader) is
unchanged but still passes.
@sjudd
Copy link
Collaborator

sjudd commented Sep 22, 2020

So sorry for the delay!

@sjudd sjudd added the import-ready Indicates the PR is ready to be imported to Google. label Sep 22, 2020
@copybara-service copybara-service bot merged commit 50ebdbf into bumptech:master Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes enhancement import-ready Indicates the PR is ready to be imported to Google.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: HttpUriLoader and UrlUriLoader both used when image has 404: Expected?
3 participants