Commit b7cc0a15 authored by Kunihiko Sakamoto's avatar Kunihiko Sakamoto Committed by Commit Bot

SignedExchangeHandler: Populate load timings

This patch makes SignedExchangeHandler populate the minimal set of
timing info for the HTTP exchange response, so that devtools' network
timeline will show reasonable values.

Bug: 803774
Change-Id: Ida0d34f7bab86f5ff674b776fe5fca511111c87c
Reviewed-on: https://chromium-review.googlesource.com/967632Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarTsuyoshi Horo <horo@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544010}
parent f1f34606
...@@ -326,6 +326,15 @@ void SignedExchangeHandler::OnCertVerifyComplete(int result) { ...@@ -326,6 +326,15 @@ void SignedExchangeHandler::OnCertVerifyComplete(int result) {
response_head.headers->GetMimeTypeAndCharset(&response_head.mime_type, response_head.headers->GetMimeTypeAndCharset(&response_head.mime_type,
&response_head.charset); &response_head.charset);
// TODO(https://crbug.com/803774): Resource timing for signed exchange
// loading is not speced yet. https://github.com/WICG/webpackage/issues/156
response_head.load_timing.request_start_time = base::Time::Now();
base::TimeTicks now(base::TimeTicks::Now());
response_head.load_timing.request_start = now;
response_head.load_timing.send_start = now;
response_head.load_timing.send_end = now;
response_head.load_timing.receive_headers_end = now;
std::string mi_header_value; std::string mi_header_value;
if (!response_head.headers->EnumerateHeader(nullptr, kMiHeader, if (!response_head.headers->EnumerateHeader(nullptr, kMiHeader,
&mi_header_value)) { &mi_header_value)) {
......
...@@ -197,6 +197,11 @@ TEST_P(SignedExchangeHandlerTest, Simple) { ...@@ -197,6 +197,11 @@ TEST_P(SignedExchangeHandlerTest, Simple) {
EXPECT_EQ(200, resource_response().headers->response_code()); EXPECT_EQ(200, resource_response().headers->response_code());
EXPECT_EQ("text/html", resource_response().mime_type); EXPECT_EQ("text/html", resource_response().mime_type);
EXPECT_EQ("utf-8", resource_response().charset); EXPECT_EQ("utf-8", resource_response().charset);
EXPECT_FALSE(resource_response().load_timing.request_start_time.is_null());
EXPECT_FALSE(resource_response().load_timing.request_start.is_null());
EXPECT_FALSE(resource_response().load_timing.send_start.is_null());
EXPECT_FALSE(resource_response().load_timing.send_end.is_null());
EXPECT_FALSE(resource_response().load_timing.receive_headers_end.is_null());
std::string payload; std::string payload;
int rv = ReadPayloadStream(&payload); int rv = ReadPayloadStream(&payload);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment