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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 2444783002: Add trace event for complete network request (Closed)
Patch Set: Remove empty beginResourceLoad function Created 4 years, 1 month 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: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index 87844840edb85a80b9c188695d2e0aa0de7adc67..1c5bc180dc035a760be273bc7bcc8f1bfa9771ed 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -40,6 +40,7 @@
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/mhtml/ArchiveResource.h"
#include "platform/mhtml/MHTMLArchive.h"
+#include "platform/network/NetworkInstrumentation.h"
#include "platform/network/NetworkUtils.h"
#include "platform/network/ResourceTimingInfo.h"
#include "platform/tracing/TraceEvent.h"
@@ -484,6 +485,9 @@ Resource* ResourceFetcher::requestResource(
FetchRequest& request,
const ResourceFactory& factory,
const SubstituteData& substituteData) {
+ unsigned long identifier = createUniqueIdentifier();
+ network_instrumentation::ScopedResourceLoadTracker scopedResourceLoadTracker(
+ identifier, request.resourceRequest());
SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Fetch.RequestResourceTime");
DCHECK(request.options().synchronousPolicy == RequestAsynchronously ||
factory.type() == Resource::Raw ||
@@ -497,13 +501,13 @@ Resource* ResourceFetcher::requestResource(
context().addClientHintsIfNecessary(request);
context().addCSPHeaderIfNecessary(factory.type(), request);
+ // TODO(dproy): Remove this. http://crbug.com/659666
TRACE_EVENT1("blink", "ResourceFetcher::requestResource", "url",
urlForTraceEvent(request.url()));
if (!request.url().isValid())
return nullptr;
- unsigned long identifier = createUniqueIdentifier();
request.mutableResourceRequest().setPriority(computeLoadPriority(
factory.type(), request, ResourcePriority::NotVisible));
initializeResourceRequest(request.mutableResourceRequest(), factory.type(),
@@ -634,6 +638,9 @@ Resource* ResourceFetcher::requestResource(
if (!startLoad(resource))
return nullptr;
+
+ scopedResourceLoadTracker.doNotCloseSliceAtEndOfScope();
+
DCHECK(!resource->errorOccurred() ||
request.options().synchronousPolicy == RequestSynchronously);
return resource;
@@ -1044,6 +1051,7 @@ bool ResourceFetcher::hasPendingRequest() const {
void ResourceFetcher::preloadStarted(Resource* resource) {
if (m_preloads && m_preloads->contains(resource))
return;
+ // TODO(dproy): Remove this. http://crbug.com/659666
TRACE_EVENT_ASYNC_STEP_INTO0("blink.net", "Resource", resource->identifier(),
caseq 2016/11/03 22:43:47 Let's just throw away these, they don't event seem
dproy 2016/11/04 20:41:55 Done.
"Preload");
resource->increasePreloadCount();
@@ -1118,7 +1126,10 @@ void ResourceFetcher::didFinishLoading(Resource* resource,
double finishTime,
int64_t encodedDataLength,
DidFinishLoadingReason finishReason) {
+ // TODO(dproy): Remove this. http://crbug.com/659666
TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource->identifier());
caseq 2016/11/03 22:43:47 ditto.
dproy 2016/11/04 20:41:55 Done.
+ network_instrumentation::endResourceLoad(
+ resource->identifier(), network_instrumentation::RequestOutcome::Success);
DCHECK(resource);
// When loading a multipart resource, make the loader non-block when finishing
@@ -1173,7 +1184,10 @@ void ResourceFetcher::didFinishLoading(Resource* resource,
void ResourceFetcher::didFailLoading(Resource* resource,
const ResourceError& error) {
+ // TODO(dproy): Remove this. http://crbug.com/659666
TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource->identifier());
caseq 2016/11/03 22:43:47 ditto.
dproy 2016/11/04 20:41:55 Done.
+ network_instrumentation::endResourceLoad(
+ resource->identifier(), network_instrumentation::RequestOutcome::Fail);
removeResourceLoader(resource->loader());
m_resourceTimingInfoMap.take(const_cast<Resource*>(resource));
bool isInternalRequest = resource->options().initiatorInfo.name ==
@@ -1419,6 +1433,7 @@ void ResourceFetcher::updateAllImageResourcePriorities() {
resource->didChangePriority(resourceLoadPriority,
resourcePriority.intraPriorityValue);
+ // TODO(dproy): Remove this. http://crbug.com/659666
TRACE_EVENT_ASYNC_STEP_INTO1("blink.net", "Resource",
caseq 2016/11/03 22:43:47 Let's add the new instrumentation support for that
dproy 2016/11/04 20:41:55 Done.
resource->identifier(), "ChangePriority",
"priority", resourceLoadPriority);

Powered by Google App Engine
This is Rietveld 408576698