Commit 718fd6c0 authored by Jay Civelli's avatar Jay Civelli Committed by Commit Bot

Add more info to ResourceLoadInfo

Adds additional information to the WebContentsObserver
ResourceLoadComplete notification that is required by the page load
metrics code:
- host IP and port for the request
- the total bytes count
- the raw bytes count

Also passing along the RenderFrameHost as part of the callback.

Change-Id: I9646221498312800488660d6b1b76abed467031b
Reviewed-on: https://chromium-review.googlesource.com/1050927Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Jay Civelli <jcivelli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558016}
parent 8e752524
...@@ -1160,8 +1160,8 @@ class LoadImageRequestObserver : public content::WebContentsObserver { ...@@ -1160,8 +1160,8 @@ class LoadImageRequestObserver : public content::WebContentsObserver {
: content::WebContentsObserver(web_contents), path_(path) {} : content::WebContentsObserver(web_contents), path_(path) {}
void ResourceLoadComplete( void ResourceLoadComplete(
const content::mojom::ResourceLoadInfo& resource_load_info, content::RenderFrameHost* render_frame_host,
bool is_main_frame) override { const content::mojom::ResourceLoadInfo& resource_load_info) override {
if (resource_load_info.url.path() == path_) if (resource_load_info.url.path() == path_)
run_loop_.Quit(); run_loop_.Quit();
} }
......
...@@ -446,12 +446,13 @@ void ClientSideDetectionHost::DidFinishNavigation( ...@@ -446,12 +446,13 @@ void ClientSideDetectionHost::DidFinishNavigation(
} }
void ClientSideDetectionHost::ResourceLoadComplete( void ClientSideDetectionHost::ResourceLoadComplete(
const content::mojom::ResourceLoadInfo& resource_load_info, content::RenderFrameHost* render_frame_host,
bool is_main_frame) { const content::mojom::ResourceLoadInfo& resource_load_info) {
if (!content::IsResourceTypeFrame(resource_load_info.resource_type) && if (!content::IsResourceTypeFrame(resource_load_info.resource_type) &&
browse_info_.get() && should_extract_malware_features_ && browse_info_.get() && should_extract_malware_features_ &&
resource_load_info.url.is_valid() && resource_load_info.ip.has_value()) { resource_load_info.url.is_valid() &&
UpdateIPUrlMap(resource_load_info.ip->ToString(), resource_load_info.network_info->ip_port_pair.has_value()) {
UpdateIPUrlMap(resource_load_info.network_info->ip_port_pair->host(),
resource_load_info.url.spec(), resource_load_info.method, resource_load_info.url.spec(), resource_load_info.method,
resource_load_info.referrer.spec(), resource_load_info.referrer.spec(),
resource_load_info.resource_type); resource_load_info.resource_type);
......
...@@ -46,8 +46,8 @@ class ClientSideDetectionHost : public content::WebContentsObserver, ...@@ -46,8 +46,8 @@ class ClientSideDetectionHost : public content::WebContentsObserver,
void DidFinishNavigation( void DidFinishNavigation(
content::NavigationHandle* navigation_handle) override; content::NavigationHandle* navigation_handle) override;
void ResourceLoadComplete( void ResourceLoadComplete(
const content::mojom::ResourceLoadInfo& resource_load_info, content::RenderFrameHost* render_frame_host,
bool is_main_frame) override; const content::mojom::ResourceLoadInfo& resource_load_info) override;
// Called when the SafeBrowsingService found a hit with one of the // Called when the SafeBrowsingService found a hit with one of the
// SafeBrowsing lists. This method is called on the UI thread. // SafeBrowsing lists. This method is called on the UI thread.
......
...@@ -1242,7 +1242,8 @@ TEST_F(ClientSideDetectionHostTest, ...@@ -1242,7 +1242,8 @@ TEST_F(ClientSideDetectionHostTest,
resource_load_info->referrer = GURL("http://host2.com"); resource_load_info->referrer = GURL("http://host2.com");
resource_load_info->method = "GET"; resource_load_info->method = "GET";
resource_load_info->resource_type = content::RESOURCE_TYPE_SUB_FRAME; resource_load_info->resource_type = content::RESOURCE_TYPE_SUB_FRAME;
csd_host_->ResourceLoadComplete(*resource_load_info, /*is_main_frame=*/false); csd_host_->ResourceLoadComplete(/*render_frame_host=*/nullptr,
*resource_load_info);
EXPECT_EQ(0u, GetBrowseInfo()->ips.size()); EXPECT_EQ(0u, GetBrowseInfo()->ips.size());
} }
......
...@@ -4154,9 +4154,8 @@ void WebContentsImpl::SubresourceResponseStarted(const GURL& url, ...@@ -4154,9 +4154,8 @@ void WebContentsImpl::SubresourceResponseStarted(const GURL& url,
void WebContentsImpl::ResourceLoadComplete( void WebContentsImpl::ResourceLoadComplete(
RenderFrameHost* render_frame_host, RenderFrameHost* render_frame_host,
mojom::ResourceLoadInfoPtr resource_load_info) { mojom::ResourceLoadInfoPtr resource_load_info) {
bool is_main_frame = !render_frame_host->GetParent();
for (auto& observer : observers_) { for (auto& observer : observers_) {
observer.ResourceLoadComplete(*resource_load_info, is_main_frame); observer.ResourceLoadComplete(render_frame_host, *resource_load_info);
} }
} }
......
...@@ -9,9 +9,11 @@ ...@@ -9,9 +9,11 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/pattern.h" #include "base/strings/pattern.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -663,46 +665,61 @@ class ResourceLoadObserver : public WebContentsObserver { ...@@ -663,46 +665,61 @@ class ResourceLoadObserver : public WebContentsObserver {
// Use this method with the SCOPED_TRACE macro, so it shows the caller context // Use this method with the SCOPED_TRACE macro, so it shows the caller context
// if it fails. // if it fails.
void CheckResourceLoaded(const GURL& url, void CheckResourceLoaded(
const GURL& referrer, const GURL& url,
const std::string& load_method, const GURL& referrer,
content::ResourceType resource_type, const std::string& load_method,
const std::string& mime_type, content::ResourceType resource_type,
const std::string& ip_address, const base::FilePath::StringPieceType& served_file_name,
bool was_cached, const std::string& mime_type,
bool first_network_request, const std::string& ip_address,
const base::TimeTicks& before_request, bool was_cached,
const base::TimeTicks& after_request) { bool first_network_request,
const base::TimeTicks& before_request,
const base::TimeTicks& after_request) {
bool resource_load_info_found = false; bool resource_load_info_found = false;
for (const auto& resource_load_info : resource_load_infos_) { for (const auto& resource_load_info : resource_load_infos_) {
if (resource_load_info->url == url) { if (resource_load_info->url != url)
resource_load_info_found = true; continue;
EXPECT_EQ(referrer, resource_load_info->referrer);
EXPECT_EQ(load_method, resource_load_info->method); resource_load_info_found = true;
EXPECT_EQ(resource_type, resource_load_info->resource_type); int64_t file_size = -1;
if (!first_network_request) if (!served_file_name.empty()) {
EXPECT_GT(resource_load_info->request_id, 0); base::ScopedAllowBlockingForTesting allow_blocking;
EXPECT_EQ(mime_type, resource_load_info->mime_type); base::FilePath test_dir;
ASSERT_TRUE(resource_load_info->ip); ASSERT_TRUE(base::PathService::Get(content::DIR_TEST_DATA, &test_dir));
EXPECT_EQ(ip_address, resource_load_info->ip->ToString()); base::FilePath served_file = test_dir.Append(served_file_name);
EXPECT_EQ(was_cached, resource_load_info->was_cached); ASSERT_TRUE(GetFileSize(served_file, &file_size));
// Simple sanity check of the load timing info. }
auto CheckTime = [before_request, after_request](auto actual) { EXPECT_EQ(referrer, resource_load_info->referrer);
EXPECT_LE(before_request, actual); EXPECT_EQ(load_method, resource_load_info->method);
EXPECT_GT(after_request, actual); EXPECT_EQ(resource_type, resource_load_info->resource_type);
}; if (!first_network_request)
const net::LoadTimingInfo& timing = EXPECT_GT(resource_load_info->request_id, 0);
resource_load_info->load_timing_info; EXPECT_EQ(mime_type, resource_load_info->mime_type);
CheckTime(timing.request_start); ASSERT_TRUE(resource_load_info->network_info->ip_port_pair);
CheckTime(timing.receive_headers_end); EXPECT_EQ(ip_address,
CheckTime(timing.send_start); resource_load_info->network_info->ip_port_pair->host());
CheckTime(timing.send_end); EXPECT_EQ(was_cached, resource_load_info->was_cached);
if (!was_cached) { // Simple sanity check of the load timing info.
CheckTime(timing.connect_timing.dns_start); auto CheckTime = [before_request, after_request](auto actual) {
CheckTime(timing.connect_timing.dns_end); EXPECT_LE(before_request, actual);
CheckTime(timing.connect_timing.connect_start); EXPECT_GT(after_request, actual);
CheckTime(timing.connect_timing.connect_end); };
} const net::LoadTimingInfo& timing = resource_load_info->load_timing_info;
CheckTime(timing.request_start);
CheckTime(timing.receive_headers_end);
CheckTime(timing.send_start);
CheckTime(timing.send_end);
if (!was_cached) {
CheckTime(timing.connect_timing.dns_start);
CheckTime(timing.connect_timing.dns_end);
CheckTime(timing.connect_timing.connect_start);
CheckTime(timing.connect_timing.connect_end);
}
if (file_size != -1) {
EXPECT_EQ(file_size, resource_load_info->raw_body_bytes);
EXPECT_LT(file_size, resource_load_info->total_received_bytes);
} }
} }
EXPECT_TRUE(resource_load_info_found); EXPECT_TRUE(resource_load_info_found);
...@@ -716,10 +733,13 @@ class ResourceLoadObserver : public WebContentsObserver { ...@@ -716,10 +733,13 @@ class ResourceLoadObserver : public WebContentsObserver {
private: private:
// WebContentsObserver implementation: // WebContentsObserver implementation:
void ResourceLoadComplete(const mojom::ResourceLoadInfo& resource_load_info, void ResourceLoadComplete(
bool is_main_frame) override { content::RenderFrameHost* render_frame_host,
const mojom::ResourceLoadInfo& resource_load_info) override {
EXPECT_NE(nullptr, render_frame_host);
resource_load_infos_.push_back(resource_load_info.Clone()); resource_load_infos_.push_back(resource_load_info.Clone());
resource_is_associated_with_main_frame_.push_back(is_main_frame); resource_is_associated_with_main_frame_.push_back(
render_frame_host->GetParent() == nullptr);
} }
void DidLoadResourceFromMemoryCache(const GURL& url, void DidLoadResourceFromMemoryCache(const GURL& url,
...@@ -746,17 +766,17 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ResourceLoadComplete) { ...@@ -746,17 +766,17 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ResourceLoadComplete) {
ASSERT_EQ(3U, observer.resource_load_infos().size()); ASSERT_EQ(3U, observer.resource_load_infos().size());
SCOPE_TRACED(observer.CheckResourceLoaded( SCOPE_TRACED(observer.CheckResourceLoaded(
page_url, /*referrer=*/GURL(), "GET", content::RESOURCE_TYPE_MAIN_FRAME, page_url, /*referrer=*/GURL(), "GET", content::RESOURCE_TYPE_MAIN_FRAME,
"text/html", "127.0.0.1", FILE_PATH_LITERAL("page_with_iframe.html"), "text/html", "127.0.0.1",
/*was_cached=*/false, /*first_network_request=*/true, before, after)); /*was_cached=*/false, /*first_network_request=*/true, before, after));
SCOPE_TRACED(observer.CheckResourceLoaded( SCOPE_TRACED(observer.CheckResourceLoaded(
embedded_test_server()->GetURL("/image.jpg"), embedded_test_server()->GetURL("/image.jpg"),
/*referrer=*/page_url, "GET", content::RESOURCE_TYPE_IMAGE, "image/jpeg", /*referrer=*/page_url, "GET", content::RESOURCE_TYPE_IMAGE,
"127.0.0.1", FILE_PATH_LITERAL("image.jpg"), "image/jpeg", "127.0.0.1",
/*was_cached=*/false, /*first_network_request=*/false, before, after)); /*was_cached=*/false, /*first_network_request=*/false, before, after));
SCOPE_TRACED(observer.CheckResourceLoaded( SCOPE_TRACED(observer.CheckResourceLoaded(
embedded_test_server()->GetURL("/title1.html"), embedded_test_server()->GetURL("/title1.html"),
/*referrer=*/page_url, "GET", content::RESOURCE_TYPE_SUB_FRAME, /*referrer=*/page_url, "GET", content::RESOURCE_TYPE_SUB_FRAME,
"text/html", "127.0.0.1", FILE_PATH_LITERAL("title1.html"), "text/html", "127.0.0.1",
/*was_cached=*/false, /*first_network_request=*/false, before, after)); /*was_cached=*/false, /*first_network_request=*/false, before, after));
} }
...@@ -776,12 +796,13 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ...@@ -776,12 +796,13 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ASSERT_EQ(2U, observer.resource_load_infos().size()); ASSERT_EQ(2U, observer.resource_load_infos().size());
SCOPE_TRACED(observer.CheckResourceLoaded( SCOPE_TRACED(observer.CheckResourceLoaded(
page_url, /*referrer=*/GURL(), "GET", content::RESOURCE_TYPE_MAIN_FRAME, page_url, /*referrer=*/GURL(), "GET", content::RESOURCE_TYPE_MAIN_FRAME,
"text/html", "127.0.0.1", /*was_cached=*/false, /*served_file_name=*/FILE_PATH_LITERAL(""), "text/html", "127.0.0.1",
/*was_cached=*/false,
/*first_network_request=*/true, before, after)); /*first_network_request=*/true, before, after));
SCOPE_TRACED(observer.CheckResourceLoaded( SCOPE_TRACED(observer.CheckResourceLoaded(
resource_url, /*referrer=*/page_url, "GET", content::RESOURCE_TYPE_SCRIPT, resource_url, /*referrer=*/page_url, "GET", content::RESOURCE_TYPE_SCRIPT,
"text/html", "127.0.0.1", /*served_file_name=*/FILE_PATH_LITERAL(""), "text/html", "127.0.0.1",
/*was_cached=*/false, /*first_network_request=*/false, before, after)); /*was_cached=*/false, /*first_network_request=*/false, before, after));
EXPECT_TRUE( EXPECT_TRUE(
observer.resource_load_infos()[1]->network_info->network_accessed); observer.resource_load_infos()[1]->network_info->network_accessed);
...@@ -795,7 +816,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ...@@ -795,7 +816,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ASSERT_EQ(1U, observer.resource_load_infos().size()); ASSERT_EQ(1U, observer.resource_load_infos().size());
SCOPE_TRACED(observer.CheckResourceLoaded( SCOPE_TRACED(observer.CheckResourceLoaded(
page_url, /*referrer=*/GURL(), "GET", content::RESOURCE_TYPE_MAIN_FRAME, page_url, /*referrer=*/GURL(), "GET", content::RESOURCE_TYPE_MAIN_FRAME,
"text/html", "127.0.0.1", /*served_file_name=*/FILE_PATH_LITERAL(""), "text/html", "127.0.0.1",
/*was_cached=*/false, /*first_network_request=*/false, before, after)); /*was_cached=*/false, /*first_network_request=*/false, before, after));
ASSERT_EQ(1U, observer.memory_cached_loaded_urls().size()); ASSERT_EQ(1U, observer.memory_cached_loaded_urls().size());
EXPECT_EQ(resource_url, observer.memory_cached_loaded_urls()[0]); EXPECT_EQ(resource_url, observer.memory_cached_loaded_urls()[0]);
...@@ -812,11 +833,11 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ...@@ -812,11 +833,11 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ASSERT_EQ(2U, observer.resource_load_infos().size()); ASSERT_EQ(2U, observer.resource_load_infos().size());
SCOPE_TRACED(observer.CheckResourceLoaded( SCOPE_TRACED(observer.CheckResourceLoaded(
page_url, /*referrer=*/GURL(), "GET", content::RESOURCE_TYPE_MAIN_FRAME, page_url, /*referrer=*/GURL(), "GET", content::RESOURCE_TYPE_MAIN_FRAME,
"text/html", "127.0.0.1", /*served_file_name=*/FILE_PATH_LITERAL(""), "text/html", "127.0.0.1",
/*was_cached=*/false, /*first_network_request=*/true, before, after)); /*was_cached=*/false, /*first_network_request=*/true, before, after));
SCOPE_TRACED(observer.CheckResourceLoaded( SCOPE_TRACED(observer.CheckResourceLoaded(
resource_url, /*referrer=*/page_url, "GET", content::RESOURCE_TYPE_SCRIPT, resource_url, /*referrer=*/page_url, "GET", content::RESOURCE_TYPE_SCRIPT,
"text/html", "127.0.0.1", /*served_file_name=*/FILE_PATH_LITERAL(""), "text/html", "127.0.0.1",
/*was_cached=*/true, /*first_network_request=*/false, before, after)); /*was_cached=*/true, /*first_network_request=*/false, before, after));
EXPECT_TRUE(observer.memory_cached_loaded_urls().empty()); EXPECT_TRUE(observer.memory_cached_loaded_urls().empty());
EXPECT_FALSE( EXPECT_FALSE(
......
...@@ -256,11 +256,11 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener { ...@@ -256,11 +256,11 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener {
const std::string& mime_type, const std::string& mime_type,
ResourceType resource_type) {} ResourceType resource_type) {}
// This method is invoked when a resource has been loaded, successfully or // This method is invoked when a resource associate with the frame
// not. // |render_frame_host| has been loaded, successfully or not.
virtual void ResourceLoadComplete( virtual void ResourceLoadComplete(
const mojom::ResourceLoadInfo& resource_load_info, RenderFrameHost* render_frame_host,
bool is_main_frame) {} const mojom::ResourceLoadInfo& resource_load_info) {}
// This method is invoked when a new non-pending navigation entry is created. // This method is invoked when a new non-pending navigation entry is created.
// This corresponds to one NavigationController entry being created // This corresponds to one NavigationController entry being created
......
...@@ -7,6 +7,7 @@ module content.mojom; ...@@ -7,6 +7,7 @@ module content.mojom;
import "content/public/common/load_timing_info.mojom"; import "content/public/common/load_timing_info.mojom";
import "content/public/common/resource_type.mojom"; import "content/public/common/resource_type.mojom";
import "net/interfaces/ip_address.mojom"; import "net/interfaces/ip_address.mojom";
import "services/network/public/mojom/network_param.mojom";
import "url/mojom/url.mojom"; import "url/mojom/url.mojom";
// Network related information reported for loads and redirects. // Network related information reported for loads and redirects.
...@@ -17,6 +18,9 @@ struct CommonNetworkInfo { ...@@ -17,6 +18,9 @@ struct CommonNetworkInfo {
// True if loading this resource always requires accessing the network, either // True if loading this resource always requires accessing the network, either
// because it should always be revalidated or because it should not be cached. // because it should always be revalidated or because it should not be cached.
bool always_access_network; bool always_access_network;
// The host IP and port of the response.
network.mojom.HostPortPair? ip_port_pair;
}; };
// Information for a redirect. // Information for a redirect.
...@@ -53,9 +57,6 @@ struct ResourceLoadInfo { ...@@ -53,9 +57,6 @@ struct ResourceLoadInfo {
// The mime type. // The mime type.
string mime_type; string mime_type;
// The host IP.
net.interfaces.IPAddress? ip;
// True if the response was fetched from the network cache. // True if the response was fetched from the network cache.
bool was_cached; bool was_cached;
...@@ -68,6 +69,16 @@ struct ResourceLoadInfo { ...@@ -68,6 +69,16 @@ struct ResourceLoadInfo {
// The timing info. // The timing info.
content.mojom.LoadTimingInfo load_timing_info; content.mojom.LoadTimingInfo load_timing_info;
// The size of the response body before removing any content encodings.
// Does not include redirects or sub-requests issued at lower levels (range
// requests or auth). Does include bytes from the cache.
int64 raw_body_bytes;
// The total amount of data received from network after SSL decoding and proxy
// handling. Pertains only to the last request, i.e. reset on redirects, but
// not reset when multiple roundtrips are used for range requests or auth.
int64 total_received_bytes;
// The list of redirects that led to this resource load. Empty if there were // The list of redirects that led to this resource load. Empty if there were
// no redirects. // no redirects.
array<RedirectInfo> redirect_info_chain; array<RedirectInfo> redirect_info_chain;
......
...@@ -192,7 +192,6 @@ void ResourceDispatcher::OnReceivedResponse( ...@@ -192,7 +192,6 @@ void ResourceDispatcher::OnReceivedResponse(
response_head = initial_response_head; response_head = initial_response_head;
} }
request_info->response_start = base::TimeTicks::Now();
request_info->mime_type = response_head.mime_type; request_info->mime_type = response_head.mime_type;
request_info->network_accessed = response_head.network_accessed; request_info->network_accessed = response_head.network_accessed;
request_info->always_access_network = request_info->always_access_network =
...@@ -204,14 +203,7 @@ void ResourceDispatcher::OnReceivedResponse( ...@@ -204,14 +203,7 @@ void ResourceDispatcher::OnReceivedResponse(
DCHECK(new_peer); DCHECK(new_peer);
request_info->peer = std::move(new_peer); request_info->peer = std::move(new_peer);
} }
request_info->host_port_pair = renderer_response_info.socket_address;
if (!response_head.socket_address.host().empty()) {
ignore_result(request_info->parsed_ip.AssignFromIPLiteral(
response_head.socket_address.host()));
}
request_info->mime_type = response_head.mime_type;
request_info->network_accessed = response_head.network_accessed;
if (!IsResourceTypeFrame(request_info->resource_type)) { if (!IsResourceTypeFrame(request_info->resource_type)) {
NotifySubresourceStarted(RenderThreadImpl::DeprecatedGetMainTaskRunner(), NotifySubresourceStarted(RenderThreadImpl::DeprecatedGetMainTaskRunner(),
request_info->render_frame_id, request_info->render_frame_id,
...@@ -287,6 +279,8 @@ void ResourceDispatcher::OnReceivedRedirect( ...@@ -287,6 +279,8 @@ void ResourceDispatcher::OnReceivedRedirect(
response_head.network_accessed; response_head.network_accessed;
net_redirect_info->network_info->always_access_network = net_redirect_info->network_info->always_access_network =
AlwaysAccessNetwork(response_head.headers); AlwaysAccessNetwork(response_head.headers);
net_redirect_info->network_info->ip_port_pair =
response_head.socket_address;
request_info->redirect_info_chain.push_back(std::move(net_redirect_info)); request_info->redirect_info_chain.push_back(std::move(net_redirect_info));
if (!request_info->is_deferred) if (!request_info->is_deferred)
...@@ -326,19 +320,20 @@ void ResourceDispatcher::OnRequestComplete( ...@@ -326,19 +320,20 @@ void ResourceDispatcher::OnRequestComplete(
resource_load_info->method = request_info->response_method; resource_load_info->method = request_info->response_method;
resource_load_info->resource_type = request_info->resource_type; resource_load_info->resource_type = request_info->resource_type;
resource_load_info->request_id = request_id; resource_load_info->request_id = request_id;
if (request_info->parsed_ip.IsValid())
resource_load_info->ip = request_info->parsed_ip;
resource_load_info->mime_type = request_info->mime_type; resource_load_info->mime_type = request_info->mime_type;
resource_load_info->network_info = mojom::CommonNetworkInfo::New(); resource_load_info->network_info = mojom::CommonNetworkInfo::New();
resource_load_info->network_info->network_accessed = resource_load_info->network_info->network_accessed =
request_info->network_accessed; request_info->network_accessed;
resource_load_info->network_info->always_access_network = resource_load_info->network_info->always_access_network =
request_info->always_access_network; request_info->always_access_network;
resource_load_info->network_info->ip_port_pair = request_info->host_port_pair;
resource_load_info->load_timing_info = request_info->load_timing_info; resource_load_info->load_timing_info = request_info->load_timing_info;
resource_load_info->was_cached = status.exists_in_cache; resource_load_info->was_cached = status.exists_in_cache;
resource_load_info->net_error = status.error_code; resource_load_info->net_error = status.error_code;
resource_load_info->redirect_info_chain = resource_load_info->redirect_info_chain =
std::move(request_info->redirect_info_chain); std::move(request_info->redirect_info_chain);
resource_load_info->total_received_bytes = status.encoded_data_length;
resource_load_info->raw_body_bytes = status.encoded_body_length;
NotifyResourceLoadComplete(RenderThreadImpl::DeprecatedGetMainTaskRunner(), NotifyResourceLoadComplete(RenderThreadImpl::DeprecatedGetMainTaskRunner(),
request_info->render_frame_id, request_info->render_frame_id,
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "content/public/common/resource_type.h" #include "content/public/common/resource_type.h"
#include "content/public/common/url_loader_throttle.h" #include "content/public/common/url_loader_throttle.h"
#include "mojo/public/cpp/system/data_pipe.h" #include "mojo/public/cpp/system/data_pipe.h"
#include "net/base/host_port_pair.h"
#include "net/base/request_priority.h" #include "net/base/request_priority.h"
#include "net/traffic_annotation/network_traffic_annotation.h" #include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
...@@ -208,7 +209,7 @@ class CONTENT_EXPORT ResourceDispatcher { ...@@ -208,7 +209,7 @@ class CONTENT_EXPORT ResourceDispatcher {
net::LoadTimingInfo load_timing_info; net::LoadTimingInfo load_timing_info;
linked_ptr<base::SharedMemory> buffer; linked_ptr<base::SharedMemory> buffer;
int buffer_size; int buffer_size;
net::IPAddress parsed_ip; net::HostPortPair host_port_pair;
bool network_accessed = false; bool network_accessed = false;
std::string mime_type; std::string mime_type;
std::unique_ptr<NavigationResponseOverrideParameters> std::unique_ptr<NavigationResponseOverrideParameters>
......
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