Bug 1567222 - Add a LOAD_STOP marker when a request goes through a service worker r=asuth,necko-reviewers,valentin,gerald

Differential Revision: https://phabricator.services.mozilla.com/D107714
This commit is contained in:
Julien Wajsberg 2021-03-11 14:31:11 +00:00
parent 25fa34ae40
commit 1081130547
2 changed files with 33 additions and 4 deletions

View file

@ -7,6 +7,7 @@
#include "InterceptedHttpChannel.h"
#include "nsContentSecurityManager.h"
#include "nsEscape.h"
#include "mozilla/ProfilerMarkers.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/dom/ChannelInfo.h"
@ -1071,6 +1072,32 @@ InterceptedHttpChannel::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
// Register entry to the PerformanceStorage resource timing
MaybeReportTimingData();
#ifdef MOZ_GECKO_PROFILER
if (profiler_can_accept_markers()) {
// These do allocations/frees/etc; avoid if not active
nsAutoCString requestMethod;
GetRequestMethod(requestMethod);
nsCOMPtr<nsIURI> uri;
GetURI(getter_AddRefs(uri));
int32_t priority = PRIORITY_NORMAL;
GetPriority(&priority);
uint64_t size = 0;
GetEncodedBodySize(&size);
nsAutoCString contentType;
if (mResponseHead) {
mResponseHead->ContentType(contentType);
}
profiler_add_network_marker(
uri, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_STOP,
mAsyncOpenTime, TimeStamp::Now(), size, kCacheUnknown,
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, nullptr,
std::move(mSource), Some(nsDependentCString(contentType.get())));
}
#endif
nsresult rv = NS_OK;
if (mListener) {
rv = mListener->OnStopRequest(this, mStatus);

View file

@ -8117,16 +8117,18 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet,
int32_t priority = PRIORITY_NORMAL;
GetPriority(&priority);
uint64_t size = 0;
GetEncodedBodySize(&size);
nsAutoCString contentType;
if (mResponseHead) {
mResponseHead->ContentType(contentType);
}
profiler_add_network_marker(
uri, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_STOP,
mLastStatusReported, TimeStamp::Now(), mLogicalOffset,
mCacheDisposition, mLoadInfo->GetInnerWindowID(), &mTransactionTimings,
nullptr, std::move(mSource),
Some(nsDependentCString(contentType.get())));
mLastStatusReported, TimeStamp::Now(), size, mCacheDisposition,
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, nullptr,
std::move(mSource), Some(nsDependentCString(contentType.get())));
}
#endif