Chromium Code Reviews
Descriptiondownloads: break downloads.js into more classes/files.
chrome://downloads' code has gotten less flexible than we'd like over
the years and needs a little TLC.
This CL heavily refactors chrome://downloads code by ripping apart
downloads.js into:
downloads.{
Item: a light data wrapper that has-an ItemView
ItemView: responsible for beautiful downloads
Manager: owns and manages all the items
}
as well as moving large portions of programmatic DOM creation (i.e. tons
of document.createElement() calls) into an HTML template that's cloned.
The JS refactor loosens the coupling between various layers, more
clearly show responsibilities, and makes the code easier to understand,
test, and maintain (in theory).
The new way C++ => JS communication works is:
- if an item will be hidden or shown (e.g. remove, undo, new)
- C++ sends a whole new list to the JS
- the JS is now much smarter about re-using DOM nodes
- this preserves focus and has better performance
- if an item is simply updated (e.g. downloading in progress)
- C++ sends an update to that specific item
R=asanka@chromium.org
BUG=446412
Committed: https://crrev.com/85c004102bdcf0e5d741559b2235fdcb9d4aaa19
Cr-Commit-Position: refs/heads/master@{#320204}
Patch Set 1 #
Total comments: 3
Patch Set 2 : fixes #Patch Set 3 : fix tests #Patch Set 4 : drag fix #Patch Set 5 : css tweak #Patch Set 6 : downloaded by extension #Patch Set 7 : +owners #Patch Set 8 : a11y test fixes #Patch Set 9 : remove NOTREACHED for testing code #
Total comments: 41
Patch Set 10 : asanka@ review #
Total comments: 4
Patch Set 11 : thestig@ review #Messages
Total messages: 37 (14 generated)
|