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

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

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NavigationData final draft before adding tests Created 4 years, 8 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/navigation_url_loader_impl_core.cc
diff --git a/content/browser/loader/navigation_url_loader_impl_core.cc b/content/browser/loader/navigation_url_loader_impl_core.cc
index 84001faae576d66acff8e2cef250430acb126a47..6253425654c746a2efae0411dcb0942a3710d5a6 100644
--- a/content/browser/loader/navigation_url_loader_impl_core.cc
+++ b/content/browser/loader/navigation_url_loader_impl_core.cc
@@ -6,20 +6,21 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/time/time.h"
#include "content/browser/frame_host/navigation_request_info.h"
#include "content/browser/loader/navigation_resource_handler.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
#include "content/browser/service_worker/service_worker_navigation_handle_core.h"
#include "content/common/navigation_params.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/navigation_data.h"
#include "content/public/browser/stream_handle.h"
#include "content/public/common/resource_response.h"
#include "net/base/net_errors.h"
#include "net/url_request/redirect_info.h"
namespace content {
NavigationURLLoaderImplCore::NavigationURLLoaderImplCore(
const base::WeakPtr<NavigationURLLoaderImpl>& loader)
: loader_(loader),
@@ -87,39 +88,44 @@ void NavigationURLLoaderImplCore::NotifyRequestRedirected(
// TODO(carlosk): extend this trace to support non-PlzNavigate navigations.
// For the trace below we're using the NavigationURLLoaderImplCore as the
// async trace id and reporting the new redirect URL as a parameter.
TRACE_EVENT_ASYNC_BEGIN2("navigation", "Navigation redirectDelay", this,
"&NavigationURLLoaderImplCore", this, "New URL",
redirect_info.new_url.spec());
}
void NavigationURLLoaderImplCore::NotifyResponseStarted(
ResourceResponse* response,
- std::unique_ptr<StreamHandle> body) {
+ std::unique_ptr<StreamHandle> body,
+ NavigationData* navigation_data) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
"&NavigationURLLoaderImplCore", this, "success", true);
+ // Clone the embedder NavigationData before moving it to the UI thread.
+ std::unique_ptr<NavigationData> clone =
+ navigation_data ? navigation_data->Clone() : nullptr;
nasko 2016/04/26 20:18:40 Empty line after this and before next comment.
RyanSturm 2016/04/27 23:27:47 Done.
// If, by the time the task reaches the UI thread, |loader_| has already been
// destroyed, NotifyResponseStarted will not run. |body| will be destructed
// and the request released at that point.
// Make a copy of the ResourceResponse before it is passed to another thread.
//
// TODO(davidben): This copy could be avoided if ResourceResponse weren't
// reference counted and the loader stack passed unique ownership of the
// response. https://crbug.com/416050
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&NavigationURLLoaderImpl::NotifyResponseStarted, loader_,
- response->DeepCopy(), base::Passed(&body)));
+ response->DeepCopy(), base::Passed(&body),
+ base::Passed(&clone)));
}
void NavigationURLLoaderImplCore::NotifyRequestFailed(bool in_cache,
int net_error) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
"&NavigationURLLoaderImplCore", this, "success",
false);

Powered by Google App Engine
This is Rietveld 408576698