Commit 7b69dc07 authored by Conley Owens's avatar Conley Owens Committed by Commit Bot

Report mime_type in SubresourceLoadInfo

This change adds a string `mime_type` to the list of fields in
SubresourceLoadInfo.  Notably, this is important for recording page
load metrics when the Network Service is enabled.

BUG=816684

Change-Id: Ie95bd46074f2a0f915eb8378800afa0f5ed46ecd
Reviewed-on: https://chromium-review.googlesource.com/963312Reviewed-by: default avatarJay Civelli <jcivelli@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Conley Owens <cco3@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545877}
parent c7456322
...@@ -575,6 +575,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, SubresourceLoadComplete) { ...@@ -575,6 +575,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, SubresourceLoadComplete) {
EXPECT_EQ(page_url, subresource_load_info->referrer); EXPECT_EQ(page_url, subresource_load_info->referrer);
EXPECT_EQ("GET", subresource_load_info->method); EXPECT_EQ("GET", subresource_load_info->method);
EXPECT_EQ(content::RESOURCE_TYPE_IMAGE, subresource_load_info->resource_type); EXPECT_EQ(content::RESOURCE_TYPE_IMAGE, subresource_load_info->resource_type);
EXPECT_EQ("image/jpeg", subresource_load_info->mime_type);
ASSERT_TRUE(subresource_load_info->ip); ASSERT_TRUE(subresource_load_info->ip);
EXPECT_EQ("127.0.0.1", subresource_load_info->ip->ToString()); EXPECT_EQ("127.0.0.1", subresource_load_info->ip->ToString());
} }
......
...@@ -23,6 +23,9 @@ struct SubresourceLoadInfo { ...@@ -23,6 +23,9 @@ struct SubresourceLoadInfo {
// The resource type. // The resource type.
ResourceType resource_type; ResourceType resource_type;
// The mime type.
string mime_type;
// The host IP. // The host IP.
net.interfaces.IPAddress? ip; net.interfaces.IPAddress? ip;
......
...@@ -178,6 +178,7 @@ void ResourceDispatcher::OnReceivedResponse( ...@@ -178,6 +178,7 @@ void ResourceDispatcher::OnReceivedResponse(
} }
if (!IsResourceTypeFrame(request_info->resource_type)) { if (!IsResourceTypeFrame(request_info->resource_type)) {
request_info->mime_type = response_head.mime_type;
NotifySubresourceStarted(RenderThreadImpl::DeprecatedGetMainTaskRunner(), NotifySubresourceStarted(RenderThreadImpl::DeprecatedGetMainTaskRunner(),
request_info->render_frame_id, request_info->render_frame_id,
request_info->response_url, request_info->response_url,
...@@ -273,6 +274,7 @@ void ResourceDispatcher::OnRequestComplete( ...@@ -273,6 +274,7 @@ void ResourceDispatcher::OnRequestComplete(
subresource_load_info->resource_type = request_info->resource_type; subresource_load_info->resource_type = request_info->resource_type;
if (request_info->parsed_ip.IsValid()) if (request_info->parsed_ip.IsValid())
subresource_load_info->ip = request_info->parsed_ip; subresource_load_info->ip = request_info->parsed_ip;
subresource_load_info->mime_type = request_info->mime_type;
subresource_load_info->was_cached = status.exists_in_cache; subresource_load_info->was_cached = status.exists_in_cache;
NotifySubresourceLoadComplete( NotifySubresourceLoadComplete(
RenderThreadImpl::DeprecatedGetMainTaskRunner(), RenderThreadImpl::DeprecatedGetMainTaskRunner(),
......
...@@ -192,6 +192,7 @@ class CONTENT_EXPORT ResourceDispatcher { ...@@ -192,6 +192,7 @@ class CONTENT_EXPORT ResourceDispatcher {
linked_ptr<base::SharedMemory> buffer; linked_ptr<base::SharedMemory> buffer;
int buffer_size; int buffer_size;
net::IPAddress parsed_ip; net::IPAddress parsed_ip;
std::string mime_type;
// For mojo loading. // For mojo loading.
std::unique_ptr<ThrottlingURLLoader> url_loader; std::unique_ptr<ThrottlingURLLoader> url_loader;
......
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