Commit cf421db5 authored by rajendrant's avatar rajendrant Committed by Commit Bot

Report resource type in resource starts

Report resource type in DidStartResponse. This will be used by
MetricsRenderFrameObserver to distinguish frame requests.

Bug: 836029
Change-Id: I9e5cc9ec220286dd15b110114c624c81afe60e13
Reviewed-on: https://chromium-review.googlesource.com/1123374
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: rajendrant <rajendrant@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572093}
parent a9cd5b8b
......@@ -87,7 +87,8 @@ void MetricsRenderFrameObserver::DidObserveNewCssPropertyUsage(
void MetricsRenderFrameObserver::DidStartResponse(
int request_id,
const network::ResourceResponseHead& response_head) {}
const network::ResourceResponseHead& response_head,
content::ResourceType resource_type) {}
void MetricsRenderFrameObserver::DidCompleteResponse(
int request_id,
......
......@@ -38,9 +38,9 @@ class MetricsRenderFrameObserver : public content::RenderFrameObserver {
void DidObserveNewFeatureUsage(blink::mojom::WebFeature feature) override;
void DidObserveNewCssPropertyUsage(int css_property,
bool is_animated) override;
void DidStartResponse(
int request_id,
const network::ResourceResponseHead& response_head) override;
void DidStartResponse(int request_id,
const network::ResourceResponseHead& response_head,
content::ResourceType resource_type) override;
void DidReceiveTransferSizeUpdate(int request_id,
int received_data_length) override;
void DidCompleteResponse(
......
......@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/strings/string16.h"
#include "content/common/content_export.h"
#include "content/public/common/resource_type.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
#include "mojo/public/cpp/system/message_pipe.h"
......@@ -133,7 +134,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener,
// |request_id| uniquely identifies the request within this render frame.
virtual void DidStartResponse(
int request_id,
const network::ResourceResponseHead& response_head) {}
const network::ResourceResponseHead& response_head,
content::ResourceType resource_type) {}
virtual void DidCompleteResponse(
int request_id,
const network::URLLoaderCompletionStatus& status) {}
......
......@@ -100,14 +100,16 @@ void NotifyResourceLoadStarted(
scoped_refptr<base::SingleThreadTaskRunner> thread_task_runner,
int render_frame_id,
int request_id,
const network::ResourceResponseHead& response_head) {
const network::ResourceResponseHead& response_head,
content::ResourceType resource_type) {
if (!thread_task_runner)
return;
if (!thread_task_runner->BelongsToCurrentThread()) {
thread_task_runner->PostTask(
FROM_HERE, base::BindOnce(NotifyResourceLoadStarted, thread_task_runner,
render_frame_id, request_id, response_head));
render_frame_id, request_id, response_head,
resource_type));
return;
}
......@@ -116,7 +118,7 @@ void NotifyResourceLoadStarted(
if (!render_frame)
return;
render_frame->DidStartResponse(request_id, response_head);
render_frame->DidStartResponse(request_id, response_head, resource_type);
}
void NotifyResourceLoadComplete(
......@@ -310,7 +312,8 @@ void ResourceDispatcher::OnReceivedResponse(
auto deep_copied_response = resource_response->DeepCopy();
NotifyResourceLoadStarted(RenderThreadImpl::DeprecatedGetMainTaskRunner(),
request_info->render_frame_id, request_id,
deep_copied_response->head);
deep_copied_response->head,
request_info->resource_type);
}
void ResourceDispatcher::OnReceivedCachedMetadata(
......
......@@ -4896,9 +4896,10 @@ void RenderFrameImpl::DidLoadResourceFromMemoryCache(
void RenderFrameImpl::DidStartResponse(
int request_id,
const network::ResourceResponseHead& response_head) {
const network::ResourceResponseHead& response_head,
content::ResourceType resource_type) {
for (auto& observer : observers_)
observer.DidStartResponse(request_id, response_head);
observer.DidStartResponse(request_id, response_head, resource_type);
}
void RenderFrameImpl::DidCompleteResponse(
......
......@@ -47,6 +47,7 @@
#include "content/public/common/referrer.h"
#include "content/public/common/renderer_preferences.h"
#include "content/public/common/request_context_type.h"
#include "content/public/common/resource_type.h"
#include "content/public/common/stop_find_action.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/websocket_handshake_throttle_provider.h"
......@@ -882,7 +883,8 @@ class CONTENT_EXPORT RenderFrameImpl
void OnDroppedNavigation();
void DidStartResponse(int request_id,
const network::ResourceResponseHead& response_head);
const network::ResourceResponseHead& response_head,
content::ResourceType resource_type);
void DidCompleteResponse(int request_id,
const network::URLLoaderCompletionStatus& status);
void DidCancelResponse(int request_id);
......
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