Bug 1715321 - [profiler, netwerk] Reorder some parameters of profiler_add_network_marker r=necko-reviewers,gerald,valentin

This moves optional redirect-related parameters to the end, so that it's
easier to use in non-redirect cases.

Differential Revision: https://phabricator.services.mozilla.com/D117680
This commit is contained in:
Julien Wajsberg
2021-06-21 07:37:55 +00:00
parent f277ea1134
commit a4bea8a9cc
6 changed files with 26 additions and 24 deletions

View File

@@ -877,8 +877,8 @@ void HttpChannelChild::OnStopRequest(
profiler_add_network_marker(
mURI, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_STOP,
mLastStatusReported, TimeStamp::Now(), mTransferSize, kCacheUnknown,
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, nullptr,
std::move(mSource), Some(nsDependentCString(contentType.get())));
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, std::move(mSource),
Some(nsDependentCString(contentType.get())));
}
#endif
@@ -1365,7 +1365,7 @@ void HttpChannelChild::Redirect1Begin(
mURI, requestMethod, mPriority, mChannelId,
NetworkLoadType::LOAD_REDIRECT, mLastStatusReported, TimeStamp::Now(),
0, kCacheUnknown, mLoadInfo->GetInnerWindowID(), &mTransactionTimings,
uri, std::move(mSource), Some(nsDependentCString(contentType.get())));
std::move(mSource), Some(nsDependentCString(contentType.get())), uri);
}
#endif
@@ -1680,7 +1680,7 @@ HttpChannelChild::CompleteRedirectSetup(nsIStreamListener* aListener) {
profiler_add_network_marker(
mURI, requestMethod, mPriority, mChannelId, NetworkLoadType::LOAD_START,
mChannelCreationTimestamp, mLastStatusReported, 0, kCacheUnknown,
mLoadInfo->GetInnerWindowID(), nullptr, nullptr);
mLoadInfo->GetInnerWindowID());
}
#endif
StoreIsPending(true);
@@ -2007,7 +2007,7 @@ nsresult HttpChannelChild::AsyncOpenInternal(nsIStreamListener* aListener) {
profiler_add_network_marker(
mURI, requestMethod, mPriority, mChannelId, NetworkLoadType::LOAD_START,
mChannelCreationTimestamp, mLastStatusReported, 0, kCacheUnknown,
mLoadInfo->GetInnerWindowID(), nullptr, nullptr);
mLoadInfo->GetInnerWindowID());
}
#endif
StoreIsPending(true);

View File

@@ -622,7 +622,7 @@ InterceptedHttpChannel::ResetInterception(void) {
mURI, requestMethod, priority, mChannelId,
NetworkLoadType::LOAD_REDIRECT, mAsyncOpenTime, TimeStamp::Now(), size,
kCacheUnknown, mLoadInfo->GetInnerWindowID(), &mTransactionTimings,
mURI, std::move(mSource), Some(nsDependentCString(contentType.get())));
std::move(mSource), Some(nsDependentCString(contentType.get())), mURI);
}
#endif
@@ -1121,8 +1121,8 @@ InterceptedHttpChannel::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
profiler_add_network_marker(
mURI, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_STOP,
mAsyncOpenTime, TimeStamp::Now(), size, kCacheUnknown,
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, nullptr,
std::move(mSource), Some(nsDependentCString(contentType.get())));
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, std::move(mSource),
Some(nsDependentCString(contentType.get())));
}
#endif

View File

@@ -5133,8 +5133,8 @@ nsresult nsHttpChannel::ContinueProcessRedirectionAfterFallback(nsresult rv) {
mURI, requestMethod, priority, mChannelId,
NetworkLoadType::LOAD_REDIRECT, mLastStatusReported, TimeStamp::Now(),
size, mCacheDisposition, mLoadInfo->GetInnerWindowID(), &timings,
mRedirectURI, std::move(mSource),
Some(nsDependentCString(contentType.get())));
std::move(mSource), Some(nsDependentCString(contentType.get())),
mRedirectURI);
}
#endif
@@ -5682,7 +5682,7 @@ nsHttpChannel::AsyncOpen(nsIStreamListener* aListener) {
profiler_add_network_marker(
mURI, requestMethod, mPriority, mChannelId, NetworkLoadType::LOAD_START,
mChannelCreationTimestamp, mLastStatusReported, 0, mCacheDisposition,
mLoadInfo->GetInnerWindowID(), nullptr, nullptr);
mLoadInfo->GetInnerWindowID());
}
#endif
@@ -7448,8 +7448,8 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet,
profiler_add_network_marker(
mURI, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_STOP,
mLastStatusReported, TimeStamp::Now(), size, mCacheDisposition,
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, nullptr,
std::move(mSource), Some(nsDependentCString(contentType.get())));
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, std::move(mSource),
Some(nsDependentCString(contentType.get())));
}
#endif

