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

View File

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

View File

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

View File

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

View File

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

View File

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