Skip to content
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

[pull] main from chromium:main #93

Merged
merged 12 commits into from
Dec 12, 2021
6 changes: 3 additions & 3 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling Skia
# and whatever else without interference from each other.
'skia_revision': '454c04e8f3b45ba0c518cbdd49f67bfb95d83c35',
'skia_revision': 'd393ab3972e941c64820fc0037857ca559df9c19',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling V8
# and whatever else without interference from each other.
Expand Down Expand Up @@ -314,7 +314,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling devtools-frontend
# and whatever else without interference from each other.
'devtools_frontend_revision': '94e67d37dbf5929d7bc94c8dbbe51f7574edd16b',
'devtools_frontend_revision': 'df3aee1eb0d1c23537cb1e674fc982d31f5131f4',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling libprotobuf-mutator
# and whatever else without interference from each other.
Expand Down Expand Up @@ -1700,7 +1700,7 @@ deps = {
Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'),

'src-internal': {
'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@cdae51d8ea339b0727b56e28c4451b209cce9cb7',
'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@09c68b055810f5ce9e5dd2a05c3a05a5df8b24c2',
'condition': 'checkout_src_internal',
},

Expand Down
2 changes: 1 addition & 1 deletion build/fuchsia/linux.sdk.sha1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.20211211.2.1
7.20211212.0.1
2 changes: 1 addition & 1 deletion build/fuchsia/mac.sdk.sha1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.20211211.2.1
7.20211212.0.1
2 changes: 1 addition & 1 deletion chrome/build/linux.pgo.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
chrome-linux-main-1639266805-35c34f674005b1159c4d27bf203912c844bc45f8.profdata
chrome-linux-main-1639286637-b59f1210779796977681871312a9d48bef77098f.profdata
2 changes: 1 addition & 1 deletion chrome/build/mac.pgo.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
chrome-mac-main-1639266805-438623f615ba92ba93acae791fa0ccbd933e9dc8.profdata
chrome-mac-main-1639286637-8023d15c8b3831824fc79d288d233eda8b199035.profdata
2 changes: 1 addition & 1 deletion chrome/build/win32.pgo.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
chrome-win32-main-1639266805-7dba593161b3cd17c5489efd4c9849c9405cc535.profdata
chrome-win32-main-1639286637-951572250255b3589fc87d781365bca9bdfd69fe.profdata
2 changes: 1 addition & 1 deletion chrome/build/win64.pgo.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
chrome-win64-main-1639266805-daaa0b6fa54cb050e9f1a54b006b80e2101b834e.profdata
chrome-win64-main-1639286637-206f92f0693265bf7992d02c404ad658a29e7523.profdata
18 changes: 14 additions & 4 deletions content/browser/loader/navigation_early_hints_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/browser/storage_partition.h"
Expand Down Expand Up @@ -253,8 +254,11 @@ class NavigationEarlyHintsManager::PreloadURLLoaderClient
: public network::mojom::URLLoaderClient,
public mojo::DataPipeDrainer::Client {
public:
PreloadURLLoaderClient(NavigationEarlyHintsManager& owner, const GURL& url)
: owner_(owner), url_(url) {}
PreloadURLLoaderClient(NavigationEarlyHintsManager& owner,
const network::ResourceRequest& request)
: owner_(owner),
url_(request.url),
request_destination_(request.destination) {}

~PreloadURLLoaderClient() override = default;

Expand Down Expand Up @@ -319,13 +323,20 @@ class NavigationEarlyHintsManager::PreloadURLLoaderClient

void MaybeCompletePreload() {
if (CanCompletePreload()) {
if (!result_.was_canceled) {
base::UmaHistogramEnumeration(
kEarlyHintsPreloadRequestDestinationHistogramName,
request_destination_);
}

// Delete `this`.
owner_.OnPreloadComplete(url_, result_);
}
}

NavigationEarlyHintsManager& owner_;
const GURL url_;
const network::mojom::RequestDestination request_destination_;

PreloadedResource result_;
std::unique_ptr<mojo::DataPipeDrainer> response_body_drainer_;
Expand Down Expand Up @@ -506,8 +517,7 @@ void NavigationEarlyHintsManager::MaybePreloadHintedResource(
frame_tree_node_id_),
/*navigation_ui_data=*/nullptr, frame_tree_node_id_);

auto loader_client =
std::make_unique<PreloadURLLoaderClient>(*this, request.url);
auto loader_client = std::make_unique<PreloadURLLoaderClient>(*this, request);
auto loader = blink::ThrottlingURLLoader::CreateLoaderAndStart(
shared_loader_factory_, std::move(throttles),
content::GlobalRequestID::MakeBrowserInitiated().request_id,
Expand Down
3 changes: 3 additions & 0 deletions content/browser/loader/navigation_early_hints_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ struct CONTENT_EXPORT NavigationEarlyHintsManagerParams {
mojo::Remote<network::mojom::URLLoaderFactory> loader_factory;
};

constexpr char kEarlyHintsPreloadRequestDestinationHistogramName[] =
"Network.EarlyHints.Preload.RequestDestination";

// Handles 103 Early Hints responses for navigation. Responsible for resource
// hints in Early Hints responses. Created when the first 103 response is
// received and owned by NavigationURLLoaderImpl until the final response to the
Expand Down
14 changes: 14 additions & 0 deletions content/browser/loader/navigation_early_hints_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/public/test/browser_task_environment.h"
Expand Down Expand Up @@ -165,6 +166,8 @@ class NavigationEarlyHintsManagerTest : public testing::Test {
};

TEST_F(NavigationEarlyHintsManagerTest, SimpleResponse) {
base::HistogramTester histograms;

// Set up a response which simulates coming from network.
network::mojom::URLResponseHeadPtr head = CreatePreloadResponseHead();
network::URLLoaderCompletionStatus status;
Expand All @@ -183,6 +186,10 @@ TEST_F(NavigationEarlyHintsManagerTest, SimpleResponse) {
ASSERT_TRUE(it->second.error_code.has_value());
EXPECT_EQ(it->second.error_code.value(), net::OK);
EXPECT_FALSE(it->second.was_canceled);

histograms.ExpectUniqueSample(
kEarlyHintsPreloadRequestDestinationHistogramName,
network::mojom::RequestDestination::kScript, 1);
}

TEST_F(NavigationEarlyHintsManagerTest, EmptyBody) {
Expand All @@ -206,6 +213,8 @@ TEST_F(NavigationEarlyHintsManagerTest, EmptyBody) {
}

TEST_F(NavigationEarlyHintsManagerTest, ResponseExistsInDiskCache) {
base::HistogramTester histograms;

// Set up a response which simulates coming from disk cache.
network::mojom::URLResponseHeadPtr head = CreatePreloadResponseHead();
head->was_fetched_via_cache = true;
Expand All @@ -223,6 +232,11 @@ TEST_F(NavigationEarlyHintsManagerTest, ResponseExistsInDiskCache) {
auto it = preloads.find(GURL(kPreloadPath));
ASSERT_TRUE(it != preloads.end());
EXPECT_TRUE(it->second.was_canceled);

// The request destination histogram for a preload should not be recorded when
// the preload is canceled.
histograms.ExpectTotalCount(kEarlyHintsPreloadRequestDestinationHistogramName,
0);
}

TEST_F(NavigationEarlyHintsManagerTest, PreloadSchemeIsUnsupported) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
994fb0dc3a39365f38c72f711bdeca0344f91123
0e025d921f021baeb366d2b9e124f14337797d96
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6be7714b5f8f7b1c70f74352446b4c7bfd06ae71
8edb26b0c2628378f726bd15c583d4f76c47f6f0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a71fdc8620e6c7b029b69093eed44eabce4cb3ae
d8729d0e3089902167b138152dea16955cd1f09d
Original file line number Diff line number Diff line change
@@ -1 +1 @@
343029d5f26d813caa14a174ce7f591df9d5fcc5
713a9d8aa6f9cd3e9e4399efd38aeefc8e89f3a7
Original file line number Diff line number Diff line change
@@ -1 +1 @@
51ce1f8174e656b1f548206b1bd22dd564003b7e
ec27d153fae83e8b18bceebe4793d9ec3ecc3057
Original file line number Diff line number Diff line change
@@ -1 +1 @@
89932fd28c54d50e6f20f2a9d12336f8349d13a6
7dc0ba3cc1761de089b6d5d33c3d43385c1009c1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
32466ffb558ad34c55aedeb40e8c2ea09ef2b78b
0020c50899d1895bf349de16b4c8717f1aa69bc2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1784e1bf12d1d3647c3379b2abc85776f793a144
5b35c3d1c8e6c09a4e5d628fe59d3a809ee5e33f
Original file line number Diff line number Diff line change
@@ -1 +1 @@
94fbfac9eb34c1081149d2ace5cf4464fa5ca603
dcd0792229409f5e7bc9764b8e46cb2ecdcba5e6
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1101409bd568463b627982ef81ffffc04b15bb48
35e83d96d50b8b471f07f63c5dc4e2658bf1198b
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions tools/metrics/histograms/metadata/network/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,16 @@ chromium-metrics-reviews@google.com.
</token>
</histogram>

<histogram name="Network.EarlyHints.Preload.RequestDestination"
enum="RequestDestination" expires_after="2022-06-10">
<owner>bashi@chromium.org</owner>
<owner>blink-network-stack@google.com</owner>
<summary>
Records a request destination when a preload initiated by an Early Hints is
loaded from the network.
</summary>
</histogram>

<histogram name="Network.Patchpanel.ArcService"
enum="NetworkPatchpanelArcEvent" expires_after="2022-04-01">
<owner>hugobenichi@google.com</owner>
Expand Down