commit | 8802b00292e17e96c16a3659a4d902cdf144ae84 | [log] [tgz] |
---|---|---|
author | Colin Blundell <blundell@chromium.org> | Wed Mar 23 09:50:51 2022 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Mar 23 09:50:51 2022 |
tree | 37a5b06c1822e551d04c425d9ebc3fa3b19107e1 | |
parent | 410fe2eb1a52fa4c9ca886a010c9b6a272a4db15 [diff] |
[PreconnectManager] Put checks for network context under UNIT_TEST This CL clarifies PreconnectManager code that I noticed while analyzing this class: PreconnectManager checks whether the pointer returned by its GetNetworkContext() method is null every time it wants to use it, but this pointer is in fact guaranteed to be non-null outside of unittesting contexts. In particular, outside of a unittesting context it returns content::StoragePartition::GetNetworkContext(); the latter is guaranteed to return a non-null pointer as it initializes the NetworkContext if necessary before returning it. To clarify that the null checks are present *only* for unittests, this CL places those checks under #if defined(UNIT_TEST). This is analogous to the code that actually *returns* nullptr from PreconnectManager::GetNetworkContext(), which is under the same ifdef. The concrete motivation for this CL is to preserve the knowledge I gained that the usage of BrowserTaskType::kPreconnect in one of these early-outs is not relevant in production code. Bug: 1257582 Change-Id: I0dfb3e5e9ebb9720791b52bca4539fdb54ca9086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3540881 Reviewed-by: Egor Pasko <pasko@chromium.org> Commit-Queue: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/main@{#984253}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.