зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1693074
- Remove child interception telemetries related codes. r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D118396
This commit is contained in:
Родитель
75ed803f7c
Коммит
43495b894c
|
@ -105,11 +105,6 @@ NS_IMETHODIMP
|
|||
CancelChannelRunnable::Run() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// TODO: When bug 1204254 is implemented, this time marker should be moved to
|
||||
// the point where the body of the network request is complete.
|
||||
mChannel->SetHandleFetchEventEnd(TimeStamp::Now());
|
||||
mChannel->SaveTimeStamps();
|
||||
|
||||
mChannel->CancelInterception(mStatus);
|
||||
mRegistration->MaybeScheduleUpdate();
|
||||
return NS_OK;
|
||||
|
@ -206,11 +201,6 @@ class FinishResponse final : public Runnable {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
TimeStamp timeStamp = TimeStamp::Now();
|
||||
mChannel->SetHandleFetchEventEnd(timeStamp);
|
||||
mChannel->SetFinishSynthesizedResponseEnd(timeStamp);
|
||||
mChannel->SaveTimeStamps();
|
||||
|
||||
return rv;
|
||||
}
|
||||
};
|
||||
|
@ -568,7 +558,6 @@ NS_IMPL_ISUPPORTS0(RespondWithHandler)
|
|||
void RespondWithHandler::ResolvedCallback(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue) {
|
||||
AutoCancel autoCancel(this, mRequestURL);
|
||||
mInterceptedChannel->SetFinishResponseStart(TimeStamp::Now());
|
||||
|
||||
if (!aValue.isObject()) {
|
||||
NS_WARNING(
|
||||
|
@ -749,8 +738,6 @@ void RespondWithHandler::RejectedCallback(JSContext* aCx,
|
|||
uint32_t column = mRespondWithColumnNumber;
|
||||
nsString valueString;
|
||||
|
||||
mInterceptedChannel->SetFinishResponseStart(TimeStamp::Now());
|
||||
|
||||
nsContentUtils::ExtractErrorValues(aCx, aValue, sourceSpec, &line, &column,
|
||||
valueString);
|
||||
|
||||
|
|
|
@ -1201,7 +1201,6 @@ class FetchEventRunnable : public ExtendableFunctionalEventWorkerRunnable,
|
|||
nsCString mMethod;
|
||||
nsString mClientId;
|
||||
nsString mResultingClientId;
|
||||
bool mMarkLaunchServiceWorkerEnd;
|
||||
RequestCache mCacheMode;
|
||||
RequestMode mRequestMode;
|
||||
RequestRedirect mRequestRedirect;
|
||||
|
@ -1230,7 +1229,6 @@ class FetchEventRunnable : public ExtendableFunctionalEventWorkerRunnable,
|
|||
mScriptSpec(aScriptSpec),
|
||||
mClientId(aClientId),
|
||||
mResultingClientId(aResultingClientId),
|
||||
mMarkLaunchServiceWorkerEnd(aMarkLaunchServiceWorkerEnd),
|
||||
mCacheMode(RequestCache::Default),
|
||||
mRequestMode(RequestMode::No_cors),
|
||||
mRequestRedirect(RequestRedirect::Follow)
|
||||
|
@ -1340,20 +1338,6 @@ class FetchEventRunnable : public ExtendableFunctionalEventWorkerRunnable,
|
|||
bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override {
|
||||
MOZ_ASSERT(aWorkerPrivate);
|
||||
|
||||
if (mMarkLaunchServiceWorkerEnd) {
|
||||
mInterceptedChannel->SetLaunchServiceWorkerEnd(TimeStamp::Now());
|
||||
|
||||
// A probe to measure sw launch time for telemetry.
|
||||
TimeStamp launchStartTime = TimeStamp();
|
||||
mInterceptedChannel->GetLaunchServiceWorkerStart(&launchStartTime);
|
||||
|
||||
TimeStamp launchEndTime = TimeStamp();
|
||||
mInterceptedChannel->GetLaunchServiceWorkerEnd(&launchEndTime);
|
||||
Telemetry::AccumulateTimeDelta(Telemetry::SERVICE_WORKER_LAUNCH_TIME,
|
||||
launchStartTime, launchEndTime);
|
||||
}
|
||||
|
||||
mInterceptedChannel->SetDispatchFetchEventEnd(TimeStamp::Now());
|
||||
return DispatchFetchEvent(aCx, aWorkerPrivate);
|
||||
}
|
||||
|
||||
|
@ -1376,18 +1360,11 @@ class FetchEventRunnable : public ExtendableFunctionalEventWorkerRunnable,
|
|||
explicit ResumeRequest(
|
||||
nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel)
|
||||
: Runnable("dom::FetchEventRunnable::ResumeRequest"),
|
||||
mChannel(aChannel) {
|
||||
mChannel->SetFinishResponseStart(TimeStamp::Now());
|
||||
}
|
||||
mChannel(aChannel) {}
|
||||
|
||||
NS_IMETHOD Run() override {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
TimeStamp timeStamp = TimeStamp::Now();
|
||||
mChannel->SetHandleFetchEventEnd(timeStamp);
|
||||
mChannel->SetChannelResetEnd(timeStamp);
|
||||
mChannel->SaveTimeStamps();
|
||||
|
||||
nsresult rv = mChannel->ResetInterception(false);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to resume intercepted network request");
|
||||
|
@ -1484,8 +1461,6 @@ class FetchEventRunnable : public ExtendableFunctionalEventWorkerRunnable,
|
|||
event->PostInit(mInterceptedChannel, mRegistration, mScriptSpec);
|
||||
event->SetTrusted(true);
|
||||
|
||||
mInterceptedChannel->SetHandleFetchEventStart(TimeStamp::Now());
|
||||
|
||||
nsresult rv2 = DispatchExtendableEventOnWorkerScope(
|
||||
aCx, aWorkerPrivate->GlobalScope(), event, nullptr);
|
||||
if ((NS_WARN_IF(NS_FAILED(rv2)) &&
|
||||
|
@ -1576,17 +1551,10 @@ nsresult ServiceWorkerPrivate::SendFetchEvent(
|
|||
aResultingClientId);
|
||||
}
|
||||
|
||||
aChannel->SetLaunchServiceWorkerStart(TimeStamp::Now());
|
||||
aChannel->SetDispatchFetchEventStart(TimeStamp::Now());
|
||||
|
||||
bool newWorkerCreated = false;
|
||||
rv = SpawnWorkerIfNeeded(FetchEvent, &newWorkerCreated, aLoadGroup);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!newWorkerCreated) {
|
||||
aChannel->SetLaunchServiceWorkerEnd(TimeStamp::Now());
|
||||
}
|
||||
|
||||
nsMainThreadPtrHandle<nsIInterceptedChannel> handle(
|
||||
new nsMainThreadPtrHolder<nsIInterceptedChannel>("nsIInterceptedChannel",
|
||||
aChannel, false));
|
||||
|
|
|
@ -138,50 +138,6 @@ interface nsIInterceptedChannel : nsISupports
|
|||
[noscript]
|
||||
readonly attribute nsIConsoleReportCollector consoleReportCollector;
|
||||
|
||||
/**
|
||||
* Save the timestamps of various service worker interception phases.
|
||||
*/
|
||||
[noscript]
|
||||
void SetLaunchServiceWorkerStart(in TimeStamp aTimeStamp);
|
||||
|
||||
// A hack to get sw launch start time for telemetry.
|
||||
[noscript]
|
||||
void GetLaunchServiceWorkerStart(out TimeStamp aTimeStamp);
|
||||
|
||||
[noscript]
|
||||
void SetLaunchServiceWorkerEnd(in TimeStamp aTimeStamp);
|
||||
|
||||
// A hack to get sw launch end time for telemetry.
|
||||
[noscript]
|
||||
void GetLaunchServiceWorkerEnd(out TimeStamp aTimeStamp);
|
||||
|
||||
[noscript]
|
||||
void SetDispatchFetchEventStart(in TimeStamp aTimeStamp);
|
||||
|
||||
[noscript]
|
||||
void SetDispatchFetchEventEnd(in TimeStamp aTimeStamp);
|
||||
|
||||
[noscript]
|
||||
void SetHandleFetchEventStart(in TimeStamp aTimeStamp);
|
||||
|
||||
[noscript]
|
||||
void SetHandleFetchEventEnd(in TimeStamp aTimeStamp);
|
||||
|
||||
// Depending on the outcome we measure the time difference between
|
||||
// |FinishResponseStart| and either |FinishSynthesizedResponseEnd| or
|
||||
// |ChannelResetEnd|.
|
||||
[noscript]
|
||||
void SetFinishResponseStart(in TimeStamp aTimeStamp);
|
||||
|
||||
[noscript]
|
||||
void SetFinishSynthesizedResponseEnd(in TimeStamp aTimeStamp);
|
||||
|
||||
[noscript]
|
||||
void SetChannelResetEnd(in TimeStamp aTimeStamp);
|
||||
|
||||
[noscript]
|
||||
void SaveTimeStamps();
|
||||
|
||||
%{C++
|
||||
already_AddRefed<nsIConsoleReportCollector>
|
||||
GetConsoleReportCollector()
|
||||
|
|
|
@ -111,109 +111,6 @@ InterceptedChannelBase::SetReleaseHandle(nsISupports* aHandle) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedChannelBase::SaveTimeStamps() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// If we were not able to start the fetch event for some reason (like
|
||||
// corrupted scripts), then just do nothing here.
|
||||
if (mHandleFetchEventStart.IsNull()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> underlyingChannel;
|
||||
nsresult rv = GetChannel(getter_AddRefs(underlyingChannel));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
nsCOMPtr<nsITimedChannel> timedChannel = do_QueryInterface(underlyingChannel);
|
||||
MOZ_ASSERT(timedChannel);
|
||||
|
||||
rv = timedChannel->SetLaunchServiceWorkerStart(mLaunchServiceWorkerStart);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
rv = timedChannel->SetLaunchServiceWorkerEnd(mLaunchServiceWorkerEnd);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
rv = timedChannel->SetDispatchFetchEventStart(mDispatchFetchEventStart);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
rv = timedChannel->SetDispatchFetchEventEnd(mDispatchFetchEventEnd);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
rv = timedChannel->SetHandleFetchEventStart(mHandleFetchEventStart);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
rv = timedChannel->SetHandleFetchEventEnd(mHandleFetchEventEnd);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
GetChannel(getter_AddRefs(channel));
|
||||
if (NS_WARN_IF(!channel)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool isNonSubresourceRequest =
|
||||
nsContentUtils::IsNonSubresourceRequest(channel);
|
||||
nsCString navigationOrSubresource =
|
||||
isNonSubresourceRequest ? "navigation"_ns : "subresource"_ns;
|
||||
|
||||
nsAutoCString subresourceKey(""_ns);
|
||||
GetSubresourceTimeStampKey(channel, subresourceKey);
|
||||
|
||||
// We may have null timestamps if the fetch dispatch runnable was cancelled
|
||||
// and we defaulted to resuming the request.
|
||||
if (!mFinishResponseStart.IsNull() && !mFinishResponseEnd.IsNull()) {
|
||||
MOZ_ASSERT(mSynthesizedOrReset != Invalid);
|
||||
|
||||
Telemetry::HistogramID id =
|
||||
(mSynthesizedOrReset == Synthesized)
|
||||
? Telemetry::
|
||||
SERVICE_WORKER_FETCH_EVENT_FINISH_SYNTHESIZED_RESPONSE_MS
|
||||
: Telemetry::SERVICE_WORKER_FETCH_EVENT_CHANNEL_RESET_MS;
|
||||
Telemetry::Accumulate(
|
||||
id, navigationOrSubresource,
|
||||
static_cast<uint32_t>(
|
||||
(mFinishResponseEnd - mFinishResponseStart).ToMilliseconds()));
|
||||
if (!isNonSubresourceRequest && !subresourceKey.IsEmpty()) {
|
||||
Telemetry::Accumulate(
|
||||
id, subresourceKey,
|
||||
static_cast<uint32_t>(
|
||||
(mFinishResponseEnd - mFinishResponseStart).ToMilliseconds()));
|
||||
}
|
||||
}
|
||||
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SERVICE_WORKER_FETCH_EVENT_DISPATCH_MS,
|
||||
navigationOrSubresource,
|
||||
static_cast<uint32_t>((mHandleFetchEventStart - mDispatchFetchEventStart)
|
||||
.ToMilliseconds()));
|
||||
|
||||
if (!isNonSubresourceRequest && !subresourceKey.IsEmpty()) {
|
||||
Telemetry::Accumulate(Telemetry::SERVICE_WORKER_FETCH_EVENT_DISPATCH_MS,
|
||||
subresourceKey,
|
||||
static_cast<uint32_t>((mHandleFetchEventStart -
|
||||
mDispatchFetchEventStart)
|
||||
.ToMilliseconds()));
|
||||
}
|
||||
|
||||
if (!mFinishResponseEnd.IsNull()) {
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SERVICE_WORKER_FETCH_INTERCEPTION_DURATION_MS,
|
||||
navigationOrSubresource,
|
||||
static_cast<uint32_t>(
|
||||
(mFinishResponseEnd - mDispatchFetchEventStart).ToMilliseconds()));
|
||||
if (!isNonSubresourceRequest && !subresourceKey.IsEmpty()) {
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SERVICE_WORKER_FETCH_INTERCEPTION_DURATION_MS,
|
||||
subresourceKey,
|
||||
static_cast<uint32_t>((mFinishResponseEnd - mDispatchFetchEventStart)
|
||||
.ToMilliseconds()));
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<nsIURI> InterceptedChannelBase::SecureUpgradeChannelURI(
|
||||
nsIChannel* aChannel) {
|
||||
|
|
|
@ -46,15 +46,6 @@ class InterceptedChannelBase : public nsIInterceptedChannel {
|
|||
[[nodiscard]] nsresult DoSynthesizeHeader(const nsACString& aName,
|
||||
const nsACString& aValue);
|
||||
|
||||
TimeStamp mLaunchServiceWorkerStart;
|
||||
TimeStamp mLaunchServiceWorkerEnd;
|
||||
TimeStamp mDispatchFetchEventStart;
|
||||
TimeStamp mDispatchFetchEventEnd;
|
||||
TimeStamp mHandleFetchEventStart;
|
||||
TimeStamp mHandleFetchEventEnd;
|
||||
|
||||
TimeStamp mFinishResponseStart;
|
||||
TimeStamp mFinishResponseEnd;
|
||||
enum { Invalid = 0, Synthesized, Reset } mSynthesizedOrReset;
|
||||
|
||||
virtual ~InterceptedChannelBase() = default;
|
||||
|
@ -72,80 +63,6 @@ class InterceptedChannelBase : public nsIInterceptedChannel {
|
|||
nsIConsoleReportCollector** aCollectorOut) override;
|
||||
NS_IMETHOD SetReleaseHandle(nsISupports* aHandle) override;
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetLaunchServiceWorkerStart(TimeStamp aTimeStamp) override {
|
||||
mLaunchServiceWorkerStart = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GetLaunchServiceWorkerStart(TimeStamp* aTimeStamp) override {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aTimeStamp);
|
||||
*aTimeStamp = mLaunchServiceWorkerStart;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetLaunchServiceWorkerEnd(TimeStamp aTimeStamp) override {
|
||||
mLaunchServiceWorkerEnd = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GetLaunchServiceWorkerEnd(TimeStamp* aTimeStamp) override {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aTimeStamp);
|
||||
*aTimeStamp = mLaunchServiceWorkerEnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetDispatchFetchEventStart(TimeStamp aTimeStamp) override {
|
||||
mDispatchFetchEventStart = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetDispatchFetchEventEnd(TimeStamp aTimeStamp) override {
|
||||
mDispatchFetchEventEnd = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetHandleFetchEventStart(TimeStamp aTimeStamp) override {
|
||||
mHandleFetchEventStart = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetHandleFetchEventEnd(TimeStamp aTimeStamp) override {
|
||||
mHandleFetchEventEnd = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetFinishResponseStart(TimeStamp aTimeStamp) override {
|
||||
mFinishResponseStart = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetFinishSynthesizedResponseEnd(TimeStamp aTimeStamp) override {
|
||||
MOZ_ASSERT(mSynthesizedOrReset == Invalid);
|
||||
mSynthesizedOrReset = Synthesized;
|
||||
mFinishResponseEnd = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetChannelResetEnd(TimeStamp aTimeStamp) override {
|
||||
MOZ_ASSERT(mSynthesizedOrReset == Invalid);
|
||||
mSynthesizedOrReset = Reset;
|
||||
mFinishResponseEnd = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP SaveTimeStamps() override;
|
||||
|
||||
static already_AddRefed<nsIURI> SecureUpgradeChannelURI(nsIChannel* aChannel);
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ InterceptedHttpChannel::InterceptedHttpChannel(
|
|||
mProgressReported(0),
|
||||
mSynthesizedStreamLength(-1),
|
||||
mResumeStartPos(0),
|
||||
mSynthesizedOrReset(Invalid),
|
||||
// mSynthesizedOrReset(Invalid),
|
||||
mCallingStatusAndProgress(false) {
|
||||
// Pre-set the creation and AsyncOpen times based on the original channel
|
||||
// we are intercepting. We don't want our extra internal redirect to mask
|
||||
|
@ -875,143 +875,6 @@ InterceptedHttpChannel::GetConsoleReportCollector(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::GetLaunchServiceWorkerStart(
|
||||
mozilla::TimeStamp* aTimeStamp) {
|
||||
return HttpBaseChannel::GetLaunchServiceWorkerStart(aTimeStamp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetLaunchServiceWorkerStart(
|
||||
mozilla::TimeStamp aTimeStamp) {
|
||||
return HttpBaseChannel::SetLaunchServiceWorkerStart(aTimeStamp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::GetLaunchServiceWorkerEnd(
|
||||
mozilla::TimeStamp* aTimeStamp) {
|
||||
return HttpBaseChannel::GetLaunchServiceWorkerEnd(aTimeStamp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetLaunchServiceWorkerEnd(
|
||||
mozilla::TimeStamp aTimeStamp) {
|
||||
return HttpBaseChannel::SetLaunchServiceWorkerEnd(aTimeStamp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetDispatchFetchEventStart(
|
||||
mozilla::TimeStamp aTimeStamp) {
|
||||
return HttpBaseChannel::SetDispatchFetchEventStart(aTimeStamp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetDispatchFetchEventEnd(
|
||||
mozilla::TimeStamp aTimeStamp) {
|
||||
return HttpBaseChannel::SetDispatchFetchEventEnd(aTimeStamp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetHandleFetchEventStart(
|
||||
mozilla::TimeStamp aTimeStamp) {
|
||||
return HttpBaseChannel::SetHandleFetchEventStart(aTimeStamp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetHandleFetchEventEnd(mozilla::TimeStamp aTimeStamp) {
|
||||
return HttpBaseChannel::SetHandleFetchEventEnd(aTimeStamp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetFinishResponseStart(mozilla::TimeStamp aTimeStamp) {
|
||||
mFinishResponseStart = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetFinishSynthesizedResponseEnd(
|
||||
mozilla::TimeStamp aTimeStamp) {
|
||||
MOZ_ASSERT(mSynthesizedOrReset == Invalid);
|
||||
mSynthesizedOrReset = Synthesized;
|
||||
mFinishResponseEnd = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetChannelResetEnd(mozilla::TimeStamp aTimeStamp) {
|
||||
MOZ_ASSERT(mSynthesizedOrReset == Invalid);
|
||||
mSynthesizedOrReset = Reset;
|
||||
mFinishResponseEnd = aTimeStamp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SaveTimeStamps(void) {
|
||||
// If we were not able to start the fetch event for some reason (like
|
||||
// corrupted scripts), then just do nothing here.
|
||||
if (mHandleFetchEventStart.IsNull()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool isNonSubresourceRequest = nsContentUtils::IsNonSubresourceRequest(this);
|
||||
nsCString navigationOrSubresource =
|
||||
isNonSubresourceRequest ? "navigation"_ns : "subresource"_ns;
|
||||
|
||||
nsAutoCString subresourceKey(""_ns);
|
||||
GetSubresourceTimeStampKey(this, subresourceKey);
|
||||
|
||||
// We may have null timestamps if the fetch dispatch runnable was cancelled
|
||||
// and we defaulted to resuming the request.
|
||||
if (!mFinishResponseStart.IsNull() && !mFinishResponseEnd.IsNull()) {
|
||||
Telemetry::HistogramID id =
|
||||
(mSynthesizedOrReset == Synthesized)
|
||||
? Telemetry::
|
||||
SERVICE_WORKER_FETCH_EVENT_FINISH_SYNTHESIZED_RESPONSE_MS
|
||||
: Telemetry::SERVICE_WORKER_FETCH_EVENT_CHANNEL_RESET_MS;
|
||||
Telemetry::Accumulate(
|
||||
id, navigationOrSubresource,
|
||||
static_cast<uint32_t>(
|
||||
(mFinishResponseEnd - mFinishResponseStart).ToMilliseconds()));
|
||||
if (!isNonSubresourceRequest && !subresourceKey.IsEmpty()) {
|
||||
Telemetry::Accumulate(
|
||||
id, subresourceKey,
|
||||
static_cast<uint32_t>(
|
||||
(mFinishResponseEnd - mFinishResponseStart).ToMilliseconds()));
|
||||
}
|
||||
}
|
||||
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SERVICE_WORKER_FETCH_EVENT_DISPATCH_MS,
|
||||
navigationOrSubresource,
|
||||
static_cast<uint32_t>((mHandleFetchEventStart - mDispatchFetchEventStart)
|
||||
.ToMilliseconds()));
|
||||
|
||||
if (!isNonSubresourceRequest && !subresourceKey.IsEmpty()) {
|
||||
Telemetry::Accumulate(Telemetry::SERVICE_WORKER_FETCH_EVENT_DISPATCH_MS,
|
||||
subresourceKey,
|
||||
static_cast<uint32_t>((mHandleFetchEventStart -
|
||||
mDispatchFetchEventStart)
|
||||
.ToMilliseconds()));
|
||||
}
|
||||
|
||||
if (!mFinishResponseEnd.IsNull()) {
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SERVICE_WORKER_FETCH_INTERCEPTION_DURATION_MS,
|
||||
navigationOrSubresource,
|
||||
static_cast<uint32_t>(
|
||||
(mFinishResponseEnd - mDispatchFetchEventStart).ToMilliseconds()));
|
||||
if (!isNonSubresourceRequest && !subresourceKey.IsEmpty()) {
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::SERVICE_WORKER_FETCH_INTERCEPTION_DURATION_MS,
|
||||
subresourceKey,
|
||||
static_cast<uint32_t>((mFinishResponseEnd - mDispatchFetchEventStart)
|
||||
.ToMilliseconds()));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::SetReleaseHandle(nsISupports* aHandle) {
|
||||
mReleaseHandle = aHandle;
|
||||
|
|
|
@ -91,7 +91,7 @@ class InterceptedHttpChannel final
|
|||
uint64_t mResumeStartPos;
|
||||
nsCString mResumeEntityId;
|
||||
nsString mStatusHost;
|
||||
enum { Invalid = 0, Synthesized, Reset } mSynthesizedOrReset;
|
||||
// enum { Invalid = 0, Synthesized, Reset } mSynthesizedOrReset;
|
||||
Atomic<bool> mCallingStatusAndProgress;
|
||||
|
||||
InterceptedHttpChannel(PRTime aCreationTime,
|
||||
|
|
Загрузка…
Ссылка в новой задаче