
On Windows, the set of Print Spooler API calls used to get the list of installed printers can require opening a connection to each printer. This might potentially block waiting on network connections to remote printers. Such delays can result in the EnumeratePrinters() call taking a long time, making the Print Preview UI unresponsive. There is a slightly different way to use the Print Spooler API that does not block on network connections. However, it does not return all of the information of interest for Print Preview. In particular, it is missing the location metadata. The location metadata can be found in the Windows registry for a printer driver. Since reading from the Windows registry also does not block on network connections, using a combination of the two provides a way to more quickly return all the same information as the prior Print Spooler-only method. Since the location metadata is relatively minor (only shows up in the dialog to select a destination), using the registry in this way is a relatively low-risk way to speed up the enumeration, since all the other information is still acquired using the Print Spooler API. Introduce the ability to use a mixed method of using the registry to supplement the faster Printer Spooler API method. Make this approach the default, but guard it behind a feature flag so that it can be disabled with an emergency kill switch if necessary. Given that this is a change to the low-level interaction with the operating system, introduce a manual unit test to validate the new method. Also update the printing_features files to concatenate the nested namespaces. Bug: 374128404 Change-Id: Icc48e928dd484b916b2d5a130c39f5dc313ee35a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6220277 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Alan Screen <awscreen@chromium.org> Cr-Commit-Position: refs/heads/main@{#1427285}
//printing
contains foundational code that is used for printing. It can depend
on other low-level directories like //cc/paint
and //ui
, but not higher
level code like //components
or //content
. Higher level printing code should
live in //components/printing
or the embedder.