View File

@@ -5808,9 +5808,9 @@ void profiler_add_network_marker(
uint64_t aChannelId, NetworkLoadType aType, mozilla::TimeStamp aStart,
mozilla::TimeStamp aEnd, int64_t aCount,
mozilla::net::CacheDisposition aCacheDisposition, uint64_t aInnerWindowID,
const mozilla::net::TimingStruct* aTimings, nsIURI* aRedirectURI,
const mozilla::net::TimingStruct* aTimings,
UniquePtr<ProfileChunkedBuffer> aSource,
const Maybe<nsDependentCString>& aContentType) {
const Maybe<nsDependentCString>& aContentType, nsIURI* aRedirectURI) {
if (!profiler_can_accept_markers()) {
return;
}

View File

@@ -490,10 +490,9 @@ void profiler_add_network_marker(
mozilla::TimeStamp aEnd, int64_t aCount,
mozilla::net::CacheDisposition aCacheDisposition, uint64_t aInnerWindowID,
const mozilla::net::TimingStruct* aTimings = nullptr,
nsIURI* aRedirectURI = nullptr,
mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aSource = nullptr,
const mozilla::Maybe<nsDependentCString>& aContentType =
mozilla::Nothing());
const mozilla::Maybe<nsDependentCString>& aContentType = mozilla::Nothing(),
nsIURI* aRedirectURI = nullptr);
enum TracingKind {
TRACING_EVENT,

View File

@@ -930,11 +930,12 @@ TEST(GeckoProfiler, Markers)
net::kCacheHit,
/* uint64_t aInnerWindowID */ 78
/* const mozilla::net::TimingStruct* aTimings = nullptr */
/* nsIURI* aRedirectURI = nullptr */
/* mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aSource =
nullptr */
/* const mozilla::Maybe<nsDependentCString>& aContentType =
mozilla::Nothing() */);
mozilla::Nothing() */
/* nsIURI* aRedirectURI = nullptr */
);
profiler_add_network_marker(
/* nsIURI* aURI */ uri,
@@ -949,13 +950,13 @@ TEST(GeckoProfiler, Markers)
net::kCacheUnresolved,
/* uint64_t aInnerWindowID */ 78,
/* const mozilla::net::TimingStruct* aTimings = nullptr */ nullptr,
/* nsIURI* aRedirectURI = nullptr */ nullptr,
/* mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aSource =
nullptr */
nullptr,
/* const mozilla::Maybe<nsDependentCString>& aContentType =
mozilla::Nothing() */
Some(nsDependentCString("text/html")));
Some(nsDependentCString("text/html")),
/* nsIURI* aRedirectURI = nullptr */ nullptr);
nsCOMPtr<nsIURI> redirectURI;
ASSERT_TRUE(NS_SUCCEEDED(
@@ -973,11 +974,13 @@ TEST(GeckoProfiler, Markers)
net::kCacheUnresolved,
/* uint64_t aInnerWindowID */ 78,
/* const mozilla::net::TimingStruct* aTimings = nullptr */ nullptr,
/* nsIURI* aRedirectURI = nullptr */ redirectURI
/* mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aSource =
nullptr */
nullptr,
/* const mozilla::Maybe<nsDependentCString>& aContentType =
mozilla::Nothing() */);
mozilla::Nothing() */
mozilla::Nothing(),
/* nsIURI* aRedirectURI = nullptr */ redirectURI);
MOZ_RELEASE_ASSERT(profiler_add_marker(
"Text in main thread with stack", geckoprofiler::category::OTHER,