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

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

Issue 2444783002: Add trace event for complete network request (Closed)
Patch Set: Calm down compiler with return value 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e9eb278bcb794fd99c72b69405573e95a445ef63 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,17 +501,19 @@ 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(),
request.defer());
+ network_instrumentation::resourcePrioritySet(
+ identifier, request.resourceRequest().priority());
if (!context().canRequest(
factory.type(), request.resourceRequest(),
@@ -634,6 +640,9 @@ Resource* ResourceFetcher::requestResource(
if (!startLoad(resource))
return nullptr;
+
+ scopedResourceLoadTracker.resourceLoadContinuesBeyondScope();
+
DCHECK(!resource->errorOccurred() ||
request.options().synchronousPolicy == RequestSynchronously);
return resource;
@@ -1044,8 +1053,6 @@ bool ResourceFetcher::hasPendingRequest() const {
void ResourceFetcher::preloadStarted(Resource* resource) {
if (m_preloads && m_preloads->contains(resource))
return;
- TRACE_EVENT_ASYNC_STEP_INTO0("blink.net", "Resource", resource->identifier(),
- "Preload");
resource->increasePreloadCount();
if (!m_preloads)
@@ -1118,7 +1125,8 @@ void ResourceFetcher::didFinishLoading(Resource* resource,
double finishTime,
int64_t encodedDataLength,
DidFinishLoadingReason finishReason) {
- TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource->identifier());
+ 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 +1181,8 @@ void ResourceFetcher::didFinishLoading(Resource* resource,
void ResourceFetcher::didFailLoading(Resource* resource,
const ResourceError& error) {
- TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource->identifier());
+ 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,9 +1428,8 @@ void ResourceFetcher::updateAllImageResourcePriorities() {
resource->didChangePriority(resourceLoadPriority,
resourcePriority.intraPriorityValue);
- TRACE_EVENT_ASYNC_STEP_INTO1("blink.net", "Resource",
- resource->identifier(), "ChangePriority",
- "priority", resourceLoadPriority);
+ network_instrumentation::resourcePrioritySet(resource->identifier(),
+ resourceLoadPriority);
context().dispatchDidChangeResourcePriority(
resource->identifier(), resourceLoadPriority,
resourcePriority.intraPriorityValue);
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698