Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1168)

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 577963002: Add time-to-network histogram considering browser side navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: histogram.xml Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index ebfce6cdca9ef6cb37e6bf14c1dbb9cd11968d4f..2533241b5be46d2c389376987947d75083015fe7 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -32,6 +32,7 @@
#include "content/browser/download/save_file_resource_handler.h"
#include "content/browser/fileapi/chrome_blob_storage_context.h"
#include "content/browser/frame_host/navigation_request_info.h"
+#include "content/browser/frame_host/navigator.h"
#include "content/browser/loader/async_resource_handler.h"
#include "content/browser/loader/buffered_resource_handler.h"
#include "content/browser/loader/cross_site_resource_handler.h"
@@ -329,6 +330,24 @@ void AttachRequestBodyBlobDataHandles(
}
}
+// PlzNavigate
+// This method is called in the UI thread to send the timestamp of a resource
+// request to the respective NavigatorImpl (for an UMA histogram).
+void LogResourceRequestTimeOnUI(
+ base::TimeTicks timestamp,
+ int render_process_id,
+ int render_frame_host,
+ GURL url) {
davidben 2014/09/19 21:52:45 Nit: const GURL& url
carlosk 2014/09/23 17:02:57 Done.
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ RenderFrameHostImpl* host =
+ RenderFrameHostImpl::FromID(render_process_id, render_frame_host);
+ if (host != NULL) {
+ DCHECK(host->frame_tree_node()->IsMainFrame());
+ content::Navigator* navigator = host->frame_tree_node()->navigator();
clamy 2014/09/19 14:56:03 content:: is unnecessary here.
carlosk 2014/09/23 17:02:57 Done.
+ navigator->LogResourceRequestTime(timestamp, url);
+ }
+}
+
} // namespace
// static
@@ -888,6 +907,17 @@ void ResourceDispatcherHostImpl::OnRequestResource(
int routing_id,
int request_id,
const ResourceHostMsg_Request& request_data) {
+ if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) {
+ int child_id = filter_->child_id();
clamy 2014/09/19 14:56:03 nit: you could just write filter_->child_id() in t
carlosk 2014/09/23 17:02:57 Done.
+ BrowserThread::PostTask(
+ BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&LogResourceRequestTimeOnUI,
+ TimeTicks::Now(),
davidben 2014/09/19 21:52:45 A thought: net/ maintains a net::LoadTimingInfo wh
carlosk 2014/09/23 17:02:57 As discussed in yesterday's hangout I'll use this
clamy 2014/09/23 21:54:07 As mentioned in the bug, this is problematic as ht
+ child_id,
+ request_data.render_frame_id,
+ request_data.url));
+ }
BeginRequest(request_id, request_data, NULL, routing_id);
}

Powered by Google App Engine
This is Rietveld 408576698